Merge location.lnx.3.0 into location.lnx.7.3.9
Merged into subfolder sdm845
CRs-fixed: 2153405
Change-Id: Id10efb2acc5aae79efc375b4d7535de69408c433
diff --git a/Android.mk b/Android.mk
index e2c5a56..1ea0bfc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,36 @@
-ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
-LOCAL_PATH := $(call my-dir)
+# TODO: Find a better way to separate build configs for ADP vs non-ADP devices
+ifneq ($(BOARD_IS_AUTOMOTIVE),true)
+ ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ LOCAL_PATH := $(call my-dir)
+ ifeq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
-include $(call all-makefiles-under,$(LOCAL_PATH))
+ ifneq ($(filter apq8064,$(TARGET_BOARD_PLATFORM)),)
+ #For apq8064 use msm8960
+ include $(call all-named-subdir-makefiles,msm8960)
+ else ifneq ($(filter msm8992,$(TARGET_BOARD_PLATFORM)),)
+ #For msm8992 use msm8994
+ include $(call all-named-subdir-makefiles,msm8994)
+ else ifneq ($(filter msm8960 msm8084 msm8994 msm8996 msm8998 sdm845,$(TARGET_BOARD_PLATFORM)),)
+ #For these, use their platform name as the subdirectory
+ include $(call all-named-subdir-makefiles,$(TARGET_BOARD_PLATFORM))
+ else ifeq ($(filter msm8916,$(TARGET_BOARD_PLATFORM)),)
+ #For all other targets besides msm8916
+ GPS_DIRS=core utils loc_api platform_lib_abstractions etc
+ include $(call all-named-subdir-makefiles,$(GPS_DIRS))
+ endif #TARGET_BOARD_PLATFORM
+
+ else
+ ifneq ($(filter sdm845,$(TARGET_BOARD_PLATFORM)),)
+ include $(call all-named-subdir-makefiles,$(TARGET_BOARD_PLATFORM))
+ else ifneq ($(filter msm8909 msm8226 ,$(TARGET_BOARD_PLATFORM)),)
+ #For msm8909 target
+ GPS_DIRS=msm8909/core msm8909/utils msm8909/loc_api msm8909/etc
+ include $(call all-named-subdir-makefiles,$(GPS_DIRS))
+ else ifeq ($(filter msm8916 ,$(TARGET_BOARD_PLATFORM)),)
+ GPS_DIRS=core utils loc_api platform_lib_abstractions etc
+ include $(call all-named-subdir-makefiles,$(GPS_DIRS))
+ endif
+ endif #BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET
+
+ endif #BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
endif
diff --git a/Makefile.am b/Makefile.am
index f64790e..f374a5c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,8 +3,8 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = core location gnss
+SUBDIRS = utils loc_api/libloc_api_50001 loc_api/loc_api_v02
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = loc-hal.pc
+pkgconfig_DATA = loc-api.pc
EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/configure.ac b/configure.ac
index ec41c86..dca18a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
-# configure.ac -- Autoconf script for gps loc_hal
+# configure.ac -- Autoconf script for gps loc_api
#
# 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)
+# Initialize the gps loc_api package version 1.0.0
+AC_INIT([loc-api],1.0.0)
# Does not strictly follow GNU Coding standards
AM_INIT_AUTOMAKE([foreign])
# Disables auto rebuilding of configure, Makefile.ins
@@ -29,25 +29,19 @@
PKG_PROG_PKG_CONFIG
# Checks for libraries.
-PKG_CHECK_MODULES([QMI], [qmi])
-AC_SUBST([QMI_CFLAGS])
-AC_SUBST([QMI_LIBS])
-
PKG_CHECK_MODULES([QMIF], [qmi-framework])
AC_SUBST([QMIF_CFLAGS])
AC_SUBST([QMIF_LIBS])
-PKG_CHECK_MODULES([DATA], [data])
-AC_SUBST([DATA_CFLAGS])
-AC_SUBST([DATA_LIBS])
+AC_ARG_WITH([libhardware_includes],
+ AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@],
+ [Specify the location of the libhardware headers]),
+ [libhardware_incdir=$withval],
+ with_libhardware_includes=no)
-PKG_CHECK_MODULES([LOCPLA], [loc-pla])
-AC_SUBST([LOCPLA_CFLAGS])
-AC_SUBST([LOCPLA_LIBS])
-
-PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
-AC_SUBST([GPSUTILS_CFLAGS])
-AC_SUBST([GPSUTILS_LIBS])
+if test "x$with_libhardware_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${libhardware_incdir}"
+fi
AC_ARG_WITH([core_includes],
AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
@@ -82,10 +76,10 @@
AC_CONFIG_FILES([ \
Makefile \
- core/Makefile \
- location/Makefile \
- gnss/Makefile \
- loc-hal.pc \
+ utils/Makefile \
+ loc_api/libloc_api_50001/Makefile \
+ loc_api/loc_api_v02/Makefile \
+ loc-api.pc \
])
AC_OUTPUT
diff --git a/core/Android.mk b/core/Android.mk
index dba0b0a..e1ac45a 100644
--- a/core/Android.mk
+++ b/core/Android.mk
@@ -6,8 +6,8 @@
include $(CLEAR_VARS)
LOCAL_MODULE := libloc_core
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+LOCAL_MODULE_OWNER := qcom
+
LOCAL_MODULE_TAGS := optional
ifeq ($(TARGET_DEVICE),apq8026_lw)
@@ -17,53 +17,44 @@
endif
LOCAL_SHARED_LIBRARIES := \
- liblog \
libutils \
libcutils \
libgps.utils \
- libdl \
- liblog \
- libloc_pla
+ libdl
LOCAL_SRC_FILES += \
+ MsgTask.cpp \
LocApiBase.cpp \
LocAdapterBase.cpp \
ContextBase.cpp \
LocDualContext.cpp \
- loc_core_log.cpp \
- data-items/DataItemsFactoryProxy.cpp \
- data-items/common/ClientIndex.cpp \
- data-items/common/DataItemIndex.cpp \
- data-items/common/IndexFactory.cpp \
- SystemStatusOsObserver.cpp \
- SystemStatus.cpp
+ loc_core_log.cpp
LOCAL_CFLAGS += \
-fno-short-enums \
- -D_ANDROID_
+ -D_ANDROID_ \
+ -Wno-unused-parameter
LOCAL_C_INCLUDES:= \
- $(LOCAL_PATH)/data-items \
- $(LOCAL_PATH)/data-items/common \
- $(LOCAL_PATH)/observer \
+ $(TARGET_OUT_HEADERS)/gps.utils
-LOCAL_HEADER_LIBRARIES := \
- libgps.utils_headers \
- libloc_pla_headers \
- liblocation_api_headers
+LOCAL_COPY_HEADERS_TO:= libloc_core/
+LOCAL_COPY_HEADERS:= \
+ MsgTask.h \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ LBSProxyBase.h \
+ UlpProxyBase.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h
-LOCAL_CFLAGS += $(GNSS_CFLAGS)
+LOCAL_PRELINK_MODULE := false
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/core/ContextBase.cpp b/core/ContextBase.cpp
index 05a0ad3..9f6c4aa 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014,2016-2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -26,7 +26,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-#define LOG_NDEBUG 0
+#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_CtxBase"
#include <dlfcn.h>
@@ -35,142 +35,11 @@
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
-#include <platform_lib_includes.h>
+#include <log_util.h>
#include <loc_log.h>
namespace loc_core {
-loc_gps_cfg_s_type ContextBase::mGps_conf {};
-loc_sap_cfg_s_type ContextBase::mSap_conf {};
-
-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'},
-};
-
-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_USAGE", &mSap_conf.SENSOR_USAGE, NULL, 'n'},
- {"SENSOR_ALGORITHM_CONFIG_MASK", &mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
- {"SENSOR_PROVIDER", &mSap_conf.SENSOR_PROVIDER, NULL, 'n'}
-};
-
-void ContextBase::readConfig()
-{
- /*Defaults for gps.conf*/
- mGps_conf.INTERMEDIATE_POS = 0;
- mGps_conf.ACCURACY_THRES = 0;
- mGps_conf.NMEA_PROVIDER = 0;
- mGps_conf.GPS_LOCK = 0;
- mGps_conf.SUPL_VER = 0x10000;
- mGps_conf.SUPL_MODE = 0x1;
- mGps_conf.SUPL_ES = 0;
- mGps_conf.SUPL_HOST[0] = 0;
- mGps_conf.SUPL_PORT = 0;
- mGps_conf.CAPABILITIES = 0x7;
- /* LTE Positioning Profile configuration is disable by default*/
- mGps_conf.LPP_PROFILE = 0;
- /*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;
-
- /*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_USAGE = 0; /* Enabled */
- 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;
- /* default provider is SSC */
- mSap_conf.SENSOR_PROVIDER = 1;
-
- /* 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;
-
- UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
- UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
-}
-
-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;
@@ -183,10 +52,6 @@
proxy = (*getter)();
}
}
- else
- {
- LOC_LOGW("%s:%d]: FAILED TO LOAD libname: %s\n", __func__, __LINE__, libName);
- }
if (NULL == proxy) {
proxy = new LBSProxyBase();
}
@@ -198,31 +63,28 @@
{
LocApiBase* locApi = NULL;
- // Check the target
- if (TARGET_NO_GNSS != loc_get_target()){
-
+ // first if can not be MPQ
+ if (TARGET_MPQ != loc_get_target()) {
if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
void *handle = NULL;
//try to see if LocApiV02 is present
- if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
- getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
- if (getter != NULL) {
- LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
- __LINE__);
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
}
}
// only RPC is the option now
else {
LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC",
- __func__, __LINE__);
+ __func__, __LINE__);
handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
if (NULL != handle) {
- getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
if (NULL != getter) {
- LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__,
- __LINE__);
+ LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, __LINE__);
locApi = (*getter)(mMsgTask, exMask, this);
}
}
diff --git a/core/ContextBase.h b/core/ContextBase.h
index dc64b6a..ff7a4b3 100644
--- a/core/ContextBase.h
+++ b/core/ContextBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
+/* 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
@@ -34,73 +34,6 @@
#include <MsgTask.h>
#include <LocApiBase.h>
#include <LBSProxyBase.h>
-#include <loc_cfg.h>
-
-#define MAX_XTRA_SERVER_URL_LENGTH (256)
-#define MAX_SUPL_SERVER_URL_LENGTH (256)
-
-/* GPS.conf support */
-/* NOTE: the implementaiton of the parser casts number
- 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[MAX_XTRA_SERVER_URL_LENGTH];
- char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
- char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
- uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
- uint32_t NMEA_PROVIDER;
- uint32_t 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[MAX_SUPL_SERVER_URL_LENGTH];
- uint32_t SUPL_PORT;
-} 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_USAGE;
- 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;
- uint32_t SENSOR_PROVIDER;
-} loc_sap_cfg_s_type;
namespace loc_core {
@@ -109,8 +42,6 @@
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;
@@ -127,23 +58,12 @@
inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
- inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
inline void requestUlp(LocAdapterBase* adapter,
unsigned long capabilities) {
mLBSProxy->requestUlp(adapter, capabilities);
}
- 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;
-
- void readConfig();
- static uint32_t getCarrierCapabilities();
-
};
} // namespace loc_core
diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h
index 94ddd0f..75ae992 100644
--- a/core/LBSProxyBase.h
+++ b/core/LBSProxyBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-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
@@ -43,10 +43,6 @@
getLocApi(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase* context) const {
-
- (void)msgTask;
- (void)exMask;
- (void)context;
return NULL;
}
protected:
@@ -54,23 +50,11 @@
public:
inline virtual ~LBSProxyBase() {}
inline virtual void requestUlp(LocAdapterBase* adapter,
- unsigned long capabilities) const {
-
- (void)adapter;
- (void)capabilities;
- }
+ unsigned long capabilities) const {}
inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
inline virtual bool hasCPIExtendedCapabilities() 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; }
+ inline virtual void modemPowerVote(bool power) const {}
+ virtual void injectFeatureConfig(ContextBase* context) const {}
};
typedef LBSProxyBase* (getLBSProxy_t)();
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index 3943819..fe0972c 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, 2016-2017The Linux Foundation. All rights reserved.
+/* 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
@@ -26,13 +26,13 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-#define LOG_NDEBUG 0
+#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_LocAdapterBase"
#include <dlfcn.h>
#include <LocAdapterBase.h>
#include <loc_target.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <LocAdapterProxyBase.h>
namespace loc_core {
@@ -50,16 +50,6 @@
mLocApi->addAdapter(this);
}
-uint32_t LocAdapterBase::mSessionIdCounter(1);
-
-uint32_t LocAdapterBase::generateSessionId()
-{
- if (++mSessionIdCounter == 0xFFFFFFFF)
- mSessionIdCounter = 1;
-
- return mSessionIdCounter;
-}
-
void LocAdapterBase::handleEngineUpEvent()
{
if (mLocAdapterProxyBase) {
@@ -75,45 +65,38 @@
}
void LocAdapterBase::
- reportPositionEvent(const UlpLocation& location,
- const GpsLocationExtended& locationExtended,
- enum loc_sess_status status,
- LocPosTechMask loc_technology_mask,
- bool /*fromUlp*/) {
- if (mLocAdapterProxyBase != NULL) {
- mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
- (GpsLocationExtended&)locationExtended,
- status,
- loc_technology_mask);
- } else {
+ reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ if (mLocAdapterProxyBase == NULL ||
+ !mLocAdapterProxyBase->reportPosition(location,
+ status,
+ loc_technology_mask)) {
DEFAULT_IMPL()
}
}
void LocAdapterBase::
- reportSvEvent(const GnssSvNotification& /*svNotify*/, bool /*fromUlp*/)
-DEFAULT_IMPL()
-
-void LocAdapterBase::
- reportSvMeasurementEvent(GnssSvMeasurementSet &/*svMeasurementSet*/)
-DEFAULT_IMPL()
-
-void LocAdapterBase::
- reportSvPolynomialEvent(GnssSvPolynomial &/*svPolynomial*/)
-DEFAULT_IMPL()
-
-void LocAdapterBase::
- reportStatus(LocGpsStatusValue /*status*/)
+ reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
DEFAULT_IMPL()
void LocAdapterBase::
- reportNmeaEvent(const char* /*nmea*/, size_t /*length*/, bool /*fromUlp*/)
+ reportStatus(GpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmea(const char* nmea, int length)
DEFAULT_IMPL()
bool LocAdapterBase::
- reportXtraServer(const char* /*url1*/, const char* /*url2*/,
- const char* /*url3*/, const int /*maxlength*/)
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
DEFAULT_IMPL(false)
bool LocAdapterBase::
@@ -129,15 +112,15 @@
DEFAULT_IMPL(false)
bool LocAdapterBase::
- requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/)
+ requestATL(int connHandle, AGpsType agps_type)
DEFAULT_IMPL(false)
bool LocAdapterBase::
- releaseATL(int /*connHandle*/)
+ releaseATL(int connHandle)
DEFAULT_IMPL(false)
bool LocAdapterBase::
- requestSuplES(int /*connHandle*/)
+ requestSuplES(int connHandle)
DEFAULT_IMPL(false)
bool LocAdapterBase::
@@ -149,16 +132,10 @@
DEFAULT_IMPL(false)
bool LocAdapterBase::
- requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
+ requestNiNotify(GpsNiNotification ¬ify, const void* data)
DEFAULT_IMPL(false)
void LocAdapterBase::
- reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurements*/,
- int /*msInWeek*/)
+ reportGpsMeasurementData(GpsData &gpsMeasurementData)
DEFAULT_IMPL()
-
-bool LocAdapterBase::
- reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
-DEFAULT_IMPL(false)
-
} // namespace loc_core
diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h
index e7beca8..f8fdc48 100644
--- a/core/LocAdapterBase.h
+++ b/core/LocAdapterBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -32,39 +32,19 @@
#include <gps_extended.h>
#include <UlpProxyBase.h>
#include <ContextBase.h>
-#include <LocationAPI.h>
-#include <map>
-
-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 std::map<LocationSessionKey, LocationOptions> LocationSessionMap;
namespace loc_core {
class LocAdapterProxyBase;
class LocAdapterBase {
-private:
- static uint32_t mSessionIdCounter;
protected:
LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
ContextBase* mContext;
LocApiBase* mLocApi;
LocAdapterProxyBase* mLocAdapterProxyBase;
const MsgTask* mMsgTask;
+
inline LocAdapterBase(const MsgTask* msgTask) :
mEvtMask(0), mContext(NULL), mLocApi(NULL),
mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
@@ -90,69 +70,48 @@
}
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
- loc_registration_mask_status status)
+ loc_registration_mask_status isEnabled)
{
- 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;
- }
+ mEvtMask =
+ isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event);
+
mLocApi->updateEvtMask();
}
- inline bool isFeatureSupported(uint8_t featureVal) {
- return mLocApi->isFeatureSupported(featureVal);
- }
-
- uint32_t generateSessionId();
-
// This will be overridden by the individual adapters
// if necessary.
- inline virtual void setUlpProxyCommand(UlpProxyBase* ulp) {
-
- (void)ulp;
- }
+ inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
virtual void handleEngineUpEvent();
virtual void handleEngineDownEvent();
- inline virtual void setPositionModeCommand(LocPosMode& posMode) {
-
- (void)posMode;
- }
- virtual void startTrackingCommand() {}
- virtual void stopTrackingCommand() {}
- virtual void getZppCommand() {}
- virtual void reportPositionEvent(const UlpLocation& location,
- const GpsLocationExtended& locationExtended,
- enum loc_sess_status status,
- LocPosTechMask loc_technology_mask,
- bool fromUlp=false);
- virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
- virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
- virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
- virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
- virtual void reportStatus(LocGpsStatusValue status);
+ inline virtual void setPositionModeInt(LocPosMode& posMode) {}
+ virtual void startFixInt() {}
+ virtual void stopFixInt() {}
+ virtual void getZppInt() {}
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
virtual bool reportXtraServer(const char* url1, const char* url2,
const char* url3, const int maxlength);
virtual bool requestXtraData();
virtual bool requestTime();
virtual bool requestLocation();
- virtual bool requestATL(int connHandle, LocAGpsType agps_type);
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
virtual bool releaseATL(int connHandle);
virtual bool requestSuplES(int connHandle);
virtual bool reportDataCallOpened();
virtual bool reportDataCallClosed();
- virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify,
+ const void* data);
inline virtual bool isInSession() { return false; }
ContextBase* getContext() const { return mContext; }
- virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
- int msInWeek);
- virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
+ virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
};
} // namespace loc_core
diff --git a/core/LocAdapterProxyBase.h b/core/LocAdapterProxyBase.h
index 044f59b..f6c22af 100644
--- a/core/LocAdapterProxyBase.h
+++ b/core/LocAdapterProxyBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, 2016-2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -46,30 +46,21 @@
inline virtual ~LocAdapterProxyBase() {
delete mLocAdapterBase;
}
+ ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
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;
+ inline virtual bool reportPosition(UlpLocation &location,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
}
};
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 4bc38e2..f56694e 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -26,14 +26,13 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-#define LOG_NDEBUG 0 //Define to enable LOGV
+#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_LocApiBase"
#include <dlfcn.h>
-#include <inttypes.h>
#include <LocApiBase.h>
#include <LocAdapterBase.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <LocDualContext.h>
namespace loc_core {
@@ -97,10 +96,10 @@
mLocApi->close();
mLocApi->open(mLocApi->getEvtMask());
}
- inline void locallog() const {
+ inline void locallog() {
LOC_LOGV("LocSsrMsg");
}
- inline virtual void log() const {
+ inline virtual void log() {
locallog();
}
};
@@ -117,11 +116,11 @@
inline virtual void proc() const {
mLocApi->open(mMask);
}
- inline void locallog() const {
+ inline void locallog() {
LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
__func__, __LINE__, mMask);
}
- inline virtual void log() const {
+ inline virtual void log() {
locallog();
}
};
@@ -129,11 +128,10 @@
LocApiBase::LocApiBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
ContextBase* context) :
- mMsgTask(msgTask), mContext(context), mSupportedMsg(0),
- mMask(0), mExcludedMask(excludedMask)
+ mExcludedMask(excludedMask), mMsgTask(msgTask),
+ mMask(0), mSupportedMsg(0), mContext(context)
{
memset(mLocAdapters, 0, sizeof(mLocAdapters));
- memset(mFeaturesSupported, 0, sizeof(mFeaturesSupported));
}
LOC_API_ADAPTER_EVENT_MASK_T LocApiBase::getEvtMask()
@@ -164,7 +162,7 @@
if (mLocAdapters[i] == NULL) {
mLocAdapters[i] = adapter;
mMsgTask->sendMsg(new LocOpenMsg(this,
- mMask | adapter->getEvtMask()));
+ (adapter->getEvtMask())));
break;
}
}
@@ -208,7 +206,7 @@
void LocApiBase::updateEvtMask()
{
- open(getEvtMask());
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
}
void LocApiBase::handleEngineUpEvent()
@@ -228,90 +226,59 @@
TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
}
-void LocApiBase::reportPosition(UlpLocation& location,
- GpsLocationExtended& locationExtended,
+void LocApiBase::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask)
{
// print the location info before delivering
- LOC_LOGD("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
+ LOC_LOGV("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 rawDataSize: %d\n rawData: %p\n "
- "Session status: %d\n Technology mask: %u\n "
- "SV used in fix (gps/glo/bds/gal/qzss) : \
- (%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 ")",
+ "timestamp: %lld\n rawDataSize: %d\n rawData: %p\n "
+ "Session status: %d\n Technology mask: %u",
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, location.rawDataSize,
- location.rawData, 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);
+ location.rawData, status, loc_technology_mask);
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
- mLocAdapters[i]->reportPositionEvent(location, locationExtended,
- status, loc_technology_mask)
+ mLocAdapters[i]->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask)
);
}
-void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
+void LocApiBase::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
{
- // loop through adapters, and deliver to the first handling adapter.
- TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
-}
-
-void LocApiBase::reportSv(GnssSvNotification& svNotify)
-{
- const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
- "QZSS", "BEIDOU", "GALILEO" };
-
// print the SV info before delivering
- LOC_LOGV("num sv: %zu\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;
- }
- LOC_LOGV(" %03zu: %*s %02d %f %f %f 0x%02X",
- 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].gnssSvOptionsMask);
+ LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n used"
+ " in fix mask: %x\n sv: prn snr elevation azimuth",
+ svStatus.num_svs, svStatus.ephemeris_mask,
+ svStatus.almanac_mask, svStatus.used_in_fix_mask);
+ for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" %d: %d %f %f %f",
+ i,
+ svStatus.sv_list[i].prn,
+ svStatus.sv_list[i].snr,
+ svStatus.sv_list[i].elevation,
+ svStatus.sv_list[i].azimuth);
}
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
- mLocAdapters[i]->reportSvEvent(svNotify)
- );
-}
-
-void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
-{
- // loop through adapters, and deliver to all adapters.
- TO_ALL_LOCADAPTERS(
- mLocAdapters[i]->reportSvMeasurementEvent(svMeasurementSet)
+ mLocAdapters[i]->reportSv(svStatus,
+ locationExtended,
+ svExt)
);
}
-void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
-{
- // loop through adapters, and deliver to all adapters.
- TO_ALL_LOCADAPTERS(
- mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
- );
-}
-
-void LocApiBase::reportStatus(LocGpsStatusValue status)
+void LocApiBase::reportStatus(GpsStatusValue status)
{
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
@@ -320,7 +287,7 @@
void LocApiBase::reportNmea(const char* nmea, int length)
{
// loop through adapters, and deliver to all adapters.
- TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmeaEvent(nmea, length));
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmea(nmea, length));
}
void LocApiBase::reportXtraServer(const char* url1, const char* url2,
@@ -349,7 +316,7 @@
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation());
}
-void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type)
+void LocApiBase::requestATL(int connHandle, AGpsType agps_type)
{
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
@@ -379,10 +346,10 @@
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
}
-void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data)
+void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
{
// loop through adapters, and deliver to the first handling adapter.
- TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
}
void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
@@ -390,26 +357,20 @@
mSupportedMsg = supportedMsgList;
}
-void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
-{
- memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
-}
-
void* LocApiBase :: getSibling()
DEFAULT_IMPL(NULL)
LocApiProxyBase* LocApiBase :: getLocApiProxy()
DEFAULT_IMPL(NULL)
-void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurements,
- int msInWeek)
+void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData)
{
// loop through adapters, and deliver to all adapters.
- TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurements, msInWeek));
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData));
}
enum loc_api_adapter_err LocApiBase::
- open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
@@ -417,35 +378,35 @@
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- startFix(const LocPosMode& /*posMode*/)
+ startFix(const LocPosMode& posMode)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
stopFix()
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-LocationError LocApiBase::
- deleteAidingData(const GnssAidingData& /*data*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
enum loc_api_adapter_err LocApiBase::
- enableData(int /*enable*/)
+ deleteAidingData(GpsAidingData f)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setAPN(char* /*apn*/, int /*len*/)
+ enableData(int enable)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
+ setAPN(char* apn, int len)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
+ injectPosition(double latitude, double longitude, float accuracy)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setXtraData(char* /*data*/, int /*length*/)
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
@@ -453,108 +414,93 @@
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/,
- AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/)
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, AGpsType agpsType)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- atlCloseStatus(int /*handle*/, int /*is_succ*/)
+ atlCloseStatus(int handle, int is_succ)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setPositionMode(const LocPosMode& /*posMode*/)
-DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-
-LocationError LocApiBase::
- setServer(const char* /*url*/, int /*len*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-LocationError LocApiBase::
- setServer(unsigned int /*ip*/, int /*port*/, LocServerType /*type*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-LocationError LocApiBase::
- informNiResponse(GnssNiResponse /*userResponse*/, const void* /*passThroughData*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-LocationError LocApiBase::
- setSUPLVersion(GnssConfigSuplVersion /*version*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-enum loc_api_adapter_err LocApiBase::
- setNMEATypes (uint32_t /*typesMask*/)
-DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-
-LocationError LocApiBase::
- setLPPConfig(GnssConfigLppProfile /*profile*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-enum loc_api_adapter_err LocApiBase::
- setSensorControlConfig(int /*sensorUsage*/,
- int /*sensorProvider*/)
+ setPositionMode(const LocPosMode& posMode)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setSensorProperties(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*/)
+ setServer(const char* url, int len)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- setSensorPerfControlConfig(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::
- setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask /*aGlonassProtocol*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-LocationError LocApiBase::
- setLPPeProtocolCp(GnssConfigLppeControlPlaneMask /*lppeCP*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-LocationError LocApiBase::
- setLPPeProtocolUp(GnssConfigLppeUserPlaneMask /*lppeUP*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
-
-enum loc_api_adapter_err LocApiBase::
- getWwanZppFix()
+ setServer(unsigned int ip, int port,
+ LocServerType type)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- getBestAvailableZppFix(LocGpsLocation& zppLoc)
-{
- memset(&zppLoc, 0, sizeof(zppLoc));
- DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-}
+ informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- getBestAvailableZppFix(LocGpsLocation & zppLoc, GpsLocationExtended & locationExtended,
- LocPosTechMask & tech_mask)
-{
- memset(&zppLoc, 0, sizeof(zppLoc));
- memset(&tech_mask, 0, sizeof(tech_mask));
- memset(&locationExtended, 0, sizeof (locationExtended));
- DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
-}
+ setSUPLVersion(uint32_t version)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setLPPConfig(uint32_t profile)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage,
+ int sensorProvider)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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)
+
+enum loc_api_adapter_err LocApiBase::
+ setExtPowerConfig(int isBatteryCharging)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
int LocApiBase::
- initDataServiceClient(bool /*isDueToSsr*/)
+ initDataServiceClient()
DEFAULT_IMPL(-1)
int LocApiBase::
@@ -569,40 +515,31 @@
closeDataCall()
DEFAULT_IMPL()
-void LocApiBase::
- releaseDataServiceClient()
-DEFAULT_IMPL()
-
-LocationError LocApiBase::
- setGpsLock(GnssConfigGpsLock /*lock*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+int LocApiBase::
+ setGpsLock(LOC_GPS_LOCK_MASK lock)
+DEFAULT_IMPL(-1)
void LocApiBase::
- installAGpsCert(const LocDerEncodedCertificate* /*pData*/,
- size_t /*length*/,
- uint32_t /*slotBitMask*/)
+ installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
DEFAULT_IMPL()
int LocApiBase::
getGpsLock()
DEFAULT_IMPL(-1)
-LocationError LocApiBase::
- setXtraVersionCheck(uint32_t /*check*/)
-DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+enum loc_api_adapter_err LocApiBase::
+ setXtraVersionCheck(enum xtra_version_check check)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+DEFAULT_IMPL(-1)
bool LocApiBase::
gnssConstellationConfig()
DEFAULT_IMPL(false)
-bool LocApiBase::
- isFeatureSupported(uint8_t featureVal)
-{
- uint8_t arrayIndex = featureVal >> 3;
- uint8_t bitPos = featureVal & 7;
-
- if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
- return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
-}
-
} // namespace loc_core
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index f66bfe1..414769b 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -32,9 +32,8 @@
#include <stddef.h>
#include <ctype.h>
#include <gps_extended.h>
-#include <LocationAPI.h>
#include <MsgTask.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
namespace loc_core {
class ContextBase;
@@ -45,7 +44,6 @@
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++) { \
@@ -83,7 +81,6 @@
ContextBase *mContext;
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
uint64_t mSupportedMsg;
- uint8_t mFeaturesSupported[MAX_FEATURE_LENGTH];
protected:
virtual enum loc_api_adapter_err
@@ -103,37 +100,37 @@
inline void sendMsg(const LocMsg* msg) const {
mMsgTask->sendMsg(msg);
}
+
void addAdapter(LocAdapterBase* adapter);
void removeAdapter(LocAdapterBase* adapter);
// upward calls
void handleEngineUpEvent();
void handleEngineDownEvent();
- void reportPosition(UlpLocation& location,
- GpsLocationExtended& locationExtended,
+ void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask =
LOC_POS_TECH_MASK_DEFAULT);
- void reportSv(GnssSvNotification& svNotify);
- void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet);
- void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
- void reportStatus(LocGpsStatusValue status);
+ void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ void reportStatus(GpsStatusValue status);
void reportNmea(const char* nmea, int length);
void reportXtraServer(const char* url1, const char* url2,
const char* url3, const int maxlength);
void requestXtraData();
void requestTime();
void requestLocation();
- void requestATL(int connHandle, LocAGpsType agps_type);
+ void requestATL(int connHandle, AGpsType agps_type);
void releaseATL(int connHandle);
void requestSuplES(int connHandle);
void reportDataCallOpened();
void reportDataCallClosed();
- void requestNiNotify(GnssNiNotification ¬ify, const void* data);
+ void requestNiNotify(GpsNiNotification ¬ify, const void* data);
void saveSupportedMsgList(uint64_t supportedMsgList);
- void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
- void saveSupportedFeatureList(uint8_t *featureList);
- void reportWwanZppFix(LocGpsLocation &zppLoc);
+ void reportGpsMeasurementData(GpsData &gpsMeasurementData);
// downward calls
// All below functions are to be defined by adapter specific modules:
@@ -145,8 +142,8 @@
startFix(const LocPosMode& posMode);
virtual enum loc_api_adapter_err
stopFix();
- virtual LocationError
- deleteAidingData(const GnssAidingData& data);
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
virtual enum loc_api_adapter_err
enableData(int enable);
virtual enum loc_api_adapter_err
@@ -154,28 +151,28 @@
virtual enum loc_api_adapter_err
injectPosition(double latitude, double longitude, float accuracy);
virtual enum loc_api_adapter_err
- setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
virtual enum loc_api_adapter_err
setXtraData(char* data, int length);
virtual enum loc_api_adapter_err
requestXtraServer();
virtual enum loc_api_adapter_err
- atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, LocAGpsType agpsType);
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
virtual enum loc_api_adapter_err
atlCloseStatus(int handle, int is_succ);
virtual enum loc_api_adapter_err
setPositionMode(const LocPosMode& posMode);
- virtual LocationError
+ virtual enum loc_api_adapter_err
setServer(const char* url, int len);
- virtual LocationError
+ virtual enum loc_api_adapter_err
setServer(unsigned int ip, int port,
LocServerType type);
- virtual LocationError
- informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
- virtual LocationError setSUPLVersion(GnssConfigSuplVersion version);
virtual enum loc_api_adapter_err
- setNMEATypes (uint32_t typesMask);
- virtual LocationError setLPPConfig(GnssConfigLppProfile profile);
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile);
virtual enum loc_api_adapter_err
setSensorControlConfig(int sensorUsage, int sensorProvider);
virtual enum loc_api_adapter_err
@@ -200,44 +197,41 @@
int gyroSamplesPerBatchHigh,
int gyroBatchesPerSecHigh,
int algorithmConfig);
- virtual LocationError
- setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
- virtual LocationError setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP);
- virtual LocationError setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP);
virtual enum loc_api_adapter_err
- getWwanZppFix();
+ setExtPowerConfig(int isBatteryCharging);
virtual enum loc_api_adapter_err
- getBestAvailableZppFix(LocGpsLocation & zppLoc);
+ setAGLONASSProtocol(unsigned long aGlonassProtocol);
virtual enum loc_api_adapter_err
- getBestAvailableZppFix(LocGpsLocation & zppLoc, GpsLocationExtended & locationExtended,
- LocPosTechMask & tech_mask);
- virtual int initDataServiceClient(bool isDueToSsr);
+ getWwanZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient();
virtual int openAndStartDataCall();
virtual void stopDataCall();
virtual void closeDataCall();
- virtual void releaseDataServiceClient();
- virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
+ virtual void installAGpsCert(const DerEncodedCertificate* pData,
size_t length,
uint32_t slotBitMask);
- inline virtual void setInSession(bool inSession) {
-
- (void)inSession;
- }
+ inline virtual void setInSession(bool inSession) {}
inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
-
- // confirm if msgID is not larger than the number of bits in
- // mSupportedMsg
- if ((uint64_t)msgID > (sizeof(mSupportedMsg) << 3)) {
+ if (msgID > (sizeof(mSupportedMsg) << 3)) {
return false;
} else {
uint32_t messageChecker = 1 << msgID;
return (messageChecker & mSupportedMsg) == messageChecker;
}
}
-
void updateEvtMask();
- virtual LocationError setGpsLock(GnssConfigGpsLock lock);
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
/*
Returns
Current value of GPS Lock on success
@@ -245,16 +239,17 @@
*/
virtual int getGpsLock(void);
- virtual LocationError setXtraVersionCheck(uint32_t check);
+ virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check);
+
+ /*
+ Update gps reporting events
+ */
+ virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
/*
Check if the modem support the service
*/
virtual bool gnssConstellationConfig();
-
- /*
- Check if a feature is supported
- */
- bool isFeatureSupported(uint8_t featureVal);
};
typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp
index fd3450d..d68cb3b 100644
--- a/core/LocDualContext.cpp
+++ b/core/LocDualContext.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -26,14 +26,14 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
-#define LOG_NDEBUG 0
+#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_DualCtx"
#include <cutils/sched_policy.h>
#include <unistd.h>
#include <LocDualContext.h>
#include <msg_q.h>
-#include <platform_lib_log_util.h>
+#include <log_util.h>
#include <loc_log.h>
namespace loc_core {
@@ -44,7 +44,8 @@
// excluded events for background clients
const LOC_API_ADAPTER_EVENT_MASK_T
LocDualContext::mBgExclMask =
- (LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ (LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
LOC_API_ADAPTER_BIT_IOCTL_REPORT |
@@ -58,36 +59,38 @@
ContextBase* LocDualContext::mInjectContext = NULL;
// the name must be shorter than 15 chars
const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
-#ifndef USE_GLIB
const char* LocDualContext::mLBSLibName = "liblbs_core.so";
-#else
-const char* LocDualContext::mLBSLibName = "liblbs_core.so.1";
-#endif
pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
-const MsgTask* LocDualContext::getMsgTask(LocThread::tCreate tCreator,
- const char* name, bool joinable)
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
+ const char* name)
{
if (NULL == mMsgTask) {
- mMsgTask = new MsgTask(tCreator, name, joinable);
+ mMsgTask = new MsgTask(tCreator, name);
}
return mMsgTask;
}
-inline
-const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) {
- return getMsgTask((LocThread::tCreate)NULL, name, joinable);
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tAssociate, name);
+ } else if (tAssociate) {
+ mMsgTask->associate(tAssociate);
+ }
+ return mMsgTask;
}
-ContextBase* LocDualContext::getLocFgContext(LocThread::tCreate tCreator,
- LocMsg* firstMsg, const char* name, bool joinable)
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name)
{
pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
if (NULL == mFgContext) {
LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
- const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
mFgContext = new LocDualContext(msgTask,
mFgExclMask);
}
@@ -97,22 +100,37 @@
injectFeatureConfig(mInjectContext);
}
pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
-
- if (firstMsg) {
- mFgContext->sendMsg(firstMsg);
- }
-
return mFgContext;
}
-ContextBase* LocDualContext::getLocBgContext(LocThread::tCreate tCreator,
- LocMsg* firstMsg, const char* name, bool joinable)
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tAssociate", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tAssociate", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name)
{
pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
if (NULL == mBgContext) {
LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
- const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
mBgContext = new LocDualContext(msgTask,
mBgExclMask);
}
@@ -122,11 +140,26 @@
injectFeatureConfig(mInjectContext);
}
pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mBgContext;
+}
- if (firstMsg) {
- mBgContext->sendMsg(firstMsg);
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tAssociate", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tAssociate", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
}
-
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
return mBgContext;
}
diff --git a/core/LocDualContext.h b/core/LocDualContext.h
index 3b3ce2c..1e96ea5 100644
--- a/core/LocDualContext.h
+++ b/core/LocDualContext.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, 2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -41,9 +41,10 @@
static ContextBase* mFgContext;
static ContextBase* mBgContext;
static ContextBase* mInjectContext;
- static const MsgTask* getMsgTask(LocThread::tCreate tCreator,
- const char* name, bool joinable = true);
- static const MsgTask* getMsgTask(const char* name, bool joinable = true);
+ static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
+ const char* name);
+ static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name);
static pthread_mutex_t mGetLocContextMutex;
protected:
@@ -57,17 +58,14 @@
static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
static const char* mLocationHalName;
- static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
- const char* name, bool joinable = true);
- inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) {
- return getLocFgContext(NULL, NULL, name, joinable);
- }
- static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
- const char* name, bool joinable = true);
- inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) {
- return getLocBgContext(NULL, NULL, name, joinable);
- }
-
+ static ContextBase* getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
static void injectFeatureConfig(ContextBase *context);
};
diff --git a/core/MsgTask.cpp b/core/MsgTask.cpp
new file mode 100644
index 0000000..5d375aa
--- /dev/null
+++ b/core/MsgTask.cpp
@@ -0,0 +1,147 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+#define MAX_TASK_COMM_LEN 15
+
+static void LocMsgDestroy(void* msg) {
+ delete (LocMsg*)msg;
+}
+
+MsgTask::MsgTask(tCreate tCreator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(NULL){
+ if (tCreator) {
+ tCreator(threadName, loopMain,
+ (void*)new MsgTask(mQ, mAssociator));
+ } else {
+ createPThread(threadName);
+ }
+}
+
+MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(tAssociator){
+ createPThread(threadName);
+}
+
+inline
+MsgTask::MsgTask(const void* q, tAssociate associator) :
+ mQ(q), mAssociator(associator){
+}
+
+MsgTask::~MsgTask() {
+ msg_q_unblock((void*)mQ);
+}
+
+void MsgTask::associate(tAssociate tAssociator) const {
+ struct LocAssociateMsg : public LocMsg {
+ tAssociate mAssociator;
+ inline LocAssociateMsg(tAssociate associator) :
+ LocMsg(), mAssociator(associator) {}
+ inline virtual void proc() const {
+ if (mAssociator) {
+ LOC_LOGD("MsgTask::associate");
+ mAssociator();
+ }
+ }
+ };
+ sendMsg(new LocAssociateMsg(tAssociator));
+}
+
+void MsgTask::createPThread(const char* threadName) {
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ pthread_t tid;
+ // create the thread here, then if successful
+ // and a name is given, we set the thread name
+ if (!pthread_create(&tid, &attr, loopMain,
+ (void*)new MsgTask(mQ, mAssociator)) &&
+ NULL != threadName) {
+ char lname[MAX_TASK_COMM_LEN+1];
+ memcpy(lname, threadName, MAX_TASK_COMM_LEN);
+ lname[MAX_TASK_COMM_LEN] = 0;
+ pthread_setname_np(tid, lname);
+ }
+}
+
+void MsgTask::sendMsg(const LocMsg* msg) const {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void* MsgTask::loopMain(void* arg) {
+ MsgTask* copy = (MsgTask*)arg;
+
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+
+ if (NULL != copy->mAssociator) {
+ copy->mAssociator();
+ }
+
+ LocMsg* msg;
+ int cnt = 0;
+
+ while (1) {
+ LOC_LOGD("MsgTask::loop() %d listening ...\n", cnt++);
+
+ msq_q_err_type result = msg_q_rcv((void*)copy->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));
+ // destroy the Q and exit
+ msg_q_destroy((void**)&(copy->mQ));
+ delete copy;
+ return NULL;
+ }
+
+ msg->log();
+ // there is where each individual msg handling is invoked
+ msg->proc();
+
+ delete msg;
+ }
+
+ delete copy;
+
+ return NULL;
+}
+
+}
diff --git a/core/MsgTask.h b/core/MsgTask.h
new file mode 100644
index 0000000..d50bb31
--- /dev/null
+++ b/core/MsgTask.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __MSG_TASK__
+#define __MSG_TASK__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <pthread.h>
+
+namespace loc_core {
+
+struct LocMsg {
+ inline LocMsg() {}
+ inline virtual ~LocMsg() {}
+ virtual void proc() const = 0;
+ inline virtual void log() const {}
+};
+
+class MsgTask {
+public:
+ typedef void* (*tStart)(void*);
+ typedef pthread_t (*tCreate)(const char* name, tStart start, void* arg);
+ typedef int (*tAssociate)();
+ MsgTask(tCreate tCreator, const char* threadName);
+ MsgTask(tAssociate tAssociator, const char* threadName);
+ ~MsgTask();
+ void sendMsg(const LocMsg* msg) const;
+ void associate(tAssociate tAssociator) const;
+
+private:
+ const void* mQ;
+ tAssociate mAssociator;
+ MsgTask(const void* q, tAssociate associator);
+ static void* loopMain(void* copy);
+ void createPThread(const char* name);
+};
+
+} // namespace loc_core
+
+#endif //__MSG_TASK__
diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h
index 8863b66..b9a8224 100644
--- a/core/UlpProxyBase.h
+++ b/core/UlpProxyBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-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
@@ -30,7 +30,6 @@
#define ULP_PROXY_BASE_H
#include <gps_extended.h>
-#include <LocationAPI.h>
namespace loc_core {
@@ -52,69 +51,31 @@
return false;
}
- inline virtual bool reportPosition(const UlpLocation &location,
- const GpsLocationExtended &locationExtended,
+ inline virtual bool reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask) {
- (void)location;
- (void)locationExtended;
- (void)status;
- (void)loc_technology_mask;
return false;
}
- inline virtual bool reportSv(const GnssSvNotification& svNotify) {
- (void)svNotify;
+ inline virtual bool reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt) {
return false;
}
- inline virtual bool reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) {
- (void)svMeasurementSet;
+ inline virtual bool reportStatus(GpsStatusValue status) {
return false;
}
-
- inline virtual bool reportSvPolynomial(GnssSvPolynomial &svPolynomial)
- {
- (void)svPolynomial;
- return false;
- }
- inline virtual bool reportStatus(LocGpsStatusValue status) {
-
- (void)status;
+ inline virtual void setAdapter(LocAdapterBase* adapter) {}
+ inline virtual void setCapabilities(unsigned long capabilities) {}
+ inline virtual bool reportBatchingSession(GpsExtBatchOptions &options,
+ bool active) {
return false;
}
- inline virtual void setAdapter(LocAdapterBase* adapter) {
-
- (void)adapter;
- }
- inline virtual void setCapabilities(unsigned long capabilities) {
-
- (void)capabilities;
- }
- inline virtual bool reportBatchingSession(const LocationOptions& options, bool active)
- {
- (void)options;
- (void)active;
- return false;
- }
- inline virtual bool reportPositions(const UlpLocation* ulpLocations,
- const GpsLocationExtended* extendedLocations,
- const uint32_t* techMasks,
- const size_t count)
- {
- (void)ulpLocations;
- (void)extendedLocations;
- (void)techMasks;
- (void)count;
- return false;
- }
- inline virtual bool reportDeleteAidingData(LocGpsAidingData aidingData)
- {
- (void)aidingData;
- return false;
- }
- inline virtual bool reportNmea(const char* nmea, int length)
- {
- (void)nmea;
- (void)length;
+ inline virtual bool reportPositions(GpsExtLocation * locations,
+ int32_t number_of_locations,
+ enum loc_sess_status status,
+ LocPosTechMask techMask) {
return false;
}
};
diff --git a/core/gps_extended.h b/core/gps_extended.h
new file mode 100644
index 0000000..88b0415
--- /dev/null
+++ b/core/gps_extended.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gps_extended_c.h>
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ GpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ char credentials[14];
+ char provider[8];
+ LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ const char* cred, const char* prov) :
+ mode(m), recurrence(recr),
+ min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
+ preferred_accuracy(accu), preferred_time(time) {
+ 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(GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(MIN_POSSIBLE_FIX_INTERVAL),
+ preferred_accuracy(50), preferred_time(120000) {
+ 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 &&
+ !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/core/gps_extended_c.h b/core/gps_extended_c.h
new file mode 100644
index 0000000..63fb6cf
--- /dev/null
+++ b/core/gps_extended_c.h
@@ -0,0 +1,427 @@
+/* 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 GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <hardware/gps.h>
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** GpsLocation has valid "is indoor?" flag */
+#define GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** GpsLocation has valid floor number */
+#define GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** GpsLocation has valid map URL*/
+#define GPS_LOCATION_HAS_MAP_URL 0x0100
+/** GpsLocation has valid map index */
+#define GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+/** 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 source is ZPP only */
+#define ULP_LOCATION_IS_FROM_ZPP 0x0004
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+/** Positioin is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+#define ULP_LOCATION_IS_FROM_NLP 0x0020
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+
+/*Emergency SUPL*/
+#define GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+#define AGPS_CERTIFICATE_MAX_LENGTH 2000
+#define AGPS_CERTIFICATE_MAX_SLOTS 10
+
+/** Batching default ID for dummy batching session*/
+#define GPS_BATCHING_DEFAULT_ID 1
+
+/** This cap is used to decide the FLP session cache
+size on AP. If the BATCH_SIZE in flp.conf is less than
+GPS_AP_BATCHING_SIZE_CAP, FLP session cache size will
+be twice the BATCH_SIZE defined in flp.conf. Otherwise,
+FLP session cache size will be equal to the BATCH_SIZE.*/
+#define GPS_AP_BATCHING_SIZE_CAP 40
+
+#define GPS_BATCHING_OPERATION_SUCCEESS 1
+#define GPS_BATCHING_OPERATION_FAILURE 0
+
+/** GPS extended batching flags*/
+#define GPS_EXT_BATCHING_ON_FULL 0x0000001
+#define GPS_EXT_BATCHING_ON_FIX 0x0000002
+
+/** Reasons of GPS reports batched locations*/
+typedef enum loc_batching_reported_type {
+ LOC_BATCHING_ON_FULL_IND_REPORT,
+ LOC_BATCHING_ON_FIX_IND_REPORT,
+ LOC_BATCHING_ON_QUERY_REPORT
+}LocBatchingReportedType;
+
+enum loc_registration_mask_status {
+ LOC_REGISTRATION_MASK_ENABLED,
+ LOC_REGISTRATION_MASK_DISABLED
+};
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ GpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+/** AGPS type */
+typedef int16_t AGpsExtType;
+#define AGPS_TYPE_INVALID -1
+#define AGPS_TYPE_ANY 0
+#define AGPS_TYPE_SUPL 1
+#define AGPS_TYPE_C2K 2
+#define AGPS_TYPE_WWAN_ANY 3
+#define AGPS_TYPE_WIFI 4
+#define AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(GpsCallbacks) */
+ size_t size;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ gps_request_utc_time request_utc_time_cb;
+} GpsExtCallbacks;
+
+/** GPS extended batch options */
+typedef struct {
+ double max_power_allocation_mW;
+ uint32_t sources_to_use;
+ uint32_t flags;
+ int64_t period_ns;
+} GpsExtBatchOptions;
+
+/** 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 {
+ gps_xtra_download_request download_request_cb;
+ 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) */
+ size_t size;
+
+ AGpsExtType type;
+ AGpsStatusValue 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;
+ gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ gps_ni_notify_callback notify_cb;
+ gps_create_thread create_thread_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
+} 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;
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+
+/** GpsLocationExtended has valid latitude and longitude. */
+#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0)
+/** GpsLocationExtended has valid altitude. */
+#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE (1U<<1)
+/** GpsLocationExtended has valid speed. */
+#define GPS_LOCATION_EXTENDED_HAS_SPEED (1U<<2)
+/** GpsLocationExtended has valid bearing. */
+#define GPS_LOCATION_EXTENDED_HAS_BEARING (1U<<4)
+/** GpsLocationExtended has valid accuracy. */
+#define GPS_LOCATION_EXTENDED_HAS_ACCURACY (1U<<8)
+
+/** GPS extended supports geofencing */
+#define GPS_EXTENDED_CAPABILITY_GEOFENCE 0x0000001
+/** GPS extended supports batching */
+#define GPS_EXTENDED_CAPABILITY_BATCHING 0x0000002
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint16_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
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+} GpsLocationExtended;
+
+typedef struct GpsExtLocation_s {
+ size_t size;
+ uint16_t flags;
+ double latitude;
+ double longitude;
+ double altitude;
+ float speed;
+ float bearing;
+ float accuracy;
+ int64_t timestamp;
+ uint32_t sources_used;
+} GpsExtLocation;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+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)
+
+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_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_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_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)
+
+typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
+
+typedef enum loc_api_adapter_msg_to_check_supported {
+ LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching
+ LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach
+
+ LOC_API_ADAPTER_MESSAGE_MAX
+} LocCheckingMessagesID;
+
+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)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
+
diff --git a/core/loc_core_log.cpp b/core/loc_core_log.cpp
index 5a627dd..1b22010 100644
--- a/core/loc_core_log.cpp
+++ b/core/loc_core_log.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* 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
@@ -27,12 +27,12 @@
*
*/
-#define LOG_NDEBUG 0
+#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_core_log"
#include <loc_log.h>
+#include <log_util.h>
#include <loc_core_log.h>
-#include <platform_lib_includes.h>
void LocPosMode::logv() const
{
@@ -49,18 +49,18 @@
}
/* GPS status names */
-static const loc_name_val_s_type gps_status_name[] =
+static loc_name_val_s_type 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 ),
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
};
-static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+static int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
/* Find Android GPS status name */
-const char* loc_get_gps_status_name(LocGpsStatusValue gps_status)
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
{
return loc_get_name_from_val(gps_status_name, gps_status_num,
(long) gps_status);
@@ -68,7 +68,7 @@
-static const loc_name_val_s_type loc_eng_position_modes[] =
+static loc_name_val_s_type loc_eng_position_modes[] =
{
NAME_VAL( LOC_POSITION_MODE_STANDALONE ),
NAME_VAL( LOC_POSITION_MODE_MS_BASED ),
@@ -79,165 +79,182 @@
NAME_VAL( LOC_POSITION_MODE_RESERVED_4 ),
NAME_VAL( LOC_POSITION_MODE_RESERVED_5 )
};
-static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+static int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
-const char* loc_get_position_mode_name(LocGpsPositionMode mode)
+const char* loc_get_position_mode_name(GpsPositionMode mode)
{
return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
}
-static const loc_name_val_s_type loc_eng_position_recurrences[] =
+static loc_name_val_s_type loc_eng_position_recurrences[] =
{
- NAME_VAL( LOC_GPS_POSITION_RECURRENCE_PERIODIC ),
- NAME_VAL( LOC_GPS_POSITION_RECURRENCE_SINGLE )
+ NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
};
-static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+static int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
-const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
{
return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
}
-static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
+static loc_name_val_s_type loc_eng_aiding_data_bits[] =
{
- NAME_VAL( LOC_GPS_DELETE_EPHEMERIS ),
- NAME_VAL( LOC_GPS_DELETE_ALMANAC ),
- NAME_VAL( LOC_GPS_DELETE_POSITION ),
- NAME_VAL( LOC_GPS_DELETE_TIME ),
- NAME_VAL( LOC_GPS_DELETE_IONO ),
- NAME_VAL( LOC_GPS_DELETE_UTC ),
- NAME_VAL( LOC_GPS_DELETE_HEALTH ),
- NAME_VAL( LOC_GPS_DELETE_SVDIR ),
- NAME_VAL( LOC_GPS_DELETE_SVSTEER ),
- NAME_VAL( LOC_GPS_DELETE_SADATA ),
- NAME_VAL( LOC_GPS_DELETE_RTI ),
- NAME_VAL( LOC_GPS_DELETE_CELLDB_INFO ),
- NAME_VAL( LOC_GPS_DELETE_ALL)
+ NAME_VAL( GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( GPS_DELETE_ALMANAC ),
+ NAME_VAL( GPS_DELETE_POSITION ),
+ NAME_VAL( GPS_DELETE_TIME ),
+ NAME_VAL( GPS_DELETE_IONO ),
+ NAME_VAL( GPS_DELETE_UTC ),
+ NAME_VAL( GPS_DELETE_HEALTH ),
+ NAME_VAL( GPS_DELETE_SVDIR ),
+ NAME_VAL( GPS_DELETE_SVSTEER ),
+ NAME_VAL( GPS_DELETE_SADATA ),
+ NAME_VAL( GPS_DELETE_RTI ),
+ NAME_VAL( GPS_DELETE_CELLDB_INFO ),
+#ifndef PDK_FEATURE_SET
+ NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
+ NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
+ NAME_VAL( GLO_DELETE_EPHEMERIS ),
+ NAME_VAL( GLO_DELETE_ALMANAC ),
+ NAME_VAL( GLO_DELETE_SVDIR ),
+ NAME_VAL( GLO_DELETE_SVSTEER ),
+ NAME_VAL( GLO_DELETE_ALMANAC_CORR ),
+ NAME_VAL( GPS_DELETE_TIME_GPS ),
+ NAME_VAL( GLO_DELETE_TIME ),
+ NAME_VAL( BDS_DELETE_SVDIR ),
+ NAME_VAL( BDS_DELETE_SVSTEER ),
+ NAME_VAL( BDS_DELETE_TIME ),
+ NAME_VAL( BDS_DELETE_ALMANAC_CORR ),
+ NAME_VAL( BDS_DELETE_EPHEMERIS ),
+ NAME_VAL( BDS_DELETE_ALMANAC ),
+#endif
+ NAME_VAL( GPS_DELETE_ALL)
};
-static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
-const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
+const char* loc_get_aiding_data_mask_names(GpsAidingData data)
{
return NULL;
}
-static const loc_name_val_s_type loc_eng_agps_types[] =
+static loc_name_val_s_type 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 )
+ NAME_VAL( AGPS_TYPE_INVALID ),
+ NAME_VAL( AGPS_TYPE_ANY ),
+ NAME_VAL( AGPS_TYPE_SUPL ),
+ NAME_VAL( AGPS_TYPE_C2K ),
+ NAME_VAL( AGPS_TYPE_WWAN_ANY )
};
-static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
-const char* loc_get_agps_type_name(LocAGpsType type)
+const char* loc_get_agps_type_name(AGpsType type)
{
return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
}
-static const loc_name_val_s_type loc_eng_ni_types[] =
+static loc_name_val_s_type 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 )
+ NAME_VAL( GPS_NI_TYPE_VOICE ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ),
+ NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL )
};
-static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
-const char* loc_get_ni_type_name(LocGpsNiType type)
+const char* loc_get_ni_type_name(GpsNiType type)
{
return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
}
-static const loc_name_val_s_type loc_eng_ni_responses[] =
+static loc_name_val_s_type 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 )
+ NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY )
};
-static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+static int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
-const char* loc_get_ni_response_name(LocGpsUserResponseType response)
+const char* loc_get_ni_response_name(GpsUserResponseType response)
{
return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
}
-static const loc_name_val_s_type loc_eng_ni_encodings[] =
+static loc_name_val_s_type 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 )
+ NAME_VAL( GPS_ENC_NONE ),
+ NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( GPS_ENC_UNKNOWN )
};
-static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+static int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
-const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding)
+const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
{
return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
}
-static const loc_name_val_s_type loc_eng_agps_bears[] =
+static loc_name_val_s_type 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 )
};
-static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+static int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
const char* loc_get_agps_bear_name(AGpsBearerType bearer)
{
return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
}
-static const loc_name_val_s_type loc_eng_server_types[] =
+static loc_name_val_s_type 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 )
};
-static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+static int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
const char* loc_get_server_type_name(LocServerType type)
{
return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
}
-static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
+static loc_name_val_s_type loc_eng_position_sess_status_types[] =
{
NAME_VAL( LOC_SESS_SUCCESS ),
NAME_VAL( LOC_SESS_INTERMEDIATE ),
NAME_VAL( LOC_SESS_FAILURE )
};
-static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+static int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
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, loc_eng_position_sess_status_num, (long) status);
}
-static const loc_name_val_s_type loc_eng_agps_status_names[] =
+static loc_name_val_s_type 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 )
+ NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
};
-static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+static int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
-const char* loc_get_agps_status_name(LocAGpsStatusValue status)
+const char* loc_get_agps_status_name(AGpsStatusValue status)
{
return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
}
diff --git a/core/loc_core_log.h b/core/loc_core_log.h
index 2beb687..8a1825a 100644
--- a/core/loc_core_log.h
+++ b/core/loc_core_log.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, 2016-2017 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -30,26 +30,26 @@
#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);
+#include <ctype.h>
+#include <gps_extended.h>
+
+const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+const char* loc_get_position_mode_name(GpsPositionMode mode);
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(GpsAidingData data);
+const char* loc_get_agps_type_name(AGpsType type);
+const char* loc_get_ni_type_name(GpsNiType type);
+const char* loc_get_ni_response_name(GpsUserResponseType response);
+const char* loc_get_ni_encoding_name(GpsNiEncodingType 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);
+const char* loc_get_agps_status_name(AGpsStatusValue status);
#ifdef __cplusplus
}
diff --git a/etc/Android.mk b/etc/Android.mk
index d9eb0e1..fef8963 100644
--- a/etc/Android.mk
+++ b/etc/Android.mk
@@ -1,12 +1,12 @@
-
+ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := gps.conf
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/
LOCAL_SRC_FILES := gps.conf
include $(BUILD_PREBUILT)
-
+endif
diff --git a/etc/gps.conf b/etc/gps.conf
index d30461e..3bec29a 100644
--- a/etc/gps.conf
+++ b/etc/gps.conf
@@ -16,8 +16,14 @@
# _CLEAR = 0
ERR_ESTIMATE=0
-#NTP server
-NTP_SERVER=time.izatcloud.net
+#Test
+NTP_SERVER=time.gpsonextra.net
+#Asia
+# NTP_SERVER=asia.pool.ntp.org
+#Europe
+# NTP_SERVER=europe.pool.ntp.org
+#North America
+# NTP_SERVER=north-america.pool.ntp.org
#XTRA CA path
XTRA_CA_PATH=/system/etc/security/cacerts
@@ -25,7 +31,7 @@
# 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
+DEBUG_LEVEL = 2
# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0
@@ -41,15 +47,15 @@
SUPL_VER=0x10000
# Emergency SUPL, 1=enable, 0=disable
-#SUPL_ES=0
+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
+USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1
#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
+#If it is uncommented here, this value will over write the value from
#config.xml.
#MSA=0X2
#MSB=0X1
@@ -95,7 +101,7 @@
# 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
+LPP_PROFILE = 0
################################
# EXTRA SETTINGS
@@ -112,110 +118,3 @@
# 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
-# 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
-
-#####################################
-# 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
diff --git a/loc-api.pc.in b/loc-api.pc.in
new file mode 100644
index 0000000..3b4f81b
--- /dev/null
+++ b/loc-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-api
+Description: Qualcomm GPS Location API
+Version: @VERSION@
+Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_eng_so -lgps_default_so -lloc_api
+Cflags: -I${includedir}/loc-api/libloc_api_50001 -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api
diff --git a/loc_api/Android.mk b/loc_api/Android.mk
new file mode 100644
index 0000000..743b386
--- /dev/null
+++ b/loc_api/Android.mk
@@ -0,0 +1,17 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+
+LOCAL_PATH := $(call my-dir)
+
+# add RPC dirs if RPC is available
+ifneq ($(TARGET_NO_RPC),true)
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
+
+endif #TARGET_NO_RPC
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
+
+#call the subfolders
+include $(addsuffix Android.mk, $(GPS_DIR_LIST))
+
+endif#BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/loc_api/NOTICE b/loc_api/NOTICE
new file mode 100644
index 0000000..85b5740
--- /dev/null
+++ b/loc_api/NOTICE
@@ -0,0 +1,13 @@
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
diff --git a/loc_api/libloc_api-rpc-50001/Android.mk b/loc_api/libloc_api-rpc-50001/Android.mk
new file mode 100644
index 0000000..6c5d533
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+include $(call all-subdir-makefiles)
+endif
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
new file mode 100644
index 0000000..bb3d924
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
@@ -0,0 +1,60 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+RPC_INC:=rpc_inc
+
+source_files:= \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpc.cpp
+
+LOCAL_SRC_FILES:= $(source_files)
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-DDEBUG -DUSE_QCOM_AUTO_RPC -DUSE_QCOM_AUTO_RPC
+LOCAL_CFLAGS+=$(GPS_FEATURES)
+
+# for loc_api_fixup.c
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= \
+ librpc \
+ libutils \
+ libcutils \
+ libcommondefs \
+ libgps.utils \
+ libloc_core
+
+LOCAL_STATIC_LIBRARIES := \
+ libloc_api_rpcgen
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/rpc_inc \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/loc_api/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/librpc \
+ $(TARGET_OUT_HEADERS)/libloc-rpc/rpc_inc \
+ $(TOP)/hardware/msm7k/librpc
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc-qc/$(RPC_INC)
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_rpc_glue.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_api_sync_call.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ $(RPC_INC)/LocApiRpc.h
+
+LOCAL_MODULE:= libloc_api-rpc-qc
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
new file mode 100644
index 0000000..f5c5136
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
@@ -0,0 +1,46 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I../../../platform_lib_abstractions \
+ -I./rpc_inc \
+ -I../libloc_api-rpc-stub/inc \
+ -I../../libloc_api_50001 \
+ $(MSM7K_CFLAGS) \
+ -DUSE_QCOM_AUTO_RPC
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ rpc_inc/loc_api_rpc_glue.h \
+ rpc_inc/loc_api_fixup.h \
+ rpc_inc/loc_api_sync_call.h \
+ rpc_inc/loc_apicb_appinit.h \
+
+c_sources = \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpcAdapter.cpp \
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpc_qc_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpc_qc_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpc_qc_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpc_qc_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpc_qc_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpc_qc_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpc_qc.la
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
new file mode 100644
index 0000000..01d67f4
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
@@ -0,0 +1,140 @@
+/* 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 LOC_API_RPC_H
+#define LOC_API_RPC_H
+
+#include <rpc/rpc.h>
+#include <loc_api_rpcgen_common_rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <LocApiBase.h>
+#include <loc_log.h>
+
+using namespace loc_core;
+
+class LocApiRpc : public LocApiBase {
+protected:
+ // RPC communication establishment
+ rpc_loc_client_handle_type client_handle;
+
+private:
+ int dataEnableLastSet;
+ char apnLastSet[MAX_APN_LEN];
+
+ static const LOC_API_ADAPTER_EVENT_MASK_T maskAll;
+ static const rpc_loc_event_mask_type locBits[];
+ static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ static rpc_loc_lock_e_type convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask);
+ static enum loc_api_adapter_err convertErr(int rpcErr);
+ static GpsNiEncodingType convertNiEncodingType(int loc_encoding);
+ static int NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv);
+
+ void reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr);
+ void reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+ void reportStatus(const rpc_loc_status_event_s_type *status_report_ptr);
+ void reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+ void ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr);
+ void NIEvent(const rpc_loc_ni_event_s_type *ni_req_ptr);
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+public:
+ LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ ~LocApiRpc();
+
+ virtual int locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+
+ void locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event);
+
+ // RPC adapter interface implementations
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& mode);
+ inline virtual enum loc_api_adapter_err
+ enableData(int enable) { return enableData(enable, false); }
+ virtual enum loc_api_adapter_err
+ enableData(int enable, boolean force);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ inline virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len) { return setAPN(apn, len, false); }
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len, boolean force);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(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 enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual void setInSession(bool inSession);
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+};
+
+extern "C" LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+#endif //LOC_API_RPC_H
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
new file mode 100644
index 0000000..49a6d0b
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
@@ -0,0 +1,69 @@
+/* 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "LocSvc_rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ ALOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ ALOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ ALOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
new file mode 100644
index 0000000..c483b4a
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
@@ -0,0 +1,226 @@
+/* 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 LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RPC failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+// Special return value for modem restart incurred RPC failure
+#define RPC_LOC_API_RPC_MODEM_RESTART (-1235)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE 0x00000200
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* EFS data access */
+#define RPC_LOC_EFS_MAX_PATH_LEN_BYTES 64 /* Max file name length in bytes that can be written*/
+#define RPC_LOC_EFS_MAX_FILE_LEN_BYTES 2000 /* Max file size in bytes that can be written */
+
+/* WIPER valid information flag in log report */
+#define RPC_LOC_WIPER_LOG_TIME_VALID 0x01
+#define RPC_LOC_WIPER_LOG_POS_VALID 0x02
+#define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04
+
+/* General WIPER defines */
+#define RPC_LOC_WIPER_MAC_ADDR_LENGTH 6 // Do not change this number since it affects RPC and log packet sizes
+#define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes
+
+/* WIPER AP Qualifier */
+#define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1 /* AP is being used by WPS */
+#define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */
+#define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4 /* AP has encryption turned on */
+#define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8 /* AP is in infrastructure mode and not in ad-hoc/unknown mode */
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+/* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */
+/* values for apn_profiles[0].srv_system_type */
+#define LOC_APN_PROFILE_SRV_SYS_CDMA 0x01
+#define LOC_APN_PROFILE_SRV_SYS_HDR 0x02
+#define LOC_APN_PROFILE_SRV_SYS_GSM 0x04
+#define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08
+#define LOC_APN_PROFILE_SRV_SYS_LTE 0x10
+#define LOC_APN_PROFILE_SRV_SYS_MAX 0x1F
+/* values for apn_profiles[0].pdp_type */
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4 0x01
+#define LOC_APN_PROFILE_PDN_TYPE_IPV6 0x02
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4V6 0x03
+#define LOC_APN_PROFILE_PDN_TYPE_PPP 0x04
+#define LOC_APN_PROFILE_PDN_TYPE_MAX 0x04
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
new file mode 100644
index 0000000..f037428
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
@@ -0,0 +1,59 @@
+/* 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 LOC_API_LOG_H
+#define LOC_API_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_api_rpcgen_common_rpc.h"
+
+extern int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open);
+extern const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask);
+extern const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type);
+extern const char* loc_get_ioctl_status_name(uint32 status);
+extern const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status);
+extern const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state);
+extern const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state);
+extern const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_LOG_H */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..6df33ae
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
@@ -0,0 +1,123 @@
+/* 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 LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+#include "loc_api_fixup.h"
+#include "loc_api_sync_call.h"
+#include <rpc/clnt.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ void* userData,
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+typedef void (loc_reset_notif_cb_f_type)(
+ void* userData,
+ CLIENT* clnt,
+ enum rpc_reset_event event
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_global_cb,
+ void* userData
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern void loc_clear
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+extern int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
new file mode 100644
index 0000000..43208bd
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
@@ -0,0 +1,90 @@
+/* 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 LOC_API_CB_SYNC_H
+#define LOC_API_CB_SYNC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include "loc_api_rpc_glue.h"
+#define LOC_SYNC_CALL_SLOTS_MAX 8
+
+typedef struct {
+ pthread_mutex_t lock;
+
+ /* Client ID */
+ rpc_loc_client_handle_type loc_handle;
+
+ /* Callback waiting conditional variable */
+ pthread_cond_t loc_cb_arrived_cond;
+
+ /* Callback waiting data block, protected by loc_cb_data_mutex */
+ boolean in_use;
+ boolean signal_sent;
+ boolean not_available;
+ rpc_loc_event_mask_type loc_cb_wait_event_mask; /* event to wait for */
+ rpc_loc_ioctl_e_type ioctl_type; /* ioctl to wait for */
+ rpc_loc_event_payload_u_type loc_cb_received_payload; /* received payload */
+ rpc_loc_event_mask_type loc_cb_received_event_mask; /* received event */
+} loc_sync_call_slot_s_type;
+
+typedef struct {
+ int num_of_slots;
+ loc_sync_call_slot_s_type slots[LOC_SYNC_CALL_SLOTS_MAX];
+} loc_sync_call_slot_array_s_type;
+
+/* Init function */
+void loc_api_sync_call_init();
+
+/* Destroy function */
+void loc_api_sync_call_destroy();
+
+/* Process Loc API callbacks to wake up blocked user threads */
+void loc_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+/* Reentrant synchronous IOCTL call, using Loc API return code */
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..ba41d08
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
@@ -0,0 +1,45 @@
+/* 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 LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
new file mode 100644
index 0000000..87d6b7c
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
@@ -0,0 +1,1461 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc"
+
+#include <unistd.h>
+#include <math.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#endif /* USE_GLIB */
+#include <LocApiRpc.h>
+#include <LocAdapterBase.h>
+#include <loc_api_fixup.h>
+#include <loc_api_rpc_glue.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_api_log.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include <librpc.h>
+#include <platform_lib_includes.h>
+
+using namespace loc_core;
+
+#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
+#define XTRA_BLOCK_SIZE (3072)
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+/*===========================================================================
+FUNCTION loc_event_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int32 loc_event_cb
+(
+ void* user,
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event));
+ loc_callback_log(loc_event, loc_event_payload);
+ int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_rpc_global_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open for RPC global events
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event));
+ ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event);
+ EXIT_LOG(%p, VOID_RET);
+}
+
+const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll =
+ LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+const rpc_loc_event_mask_type LocApiRpc::locBits[] =
+{
+ RPC_LOC_EVENT_PARSED_POSITION_REPORT,
+ RPC_LOC_EVENT_SATELLITE_REPORT,
+ RPC_LOC_EVENT_NMEA_1HZ_REPORT,
+ RPC_LOC_EVENT_NMEA_POSITION_REPORT,
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST,
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST,
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST,
+ RPC_LOC_EVENT_IOCTL_REPORT,
+ RPC_LOC_EVENT_STATUS_REPORT,
+ RPC_LOC_EVENT_WPS_NEEDED_REQUEST
+};
+
+// constructor
+LocApiRpc::LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) :
+ LocApiBase(msgTask, exMask, context),
+ client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
+ dataEnableLastSet(-1)
+{
+ memset(apnLastSet, 0, sizeof(apnLastSet));
+ loc_api_glue_init();
+}
+
+LocApiRpc::~LocApiRpc()
+{
+ close();
+}
+
+rpc_loc_event_mask_type
+LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ rpc_loc_event_mask_type newMask = 0;
+
+ for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) {
+ if (mask & bit) {
+ newMask |= locBits[i];
+ mask ^= bit;
+ }
+ }
+
+ return newMask;
+}
+
+rpc_loc_lock_e_type
+LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask)
+{
+ if (isGpsLockAll(lockMask))
+ return RPC_LOC_LOCK_ALL;
+ if (isGpsLockMO(lockMask))
+ return RPC_LOC_LOCK_MI;
+ if (isGpsLockMT(lockMask))
+ return RPC_LOC_LOCK_MT;
+ if (isGpsLockNone(lockMask))
+ return RPC_LOC_LOCK_NONE;
+ return (rpc_loc_lock_e_type)lockMask;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::convertErr(int rpcErr)
+{
+ switch(rpcErr)
+ {
+ case RPC_LOC_API_SUCCESS:
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+ case RPC_LOC_API_GENERAL_FAILURE:
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ case RPC_LOC_API_UNSUPPORTED:
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ case RPC_LOC_API_INVALID_HANDLE:
+ return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ case RPC_LOC_API_INVALID_PARAMETER:
+ return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
+ case RPC_LOC_API_ENGINE_BUSY:
+ return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
+ case RPC_LOC_API_PHONE_OFFLINE:
+ return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
+ case RPC_LOC_API_TIMEOUT:
+ return LOC_API_ADAPTER_ERR_TIMEOUT;
+ case RPC_LOC_API_RPC_MODEM_RESTART:
+ return LOC_API_ADAPTER_ERR_ENGINE_DOWN;
+ case RPC_LOC_API_RPC_FAILURE:
+ return LOC_API_ADAPTER_ERR_FAILURE;
+ default:
+ return LOC_API_ADAPTER_ERR_UNKNOWN;
+ }
+}
+
+void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event)
+{
+ static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX;
+
+ switch (event) {
+ case RPC_SUBSYSTEM_RESTART_BEGIN:
+ if (RPC_LOC_ENGINE_STATE_OFF != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_OFF;
+ handleEngineDownEvent();
+ }
+ break;
+ case RPC_SUBSYSTEM_RESTART_END:
+ if (RPC_LOC_ENGINE_STATE_ON != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_ON;
+ handleEngineUpEvent();
+ }
+ break;
+ }
+}
+
+int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ // Parsed report
+ if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
+ {
+ reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ parsed_location_report);
+ }
+
+ // Satellite report
+ if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
+ {
+ reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report);
+ }
+
+ // Status report
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report);
+ }
+
+ // NMEA
+ if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
+ {
+ reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
+ }
+ // XTRA support: supports only XTRA download
+ if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST)
+ {
+ if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
+ {
+ requestXtraData();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_TIME_REQ)
+ {
+ requestTime();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ)
+ {
+ requestLocation();
+ }
+ }
+
+ // AGPS data request
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ loc_server_request);
+ }
+
+ // NI notify request
+ if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request);
+ }
+
+ return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to
+ // cause any issues in RPC thread context
+}
+
+enum loc_api_adapter_err
+LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ // RPC does not dynamically update the event mask. And in the
+ // case of RPC, all we support are positioning (gps + agps)
+ // masks anyways, so we simply mask all of them on always.
+ // After doing so the first time in a power cycle, we know there
+ // will the following if condition will never be true any more.
+ mask = maskAll;
+
+ if (mask != mMask) {
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ close();
+ }
+
+ mMask = mask;
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and bckground.
+ client_handle = loc_open(convertMask(mask),
+ loc_event_cb,
+ loc_rpc_global_cb, this);
+
+ if (client_handle < 0) {
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+ ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ }
+ }
+
+ return ret_val;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::close()
+{
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ loc_clear(client_handle);
+ }
+
+ loc_close(client_handle);
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::startFix(const LocPosMode& posMode) {
+ LOC_LOGD("LocApiRpc::startFix() called");
+ return convertErr(
+ loc_start_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::stopFix() {
+ LOC_LOGD("LocApiRpc::stopFix() called");
+ return convertErr(
+ loc_stop_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setPositionMode(const LocPosMode& posMode)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ rpc_loc_operation_mode_e_type op_mode;
+ int ret_val;
+ const LocPosMode* fixCriteria = &posMode;
+
+ ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode);
+
+ switch (fixCriteria->mode)
+ {
+ case LOC_POSITION_MODE_MS_BASED:
+ op_mode = RPC_LOC_OPER_MODE_MSB;
+ break;
+ case LOC_POSITION_MODE_MS_ASSISTED:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ break;
+ case LOC_POSITION_MODE_RESERVED_1:
+ op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_2:
+ op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_3:
+ op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_4:
+ case LOC_POSITION_MODE_RESERVED_5:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ fix_criteria_ptr->preferred_response_time = 0;
+ break;
+ default:
+ op_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ }
+
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->preferred_operation_mode = op_mode;
+
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+
+ if (fixCriteria->preferred_accuracy > 0) {
+ fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+ }
+ if (fixCriteria->preferred_time > 0) {
+ fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
+ }
+
+ switch (fixCriteria->recurrence) {
+ case GPS_POSITION_RECURRENCE_SINGLE:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
+ break;
+ case GPS_POSITION_RECURRENCE_PERIODIC:
+ default:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
+ break;
+ }
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_time_s_type *time_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+ int ret_val;
+
+ LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+
+ time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time;
+ time_info_ptr->time_utc = time;
+ time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::injectPosition(double latitude, double longitude, float accuracy)
+{
+ /* IOCTL data */
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_pos_s_type *assistance_data_position =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position;
+ int ret_val;
+
+ /************************************************
+ * Fill in latitude, longitude & accuracy
+ ************************************************/
+
+ /* This combo is required */
+ assistance_data_position->valid_mask =
+ RPC_LOC_ASSIST_POS_VALID_LATITUDE |
+ RPC_LOC_ASSIST_POS_VALID_LONGITUDE |
+ RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR |
+ RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL;
+
+ assistance_data_position->latitude = latitude;
+ assistance_data_position->longitude = longitude;
+ assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */
+ assistance_data_position->confidence_horizontal = 63; /* 63% (1 std dev) assumed */
+
+ /* Log */
+ LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n",
+ (double) assistance_data_position->latitude,
+ (double) assistance_data_position->longitude,
+ (double) assistance_data_position->hor_unc_circular);
+
+ ret_val = loc_eng_ioctl( client_handle,
+ RPC_LOC_IOCTL_INJECT_POSITION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+{
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+
+ memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back,
+ passThroughData, sizeof (rpc_loc_ni_event_s_type));
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ default:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ }
+
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setAPN(char* apn, int len, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ int size = sizeof(apnLastSet);
+ if (force || memcmp(apnLastSet, apn, size)) {
+ if (len < size) {
+ // size will be not larger than its original value
+ size = len + 1;
+ }
+ memcpy(apnLastSet, apn, size);
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
+ memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
+
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+void LocApiRpc::setInSession(bool inSession)
+{
+ if (!inSession) {
+ enableData(dataEnableLastSet, true);
+ setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(const char* url, int len)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
+#if (AMSS_VERSION==3200)
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len;
+#else
+ strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url,
+ sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", url);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(unsigned int ip, int port, LocServerType type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ switch (type) {
+ case LOC_AGPS_MPC_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR;
+ break;
+ case LOC_AGPS_CUSTOM_PDE_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR;
+ break;
+ default:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
+ break;
+ }
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
+ LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::enableData(int enable, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ if (force || dataEnableLastSet != enable) {
+ dataEnableLastSet = enable;
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
+
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::deleteAidingData(GpsAidingData bits)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits;
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
+{
+ LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
+
+ UlpLocation location = {0};
+ GpsLocationExtended locationExtended = {0};
+
+ location.size = sizeof(location);
+ locationExtended.size = sizeof(locationExtended);
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
+ {
+ // Process the position from final and intermediate reports
+ if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS ||
+ location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS)
+ {
+ // Latitude & Longitude
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) &&
+ (location_report_ptr->latitude != 0 ||
+ location_report_ptr->longitude != 0))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = location_report_ptr->latitude;
+ location.gpsLocation.longitude = location_report_ptr->longitude;
+
+ // Time stamp (UTC)
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.gpsLocation.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ // Altitude
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ // Speed
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal +
+ location_report_ptr->speed_vertical * location_report_ptr->speed_vertical);
+ }
+
+ // Heading
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = location_report_ptr->heading;
+ }
+
+ // Uncertainty (circular)
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ // Technology Mask
+
+ tech_Mask |= location_report_ptr->technology_mask;
+ //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->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
+ locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
+ locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = location_report_ptr->vert_unc;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = location_report_ptr->speed_unc;
+ }
+
+ LOC_LOGV("reportPosition: fire callback\n");
+ enum loc_sess_status fixStatus =
+ (location_report_ptr->session_status
+ == RPC_LOC_SESS_STATUS_IN_PROGESS ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS);
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ (void*)location_report_ptr,
+ fixStatus,
+ tech_Mask);
+ }
+ }
+ else
+ {
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_FAILURE);
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status = %d\n",
+ location_report_ptr->session_status);
+ }
+ }
+ else
+ {
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status is not set\n");
+ }
+}
+
+void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
+{
+ GpsSvStatus SvStatus = {0};
+ GpsLocationExtended locationExtended = {0};
+ locationExtended.size = sizeof(locationExtended);
+ int num_svs_max = 0;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ num_svs_max = gnss_report_ptr->sv_count;
+ if (num_svs_max > GPS_MAX_SVS)
+ {
+ num_svs_max = GPS_MAX_SVS;
+ }
+ }
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ SvStatus.num_svs = 0;
+
+ for (int i = 0; i < num_svs_max; i++)
+ {
+ sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
+ {
+ if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+ }
+ // SBAS: GPS RPN: 120-151,
+ // In exteneded measurement report, we follow nmea standard, which is from 33-64.
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
+ }
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
+ }
+ // Unsupported SV system
+ else
+ {
+ continue;
+ }
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ }
+
+ SvStatus.num_svs++;
+ }
+ }
+
+ if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
+ locationExtended.pdop = gnss_report_ptr->position_dop;
+ locationExtended.hdop = gnss_report_ptr->horizontal_dop;
+ locationExtended.vdop = gnss_report_ptr->vertical_dop;
+ }
+
+ if (SvStatus.num_svs >= 0)
+ {
+ LocApiBase::reportSv(SvStatus,
+ locationExtended,
+ (void*)gnss_report_ptr);
+ }
+}
+
+void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
+{
+
+ if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
+ if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON);
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN);
+ }
+ else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_END);
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF);
+ }
+ else
+ {
+ LocApiBase::reportStatus(GPS_STATUS_NONE);
+ }
+ }
+
+}
+
+void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+{
+
+#if (AMSS_VERSION==3200)
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#else
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences,
+ nmea_report_ptr->length);
+ LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n",
+ nmea_report_ptr->nmea_sentences[3],
+ nmea_report_ptr->nmea_sentences[4],
+ nmea_report_ptr->nmea_sentences[5]);
+#endif /* #if (AMSS_VERSION==3200) */
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setXtraData(char* data, int length)
+{
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ int total_parts;
+ uint8 part;
+ uint16 part_len;
+ uint16 len_injected;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
+ rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data);
+
+ predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data;
+ predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA;
+ predicted_orbits_data_ptr->total_size = length;
+ total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1;
+ predicted_orbits_data_ptr->total_parts = total_parts;
+
+ len_injected = 0; // O bytes injected
+ ioctl_data.disc = ioctl_type;
+
+ // XTRA injection starts with part 1
+ for (part = 1; part <= total_parts; part++)
+ {
+ predicted_orbits_data_ptr->part = part;
+ predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE;
+ if (XTRA_BLOCK_SIZE > (length - len_injected))
+ {
+ predicted_orbits_data_ptr->part_len = length - len_injected;
+ }
+ predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
+ predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n",
+ predicted_orbits_data_ptr->part,
+ total_parts,
+ predicted_orbits_data_ptr->part_len,
+ len_injected);
+
+ if (part < total_parts)
+ {
+ // No callback in this case
+ rpc_ret_val = loc_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data);
+
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
+ break;
+ }
+ //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor
+ usleep(10 * 1000);
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ if (!loc_eng_ioctl(client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
+ NULL))
+ {
+ rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ }
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
+ }
+
+ return convertErr(rpc_ret_val);
+}
+
+/* Request the Xtra Server Url from the modem */
+enum loc_api_adapter_err
+LocApiRpc::requestXtraServer()
+{
+ loc_api_adapter_err err;
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ err = convertErr(loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_data));
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS != err)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err);
+ return err;
+ }
+ else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+
+ reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[0],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[1],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[2],
+ 255);
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+{
+ rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+
+ if (AGPS_TYPE_INVALID == agpsType) {
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr->conn_handle = handle;
+ conn_open_status_ptr->open_status = open_status;
+#if (AMSS_VERSION==3200)
+ conn_open_status_ptr->apn_name = apn; /* requires APN */
+#else
+ if (is_succ) {
+ strlcpy(conn_open_status_ptr->apn_name, apn,
+ sizeof conn_open_status_ptr->apn_name);
+ } else {
+ conn_open_status_ptr->apn_name[0] = 0;
+ }
+#endif /* #if (AMSS_VERSION==3200) */
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n",
+ log_succ_fail_string(is_succ),
+ apn);
+ } else {
+ rpc_loc_server_multi_open_status_s_type *conn_multi_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS;
+ conn_multi_open_status_ptr->conn_handle = handle;
+ conn_multi_open_status_ptr->open_status = open_status;
+ if (is_succ) {
+ strlcpy(conn_multi_open_status_ptr->apn_name, apn,
+ sizeof conn_multi_open_status_ptr->apn_name);
+ } else {
+ conn_multi_open_status_ptr->apn_name[0] = 0;
+ }
+
+ switch(bearer)
+ {
+ case AGPS_APN_BEARER_IPV4:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
+ break;
+ case AGPS_APN_BEARER_IPV6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6;
+ break;
+ case AGPS_APN_BEARER_IPV4V6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6;
+ break;
+ default:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
+ }
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
+ log_succ_fail_string(is_succ),
+ apn,
+ conn_multi_open_status_ptr->pdp_type);
+ }
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlCloseStatus(int handle, int is_succ)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
+ conn_close_status_ptr->conn_handle = handle;
+ conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr)
+{
+ int connHandle;
+ AGpsType agps_type;
+
+ LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)",
+ loc_get_event_atl_open_name(server_request_ptr->event));
+ switch (server_request_ptr->event)
+ {
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle;
+ if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type
+ == RPC_LOC_SERVER_CONNECTION_LBS) {
+ agps_type = AGPS_TYPE_SUPL;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle);
+ } else {
+ agps_type = AGPS_TYPE_WWAN_ANY;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle);
+ }
+ requestATL(connHandle, agps_type);
+ break;
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle);
+ requestATL(connHandle, AGPS_TYPE_INVALID);
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle);
+ releaseATL(connHandle);
+ break;
+ default:
+ LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event);
+ }
+}
+
+void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req)
+{
+ GpsNiNotification notif = {0};
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ LOC_LOGI("VX Notification");
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ // Requestor ID
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ vx_req->requester_id.requester_id,
+ vx_req->requester_id.requester_id_length);
+ notif.text_encoding = 0; // No text and no encoding
+ notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme);
+ NIEventFillVerfiyType(notif, vx_req->notification_priv_type);
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ LOC_LOGI("UMTS CP Notification\n");
+ notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE; // Stores notification text
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text.notification_text_val,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+ umts_cp_req->requestor_id.string_len);
+#else
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string,
+ umts_cp_req->requestor_id.string_len);
+#endif
+ notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type);
+
+ // LCS address (using extras field)
+ if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0)
+ {
+ // 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;
+
+#if (AMSS_VERSION==3200)
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
+#else
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address;
+#endif /* #if (AMSS_VERSION==3200) */
+
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source,
+ umts_cp_req->ext_client_address_data.ext_client_address_len);
+
+ // The address is ASCII string
+ if (addr_len)
+ {
+ strlcat(notif.extras, lcs_addr, sizeof notif.extras);
+ }
+ }
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ LOC_LOGI("SUPL Notification\n");
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#else
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#else
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: requestor_id not present.");
+ }
+
+ // Encoding type
+ if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
+ {
+ notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ }
+ else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+ }
+ break;
+
+ default:
+ LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ return;
+ }
+
+ // this copy will get freed in loc_eng_ni when loc_ni_respond() is called
+ rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy));
+ memcpy(copy, ni_req, sizeof(*copy));
+ requestNiNotify(notif, (const void*)copy);
+}
+
+int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv)
+{
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif.notify_flags = 0;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_ACCEPT;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_DENY;
+ return 1;
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setSUPLVersion(uint32_t version)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version;
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
+{
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ return GPS_ENC_SUPL_UTF8;
+ case RPC_LOC_NI_SUPL_UCS2:
+ return GPS_ENC_SUPL_UCS2;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ return GPS_ENC_SUPL_GSM_DEFAULT;
+ case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
+ return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ default:
+ return GPS_ENC_UNKNOWN;
+ }
+}
+
+LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context) {
+ return new LocApiRpc(msgTask, exMask, context);
+}
+
+/*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+*/
+int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+ LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask);
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask);
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val);
+ return (ret_val == TRUE ? 0 : -1);
+}
+
+/*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+*/
+int LocApiRpc :: getGpsLock()
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+ boolean ret_val;
+ int ret=0;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload);
+ if(ret_val == TRUE) {
+ ret = (int)callback_payload.data.engine_lock;
+ LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__);
+ ret = -1;
+ }
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return ret;
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
new file mode 100644
index 0000000..837ef11
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
new file mode 100644
index 0000000..1c48232
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
@@ -0,0 +1,345 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc_glue"
+
+#include "loc_api_log.h"
+#include "loc_log.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "rpc/rpc.h"
+#include "loc_api_fixup.h"
+
+/* Event names */
+loc_name_val_s_type loc_event_name[] =
+ {
+ NAME_VAL( RPC_LOC_EVENT_PARSED_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_SATELLITE_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_1HZ_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_LOCATION_SERVER_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_IOCTL_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_STATUS_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ),
+ };
+int loc_event_num = sizeof loc_event_name / sizeof(loc_name_val_s_type);
+
+/* Event names */
+loc_name_val_s_type loc_event_atl_open_name[] =
+ {
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_OPEN ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_CLOSE ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_MULTI_OPEN )
+ };
+int loc_event_atl_open_num = sizeof loc_event_atl_open_name / sizeof(loc_name_val_s_type);
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open)
+{
+ return loc_get_name_from_val(loc_event_atl_open_name, loc_event_atl_open_num,
+ (long) loc_event_atl_open);
+}
+
+/* IOCTL Type names */
+loc_name_val_s_type loc_ioctl_type_name[] =
+ {
+ NAME_VAL( RPC_LOC_IOCTL_GET_API_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_UTC_TIME ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_RTC_VALUE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_POSITION ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_ENGINE_STATE ),
+ NAME_VAL( RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_DATA_ENABLE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_DELETE_ASSIST_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR ),
+ };
+int loc_ioctl_type_num = sizeof loc_ioctl_type_name / sizeof(loc_name_val_s_type);
+
+/* IOCTL Status names */
+loc_name_val_s_type loc_ioctl_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_API_SUCCESS ),
+ NAME_VAL( RPC_LOC_API_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_API_UNSUPPORTED ),
+ NAME_VAL( RPC_LOC_API_INVALID_HANDLE ),
+ NAME_VAL( RPC_LOC_API_INVALID_PARAMETER ),
+ NAME_VAL( RPC_LOC_API_ENGINE_BUSY ),
+ NAME_VAL( RPC_LOC_API_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_API_TIMEOUT ),
+ NAME_VAL( RPC_LOC_API_RPC_FAILURE ),
+ NAME_VAL( RPC_LOC_API_RPC_MODEM_RESTART )
+ };
+int loc_ioctl_status_num = sizeof loc_ioctl_status_name / sizeof(loc_name_val_s_type);
+
+/* Fix session status names */
+loc_name_val_s_type loc_sess_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_SESS_STATUS_SUCCESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_IN_PROGESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_TIMEOUT ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_BAD_PARAMETER ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_ENGINE_LOCKED )
+ };
+int loc_sess_status_num = sizeof loc_sess_status_name / sizeof(loc_name_val_s_type);
+
+/* Engine state names */
+loc_name_val_s_type loc_engine_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_ENGINE_STATE_ON ),
+ NAME_VAL( RPC_LOC_ENGINE_STATE_OFF )
+ };
+int loc_engine_state_num = sizeof loc_engine_state_name / sizeof(loc_name_val_s_type);
+
+/* Fix session state names */
+loc_name_val_s_type loc_fix_session_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_BEGIN ),
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_END )
+ };
+int loc_fix_session_state_num = sizeof loc_fix_session_state_name / sizeof(loc_name_val_s_type);
+
+
+static const char* log_final_interm_string(int is_final)
+{
+ return is_final ? "final" : "intermediate";
+}
+
+/* Logs parsed report */
+static void log_parsed_report(const rpc_loc_parsed_position_s_type *parsed_report)
+{
+ rpc_loc_session_status_e_type status = parsed_report->session_status;
+ LOC_LOGD("Session status: %s Valid mask: 0x%X\n",
+ loc_get_sess_status_name(status),
+ (uint) parsed_report->valid_mask);
+ LOC_LOGD("Latitude: %.7f (%s)\n", parsed_report->latitude,
+ log_final_interm_string(
+ (parsed_report->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ parsed_report->session_status == RPC_LOC_SESS_STATUS_SUCCESS));
+ LOC_LOGD("Longitude: %.7f\n", parsed_report->longitude);
+ LOC_LOGD("Accuracy: %.7f\n", parsed_report->hor_unc_circular);
+}
+
+/* Logs status report */
+static void log_status_report(const rpc_loc_status_event_s_type *status_event)
+{
+ rpc_loc_status_event_e_type event = status_event->event;
+ switch (event) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ LOC_LOGD("Engine state: %s\n",
+ loc_get_engine_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.engine_state));
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ LOC_LOGD("Fix session state: %s\n",
+ loc_get_fix_session_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state));
+ break;
+ default:
+ break;
+ }
+}
+
+/* Logs valid fields in the GNSS SV constellation report */
+static void log_satellite_report(const rpc_loc_gnss_info_s_type *gnss)
+{
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP)
+ {
+ LOC_LOGV("position dop: %.3f\n", (float) gnss->position_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP)
+ {
+ LOC_LOGV("horizontal dop: %.3f\n", (float) gnss->horizontal_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP)
+ {
+ LOC_LOGV("vertical dop: %.3f\n", (float) gnss->vertical_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED)
+ {
+ LOC_LOGV("altitude assumed: %d\n", (int) gnss->altitude_assumed);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ LOC_LOGD("sv count: %d\n", (int) gnss->sv_count);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ LOC_LOGV("sv list: ");
+
+ if (gnss->sv_count)
+ {
+ LOC_LOGV("\n\tsys\tprn\thlth\tproc\teph\talm\telev\tazi\tsnr\n");
+ }
+ else {
+ LOC_LOGV("empty\n");
+ }
+
+ int i;
+ for (i = 0; i < gnss->sv_count; i++)
+ {
+ const rpc_loc_sv_info_s_type *sv = &gnss->sv_list.sv_list_val[i];
+ rpc_loc_sv_info_valid_mask_type mask = sv->valid_mask;
+ LOC_LOGV(" %d: \t%d\t%d\t%d\t%d\t%d\t%d\t%.3f\t%.3f\t%.3f\n", i,
+ CHECK_MASK(int, sv->system, mask, RPC_LOC_SV_INFO_VALID_SYSTEM),
+ CHECK_MASK(int, sv->prn, mask, RPC_LOC_SV_INFO_VALID_PRN),
+ CHECK_MASK(int, sv->health_status, mask, RPC_LOC_SV_INFO_VALID_HEALTH_STATUS),
+ CHECK_MASK(int, sv->process_status, mask, RPC_LOC_SV_INFO_VALID_PROCESS_STATUS),
+ CHECK_MASK(int, sv->has_eph, mask, RPC_LOC_SV_INFO_VALID_HAS_EPH),
+ CHECK_MASK(int, sv->has_alm, mask, RPC_LOC_SV_INFO_VALID_HAS_ALM),
+ CHECK_MASK(float, sv->elevation, mask, RPC_LOC_SV_INFO_VALID_ELEVATION),
+ CHECK_MASK(float, sv->azimuth, mask, RPC_LOC_SV_INFO_VALID_AZIMUTH),
+ CHECK_MASK(float, sv->snr, mask, RPC_LOC_SV_INFO_VALID_SNR)
+ );
+ }
+ }
+}
+
+/* Logs a callback event */
+int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ switch (loc_event)
+ {
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ log_satellite_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.gnss_report);
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ log_status_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.status_report);
+ break;
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ log_parsed_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.parsed_location_report);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask)
+{
+ return loc_get_name_from_mask(loc_event_name, loc_event_num,
+ (long) loc_event_mask);
+}
+
+/* Finds IOCTL type name */
+const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type)
+{
+ return loc_get_name_from_val(loc_ioctl_type_name, loc_ioctl_type_num,
+ (long) ioctl_type);
+}
+
+/* Finds IOCTL status name */
+const char* loc_get_ioctl_status_name(uint32 status)
+{
+ return loc_get_name_from_val(loc_ioctl_status_name, loc_ioctl_status_num,
+ (long) status);
+}
+
+/* Finds session status name */
+const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status)
+{
+ return loc_get_name_from_val(loc_sess_status_name, loc_sess_status_num,
+ (long) status);
+}
+
+/* Find engine state name */
+const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state)
+{
+ return loc_get_name_from_val(loc_engine_state_name, loc_engine_state_num,
+ (long) state);
+}
+
+/* Find engine state name */
+const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state)
+{
+ return loc_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num,
+ (long) state);
+}
+
+/* Event names */
+loc_name_val_s_type rpc_reset_event_name[] =
+{
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_BEGIN ),
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_END )
+};
+int rpc_reset_event_num = sizeof rpc_reset_event_name / sizeof(loc_name_val_s_type);
+
+const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event)
+{
+ return loc_get_name_from_val(rpc_reset_event_name, rpc_reset_event_num, event);
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
new file mode 100644
index 0000000..e0f400c
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
@@ -0,0 +1,636 @@
+/* Copyright (c) 2011-2012, 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 FILES FOR MODULE
+
+======================================================================*/
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <loc_api_log.h>
+
+#include <rpc/rpc.h>
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "rpc_inc/loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+#define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/* Logging Improvement */
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/* Uncomment to force ALOGD messages */
+// #define ALOGD ALOGI
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_MAX_CLIENTS 16
+typedef struct
+{
+ uint32 cb_id; /* same as rpc/types.h */
+ loc_event_cb_f_type *cb_func; /* callback func */
+ loc_reset_notif_cb_f_type *rpc_cb; /* callback from RPC */
+ rpc_loc_client_handle_type handle; /* stores handle for client closing */
+ void* user; /* user's own data handle */
+} loc_glue_cb_entry_s_type;
+
+loc_glue_cb_entry_s_type loc_glue_callback_table[LOC_API_CB_MAX_CLIENTS];
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) a ## v ## b
+#define RPC_CALLBACK_FUNC_VERSION(a,v,b) RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { EXIT_LOG_CALLFLOW(%d, RPC_LOC_API_RPC_FAILURE); return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { \
+ LOC_LOGE("%s:%d] failure code %d", __func__, __LINE__, stat); \
+ return (ret_type)((stat == RPC_SUBSYSTEM_RESTART) ? \
+ RPC_LOC_API_RPC_MODEM_RESTART : RPC_LOC_API_RPC_FAILURE); \
+ }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ // The lower word of cd_id is the index
+ int index = argp->cb_id & 0xFFFF;
+
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (index >= LOC_API_CB_MAX_CLIENTS || loc_glue_callback_table[index].cb_func == NULL)
+ {
+ LOC_LOGE("Warning: No callback handler %d.\n", index);
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOC_LOGV("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOC_LOGV("Callback received: %x (cb_id=%p handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ argp->cb_id,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ /* Gives control to synchronous call handler */
+ loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload);
+
+ int32 rc = (loc_glue_callback_table[index].cb_func)(loc_glue_callback_table[index].user,
+ loc_handle, loc_event, loc_event_payload);
+
+ LOC_LOGV("cb_func=%p", loc_glue_callback_table[index].cb_func);
+
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOC_LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+/*===========================================================================
+
+FUNCTION rpc_loc_event_cb_f_type_<version>_svc (MACRO)
+
+DESCRIPTION
+ Callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_event_cb_f_type_, RPC_LOC_EVENT_CB_F_TYPE_VERSION, _svc) (
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ return rpc_loc_event_cb_f_type_svc(argp, ret, req);
+}
+
+/*===========================================================================
+
+FUNCTION loc_apicbprog_<version>_freeresult (MACRO)
+
+DESCRIPTION
+ Free up RPC data structure
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+#define VERSION_CONCAT(MAJOR,MINOR) MAJOR##MINOR
+#define loc_apicb_prog_VER_freeresult(M,N) \
+int RPC_CALLBACK_FUNC_VERSION(loc_apicbprog_, VERSION_CONCAT(M,N), _freeresult) \
+(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) \
+{ \
+ return loc_apicbprog_freeresult(transp, xdr_result, result); \
+}
+
+/* Define all of the possible minors */
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0001);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0002);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0003);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0004);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0005);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+/*===========================================================================
+
+FUNCTION rpc_loc_api_cb_null_<version>_svc (MACRO) [Patch for wrong RPCGEN stubs]
+
+DESCRIPTION
+ Null callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+
+===========================================================================*/
+#define rpc_loc_api_cb_null_VER_svc(M,N) \
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_api_cb_null_, VERSION_CONCAT(M,N), _svc) ( \
+ void *a, int *b, struct svc_req *req) \
+{ \
+ return 1; \
+}
+
+/* Define all of the possible minors */
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0001);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0002);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0003);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0004);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0005);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+static void loc_api_glue_rpc_cb(CLIENT* client, enum rpc_reset_event event)
+{
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) {
+ if (NULL != loc_glue_callback_table[i].rpc_cb) {
+ loc_glue_callback_table[i].rpc_cb(loc_glue_callback_table[i].user, client, event);
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Initialize data */
+ int i;
+ int pid = getpid();
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ loc_glue_callback_table[i].cb_id = i | (pid << 16);
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].user = NULL;
+ }
+
+ /* Print msg */
+ LOC_LOGV("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOC_LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ LOC_LOGE("Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ loc_api_sync_call_init();
+
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOC_LOGD("Loc API RPC client initialized.\n");
+ clnt_register_reset_notification_cb(loc_api_clnt, loc_api_glue_rpc_cb);
+ }
+ else {
+ LOC_LOGE("Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_cb,
+ void* userData
+)
+{
+ int try_num = RPC_TRY_NUM;
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_client_handle_type ret_val;
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+
+ int i, j = LOC_API_CB_MAX_CLIENTS;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].user == userData)
+ {
+ LOC_LOGW("Client already opened service (callback=%p)...\n",
+ event_callback);
+ break;
+ } else if (j == LOC_API_CB_MAX_CLIENTS &&
+ loc_glue_callback_table[i].user == NULL) {
+ j = i;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ i = j;
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGE("Too many clients opened at once...\n");
+ return RPC_LOC_CLIENT_HANDLE_INVALID;
+ }
+
+ loc_glue_callback_table[i].cb_func = event_callback;
+ loc_glue_callback_table[i].rpc_cb = rpc_cb;
+ loc_glue_callback_table[i].user = userData;
+
+ args.event_callback = loc_glue_callback_table[i].cb_id;
+ LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client open");
+
+ /*try more for rpc_loc_open_xx()*/
+
+ do
+ {
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
+ ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
+ try_num--;
+
+ }while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num );
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ /* save the handle in the table */
+ loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
+
+ return ret_val;
+
+}
+
+int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client close");
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt);
+
+ loc_clear(handle);
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ ret_val = (int32) rets.loc_close_result;
+
+ return ret_val;
+}
+
+void loc_clear(rpc_loc_client_handle_type handle) {
+ /* Clean the client's callback function in callback table */
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].handle == handle)
+ {
+ /* Found the client */
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].user = NULL;
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGW("Handle not found (handle=%d)...\n", (int) handle);
+ }
+}
+
+int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc start fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_start_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc stop fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_stop_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ break;
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ break;
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ break;
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ break;
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, loc_get_ioctl_type_name(ioctl_type));
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_ioctl_result;
+
+ return ret_val;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ clnt_unregister_reset_notification_cb(loc_api_clnt);
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl
+
+DESCRIPTION
+ This function calls loc_ioctl and waits for the callback result before
+ returning back to the user.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS;
+
+ ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr);
+
+ LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, returt %s\n",
+ (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type),
+ loc_get_ioctl_status_name(ret_val) );
+
+ return ret_val;
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
new file mode 100644
index 0000000..ae629d7
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
@@ -0,0 +1,565 @@
+/* Copyright (c) 2011-2012, 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 <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include "loc_api_sync_call.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_slot_array_s_type loc_sync_data;
+
+pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
+boolean loc_sync_call_inited = 0;
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_init
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_init()
+{
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 1) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 1;
+
+ loc_sync_data.num_of_slots = LOC_SYNC_CALL_SLOTS_MAX;
+
+ int i;
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->not_available = 0;
+ slot->in_use = 0;
+ slot->loc_handle = -1;
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_destroy
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_destroy()
+{
+ int i;
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 0) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 0;
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->not_available = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ pthread_cond_destroy(&slot->loc_cb_arrived_cond);
+ pthread_mutex_destroy(&slot->lock);
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_match_callback
+
+DESCRIPTION
+ Checks if an awaited event has arrived
+
+RETURN VALUE
+ TRUE arrived
+ FALSE not matching
+
+===========================================================================*/
+static boolean loc_match_callback(
+ rpc_loc_event_mask_type wait_mask,
+ rpc_loc_ioctl_e_type wait_ioctl,
+ rpc_loc_event_mask_type event_mask,
+ const rpc_loc_event_payload_u_type *callback_payload
+)
+{
+ if ((event_mask & wait_mask) == 0) return FALSE;
+
+ if (event_mask != RPC_LOC_EVENT_IOCTL_REPORT || wait_ioctl == 0 ||
+ ( (callback_payload != NULL) &&
+ callback_payload->rpc_loc_event_payload_u_type_u.ioctl_report.type == wait_ioctl) )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_callback_process_sync_call
+
+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_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ int i;
+
+ ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->in_use &&
+ slot->signal_sent == 0 &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload))
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+
+ slot->loc_cb_received_event_mask = loc_event;
+
+ ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ slot->signal_sent = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+ break;
+ } else {
+ /* do nothing */
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_a_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_lock_a_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+ if (pthread_mutex_trylock(&slot->lock) == EBUSY)
+ {
+ ALOGV("trylock EBUSY : %d", i);
+ continue;
+ }
+
+ if (!slot->in_use && !slot->not_available)
+ {
+ select_id = i;
+ /* Return from here and leave the mutex locked.
+ * will unlock it in loc_unlock_slot()
+ */
+ break;
+ }
+ /* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_unlock_slot
+
+DESCRIPTION
+ Unlocks a buffer slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_unlock_slot(int select_id)
+{
+ pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_slot
+
+DESCRIPTION
+ Locks a specific slot that was previously locked from loc_lock_a_slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_lock_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_set_slot_in_use
+
+DESCRIPTION
+ Sets the in_use flag of slot to true or false.
+ Should be called only after the slot is locked
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_set_slot_in_use(int select_id, boolean in_use)
+{
+ loc_sync_data.slots[select_id].in_use = in_use;
+ if (in_use == 1)
+ loc_sync_data.slots[select_id].signal_sent = 0;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_save_callback
+
+DESCRIPTION
+ Selects which callback or IOCTL event to wait for.
+
+ The event_mask specifies the event(s). If it is RPC_LOC_EVENT_IOCTL_REPORT,
+ then ioctl_type specifies the IOCTL event.
+
+ If ioctl_type is non-zero, RPC_LOC_EVENT_IOCTL_REPORT is automatically added.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : out of buffer
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_api_save_callback(
+ int select_id, /* Selected slot */
+ rpc_loc_client_handle_type loc_handle, /* Client handle */
+ rpc_loc_event_mask_type event_mask, /* Event mask to wait for */
+ rpc_loc_ioctl_e_type ioctl_type /* IOCTL type to wait for */
+)
+{
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ slot->loc_handle = loc_handle;
+
+ slot->loc_cb_wait_event_mask = event_mask;
+ slot->ioctl_type = ioctl_type;
+ if (ioctl_type) slot->loc_cb_wait_event_mask |= RPC_LOC_EVENT_IOCTL_REPORT;
+
+ return;
+}
+
+/*===========================================================================
+
+FUNCTION loc_save_user_payload
+
+DESCRIPTION
+ Saves received payload into user data structures
+
+RETURN VALUE
+ None
+
+===========================================================================*/
+static void loc_save_user_payload(
+ rpc_loc_event_payload_u_type *user_cb_payload,
+ rpc_loc_ioctl_callback_s_type *user_ioctl_buffer,
+ const rpc_loc_event_payload_u_type *received_cb_payload
+)
+{
+ if (user_cb_payload)
+ {
+ memcpy(user_cb_payload, received_cb_payload,
+ sizeof (rpc_loc_event_payload_u_type));
+ }
+ if (user_ioctl_buffer)
+ {
+ memcpy(user_ioctl_buffer,
+ &received_cb_payload->rpc_loc_event_payload_u_type_u.ioctl_report,
+ sizeof *user_ioctl_buffer);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_wait_callback
+
+DESCRIPTION
+ Waits for a selected callback. The wait expires in timeout_seconds seconds.
+
+ If the function is called before an existing wait has finished, it will
+ immediately return EBUSY.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS if successful (0)
+ RPC_LOC_API_TIMEOUT if timed out
+ RPC_LOC_API_ENGINE_BUSY if already in a wait
+ RPC_LOC_API_INVALID_PARAMETER if callback is not yet selected
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_api_wait_callback(
+ int select_id, /* ID from loc_select_callback() */
+ int timeout_seconds, /* Timeout in this number of seconds */
+ rpc_loc_event_payload_u_type *callback_payload, /* Pointer to callback payload buffer, can be NULL */
+ rpc_loc_ioctl_callback_s_type *ioctl_payload /* Pointer to IOCTL payload, can be NULL */
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc = 0; /* return code from pthread calls */
+
+ struct timespec expire_time;
+
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ clock_gettime(CLOCK_REALTIME, &expire_time);
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Waiting */
+ while (slot->signal_sent == 0 && rc != ETIMEDOUT) {
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+ }
+
+ if (rc == ETIMEDOUT)
+ {
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ ALOGE("TIMEOUT: %d", select_id);
+ }
+ else {
+ /* Obtained the first awaited callback */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_ioctl
+
+DESCRIPTION
+ Synchronous IOCTL call (reentrant version)
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Loc API error code (0 = success)
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int rc = -1;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ select_id = loc_lock_a_slot();
+
+ if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
+ {
+ ALOGE("slot not available ioctl_type = %s",
+ loc_get_ioctl_type_name(ioctl_type));
+ return rc;
+ }
+
+ loc_set_slot_in_use(select_id, 1); // set slot in use to true
+
+ // Select the callback we are waiting for
+ loc_api_save_callback(select_id, handle, 0, ioctl_type);
+
+ loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true
+
+ // we want to avoid keeping the slot locked during the loc_ioctl because the rpc
+ // framework will also lock a different mutex during this call, and typically
+ // locking two different mutexes at the same time can lead to deadlock.
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+
+ loc_lock_slot(select_id);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else {
+ ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
+ select_id, ioctl_type);
+ // Wait for the callback of loc_ioctl
+ if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
+ {
+ // Callback waiting failed
+ ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else
+ {
+ if (cb_data_ptr) memcpy(cb_data_ptr, &callback_data, sizeof *cb_data_ptr);
+ if (callback_data.status != RPC_LOC_API_SUCCESS)
+ {
+ rc = callback_data.status;
+ ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ } else {
+ ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
+ select_id, ioctl_type, rc);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+
+ loc_set_slot_in_use(select_id, 0); // set slot in use to false
+ loc_unlock_slot(select_id);
+
+ return rc;
+}
+
+
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..db5b291
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
@@ -0,0 +1,86 @@
+/* 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.
+ */
+
+#include "rpc/rpc.h"
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+#include "rpc_inc/loc_api_fixup.h"
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+ svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ svrPort = NULL;
+}
+
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
new file mode 100644
index 0000000..c0987e6
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
@@ -0,0 +1,36 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# functions
+LOC_RPCGEN_APIS_PATH := $(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+LOC_RPCGEN_APIS_PATH_FL := ../../../../../$(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+
+LOCAL_MODULE := libloc_api_rpcgen
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_SHARED_LIBRARIES := \
+ librpc \
+ libcommondefs
+
+LOCAL_SRC_FILES += \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+LOCAL_C_INCLUDES += hardware/msm7k/librpc
+LOCAL_C_INCLUDES += $(LOC_RPCGEN_APIS_PATH)/../../SHARED_LIBRARIES/libcommondefs_intermediates/inc
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc
+
+LOCAL_COPY_HEADERS_TO := loc_api/rpcgen/inc
+LOCAL_COPY_HEADERS := inc/loc_api_rpcgen_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_common_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_cb_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_apicb_appinit.h
+
+LOCAL_LDLIBS += -lpthread
+LOCAL_PRELINK_MODULE := false
+include $(BUILD_STATIC_LIBRARY)
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
new file mode 100644
index 0000000..4ac8c8a
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
@@ -0,0 +1,42 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I./inc \
+ $(MSM7K_CFLAGS)
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ inc/loc_api_rpcgen_rpc.h \
+ inc/loc_api_rpcgen_common_rpc.h \
+ inc/loc_api_rpcgen_cb_rpc.h \
+ inc/loc_apicb_appinit.h
+
+c_sources = \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-stub/inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpcgen_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpcgen_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpcgen_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpcgen_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpcgen_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpcgen_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpcgen.la
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
new file mode 100644
index 0000000..87f2c37
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_RPC_H_RPCGEN
+#define _LOC_API_CB_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00050006
+
+#define LOC_APICBPROG 0x3100008C
+#define LOC_APICBVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001();
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc();
+extern int loc_apicbprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002();
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc();
+extern int loc_apicbprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003();
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc();
+extern int loc_apicbprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004();
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc();
+extern int loc_apicbprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005();
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc();
+extern int loc_apicbprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006();
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc();
+extern int loc_apicbprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_RPC_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
new file mode 100644
index 0000000..8107de2
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
@@ -0,0 +1,1261 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_RPC_H_RPCGEN
+#define _LOC_API_COMMON_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040030
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_API_CB_NULL_VERSION 0x00050002
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00050001
+#define RPC_LOC_STOP_FIX_VERSION 0x00050001
+#define RPC_LOC_START_FIX_VERSION 0x00050001
+#define RPC_LOC_IOCTL_VERSION 0x00050001
+#define RPC_LOC_CLOSE_VERSION 0x00050001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001
+#define RPC_LOC_OPEN_VERSION 0x00050001
+#define RPC_LOC_API_NULL_VERSION 0x00050001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0005
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+typedef struct rpc_loc_server_addr_ipv6_type rpc_loc_server_addr_ipv6_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ rpc_loc_server_addr_ipv6_type ipv6;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+typedef struct rpc_loc_pos_inj_request_s_type rpc_loc_pos_inj_request_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET = 0 + 1,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216,
+};
+typedef enum rpc_loc_server_connection_e_type rpc_loc_server_connection_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+typedef struct rpc_loc_server_multi_open_req_s_type rpc_loc_server_multi_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP = 0 + 1,
+ RPC_LOC_SERVER_PDP_IPV6 = 0 + 2,
+ RPC_LOC_SERVER_PDP_IPV4V6 = 0 + 3,
+ RPC_LOC_SERVER_PDP_MAX = 268435456,
+};
+typedef enum rpc_loc_server_pdp_type_e_type rpc_loc_server_pdp_type_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_multi_open_status_s_type rpc_loc_server_multi_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456,
+};
+typedef enum rpc_loc_error_estimate_config_e_type rpc_loc_error_estimate_config_e_type;
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ char apn_name[100];
+};
+typedef struct rpc_loc_apn_profiles_type rpc_loc_apn_profiles_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_boolean data_enable;
+ rpc_uint32 supl_version;
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_uint32 supl_version;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type (XDR *, rpc_loc_server_addr_ipv6_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type (XDR *, rpc_loc_pos_inj_request_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_connection_e_type (XDR *, rpc_loc_server_connection_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (XDR *, rpc_loc_server_multi_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type (XDR *, rpc_loc_server_pdp_type_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (XDR *, rpc_loc_server_multi_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type (XDR *, rpc_loc_error_estimate_config_e_type*);
+extern bool_t xdr_rpc_loc_apn_profiles_type (XDR *, rpc_loc_apn_profiles_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_connection_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type ();
+extern bool_t xdr_rpc_loc_apn_profiles_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_RPC_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
new file mode 100644
index 0000000..6138432
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
@@ -0,0 +1,288 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_RPC_H_RPCGEN
+#define _LOC_API_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00050006
+
+#define LOC_APIPROG 0x3000008C
+#define LOC_APIVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00050001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00050001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00050001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00050001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00050001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001();
+extern bool_t rpc_loc_api_null_0x00050001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001();
+extern bool_t rpc_loc_open_0x00050001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001();
+extern bool_t rpc_loc_close_0x00050001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001();
+extern bool_t rpc_loc_start_fix_0x00050001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001();
+extern bool_t rpc_loc_stop_fix_0x00050001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001();
+extern bool_t rpc_loc_ioctl_0x00050001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001();
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc();
+extern int loc_apiprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050002();
+extern bool_t rpc_loc_api_null_0x00050002_svc();
+extern int loc_apiprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050003(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050003_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050003();
+extern bool_t rpc_loc_api_null_0x00050003_svc();
+extern int loc_apiprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050004(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050004_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050004();
+extern bool_t rpc_loc_api_null_0x00050004_svc();
+extern int loc_apiprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050005(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050005_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050005();
+extern bool_t rpc_loc_api_null_0x00050005_svc();
+extern int loc_apiprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050006(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050006_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050006();
+extern bool_t rpc_loc_api_null_0x00050006_svc();
+extern int loc_apiprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_RPC_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..875c4f0
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* 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.
+ *
+ */
+
+/* Initialization function for callbacks */
+int loc_apicb_app_init();
+
+void loc_apicb_app_deinit();
+
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
new file mode 100644
index 0000000..2ef5852
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
@@ -0,0 +1,327 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00050001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00050001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00050001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00050001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050002(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050002_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050002_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050002_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050003(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050003_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050003_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050003_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050004(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050004_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050004_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050004_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050005(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050005_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050005_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050005_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050006(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050006_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050006_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050006_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
new file mode 100644
index 0000000..ad171dc
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
new file mode 100644
index 0000000..3e39576
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
@@ -0,0 +1,155 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api_rpcgen_rpc.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00050001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00050001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00050001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00050001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050003(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050004(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050005(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050006(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
new file mode 100644
index 0000000..21be8f4
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
@@ -0,0 +1,1775 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_common_rpc.h"
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv6_type (XDR *xdrs, rpc_loc_server_addr_ipv6_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_vector (xdrs, (char *)objp->addr, 8,
+ sizeof (rpc_uint16), (xdrproc_t) xdr_rpc_uint16))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ if (!xdr_rpc_loc_server_addr_ipv6_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv6))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_inj_request_s_type (XDR *xdrs, rpc_loc_pos_inj_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->position_uncertainty))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ if (!xdr_rpc_loc_pos_inj_request_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.pos_injection))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_e_type (XDR *xdrs, rpc_loc_server_connection_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_req_s_type (XDR *xdrs, rpc_loc_server_multi_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ if (!xdr_rpc_loc_server_connection_e_type (xdrs, &objp->connection_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ if (!xdr_rpc_loc_server_multi_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.multi_open_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_pdp_type_e_type (XDR *xdrs, rpc_loc_server_pdp_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_status_s_type (XDR *xdrs, rpc_loc_server_multi_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_rpc_loc_server_pdp_type_e_type (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_error_estimate_config_e_type (XDR *xdrs, rpc_loc_error_estimate_config_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_apn_profiles_type (XDR *xdrs, rpc_loc_apn_profiles_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint32 (xdrs, &objp->srv_system_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ if (!xdr_rpc_loc_error_estimate_config_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.error_estimate_config))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.data_enable))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_multi_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.multi_conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_callback_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
new file mode 100644
index 0000000..a0fdcab
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
@@ -0,0 +1,199 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_rpc.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..b469eb0
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ */
+#include "librpc.h"
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_0x00010001 */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+
+
+
+ if(svc_register(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+void loc_apicb_app_deinit(void)
+{
+
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+
+ svc_unregister(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001);
+}
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
new file mode 100644
index 0000000..82dca56
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
@@ -0,0 +1,261 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00050006 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050002;
+
+version LOC_APIVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050003;
+
+version LOC_APIVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050004;
+
+version LOC_APIVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APIVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050006;
+
+
+} = 0x3000008C;
+
+const LOC_APIVERS = 0x00050006;
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
new file mode 100644
index 0000000..4756c6c
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
@@ -0,0 +1,187 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00050006 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APICBVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050002;
+
+version LOC_APICBVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050003;
+
+version LOC_APICBVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050004;
+
+version LOC_APICBVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APICBVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050006;
+
+
+} = 0x3100008C;
+
+const LOC_APICBVERS = 0x00050006;
diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
new file mode 100644
index 0000000..e059c66
--- /dev/null
+++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
@@ -0,0 +1,1021 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040030;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_API_CB_NULL_VERSION = 0x00050002;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00050001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00050001;
+const RPC_LOC_START_FIX_VERSION = 0x00050001;
+const RPC_LOC_IOCTL_VERSION = 0x00050001;
+const RPC_LOC_CLOSE_VERSION = 0x00050001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001;
+const RPC_LOC_OPEN_VERSION = 0x00050001;
+const RPC_LOC_API_NULL_VERSION = 0x00050001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0005;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[200];
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256];
+};
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ rpc_loc_server_addr_ipv6_type ipv6;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20];
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP,
+ RPC_LOC_SERVER_PDP_IPV6,
+ RPC_LOC_SERVER_PDP_IPV4V6,
+ RPC_LOC_SERVER_PDP_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100];
+};
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456
+};
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ rpc_boolean data_enable;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/loc_api/libloc_api-rpc/Android.mk b/loc_api/libloc_api-rpc/Android.mk
new file mode 100644
index 0000000..06e4694
--- /dev/null
+++ b/loc_api/libloc_api-rpc/Android.mk
@@ -0,0 +1,61 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+AMSS_VERSION:=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION)
+RPC_INC:=inc-$(AMSS_VERSION)
+
+generated_files:= \
+ gen-$(AMSS_VERSION)/loc_api_clnt.c \
+ gen-$(AMSS_VERSION)/loc_api_cb_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_common_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_cb_svc.c \
+ gen-$(AMSS_VERSION)/loc_api_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_fixup.c \
+ gen-$(AMSS_VERSION)/loc_api_rpc_glue.c \
+ src/loc_apicb_appinit.c
+
+LOCAL_SRC_FILES:= $(generated_files)
+
+# removed from library build since the client should implement this code.
+# src/loc_api_cb_server.c
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-include $(RPC_INC)/loc_api_common.h
+LOCAL_CFLAGS+=-DDEBUG
+# LOCAL_CFLAGS+=-DDEBUG -DVERBOSE
+
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= librpc
+LOCAL_STATIC_LIBRARIES:= libcommondefs-rpc
+
+
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc/inc
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_cb.h \
+ $(RPC_INC)/loc_api_common.h \
+ $(RPC_INC)/loc_api.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ inc/debug.h \
+ inc/loc_api_rpc_glue.h
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/inc \
+ $(LOCAL_PATH)/$(RPC_INC) \
+ $(TARGET_OUT_HEADERS)/libcommondefs-rpc \
+ $(TARGET_OUT_HEADERS)/librpc
+
+LOCAL_MODULE:= libloc_api-rpc
+LOCAL_MODULE_OWNER := qcom
+
+include $(BUILD_STATIC_LIBRARY)
+
+endif
+endif
diff --git a/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr b/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
new file mode 100644
index 0000000..5d9cf6c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
@@ -0,0 +1,29 @@
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
new file mode 100644
index 0000000..a9d60aa
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
@@ -0,0 +1,172 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00040002 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00040001;
+
+
+
+ version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_ni_event_e_type in 0x00040002
+RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00040002;
+
+
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00040002;
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
new file mode 100644
index 0000000..1bd4e15
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
@@ -0,0 +1,85 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00040002 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00040001;
+
+
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00040002;
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c
new file mode 100644
index 0000000..52a0d15
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00040001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00040001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00040001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00040001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00040001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c
new file mode 100644
index 0000000..dca1e8d
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c
@@ -0,0 +1,91 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00040001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00040001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00040001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00040001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00040002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
new file mode 100644
index 0000000..4e01607
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
@@ -0,0 +1,906 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040024;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00040001;
+const RPC_LOC_OPEN_VERSION = 0x00040001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00040001;
+const RPC_LOC_API_NULL_VERSION = 0x00040001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00040001;
+const RPC_LOC_IOCTL_VERSION = 0x00040001;
+const RPC_LOC_START_FIX_VERSION = 0x00040001;
+const RPC_LOC_CLOSE_VERSION = 0x00040001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00040001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0004;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef bool rpc_boolean;
+
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[1200]; /* EVAL:[1200]*/
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256]; /* EVAL:[256]*/
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200]; /* EVAL:[200]*/
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4]; /* EVAL:[4]*/
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200]; /* EVAL:[200]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64]; /* EVAL:[64]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8]; /* EVAL:[8]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20]; /* EVAL:[20]*/
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20]; /* EVAL:[20]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64]; /* EVAL:[64]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+ typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+ typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100]; /* EVAL:[100]*/
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6]; /* EVAL:[6]*/
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50]; /* EVAL:[50]*/
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64]; /* EVAL:[64]*/
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8]; /* EVAL:[8]*/
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c
new file mode 100644
index 0000000..7c860bf
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c
@@ -0,0 +1,1650 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 1200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
new file mode 100644
index 0000000..fe512f5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
new file mode 100644
index 0000000..fbaca8b
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00040001_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00040001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr b/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
new file mode 100644
index 0000000..5d9cf6c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
@@ -0,0 +1,29 @@
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
new file mode 100644
index 0000000..981266b
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
@@ -0,0 +1,164 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00010001 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+ } = 0x00010001;
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00010001;
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
new file mode 100644
index 0000000..3f53504
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
@@ -0,0 +1,90 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00010001 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+ } = 0x00010001;
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00010001;
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c
new file mode 100644
index 0000000..b1aa199
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00010001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00010001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00010001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00010001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00010001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c
new file mode 100644
index 0000000..79814d4
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c
@@ -0,0 +1,82 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00010001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00010001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00010001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00010001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
new file mode 100644
index 0000000..7ef6357
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
@@ -0,0 +1,803 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_OPEN_VERSION = 0x00010001;
+const RPC_LOC_CLOSE_VERSION = 0x00010001;
+const RPC_LOC_START_FIX_VERSION = 0x00010001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00010001;
+const RPC_LOC_IOCTL_VERSION = 0x00010001;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00010001;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0001;
+typedef bool rpc_boolean;
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<RPC_LOC_API_MAX_SV_COUNT>;
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences<RPC_LOC_API_MAX_NMEA_STRING_LENGTH>;
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string<RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ unsigned char maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address<RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS>;
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string<RPC_LOC_NI_CODEWORD_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ string apn_name<>;
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+const RPC_LOC_API_NULL_VERSION = 0x00010001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00010001;
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
new file mode 100644
index 0000000..7b37b9c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
@@ -0,0 +1,1441 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->apn_name, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
new file mode 100644
index 0000000..fe512f5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
new file mode 100644
index 0000000..8c17122
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00010001_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00010001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api.h b/loc_api/libloc_api-rpc/inc-1240/loc_api.h
new file mode 100644
index 0000000..e02648c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-1240/loc_api.h
@@ -0,0 +1,210 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00040002
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00040001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00040001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00040001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00040001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00040001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00040001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00040001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00040001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00040001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00040001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00040001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00040001();
+extern bool_t rpc_loc_api_null_0x00040001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00040001();
+extern bool_t rpc_loc_open_0x00040001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00040001();
+extern bool_t rpc_loc_close_0x00040001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00040001();
+extern bool_t rpc_loc_start_fix_0x00040001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00040001();
+extern bool_t rpc_loc_stop_fix_0x00040001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00040001();
+extern bool_t rpc_loc_ioctl_0x00040001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00040001();
+extern bool_t rpc_loc_api_api_versions_0x00040001_svc();
+extern int loc_apiprog_0x00040001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00040002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00040002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00040002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00040002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00040002();
+extern bool_t rpc_loc_api_null_0x00040002_svc();
+extern int loc_apiprog_0x00040002_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h
new file mode 100644
index 0000000..67ac084
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00040002
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00040001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001();
+extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc();
+extern int loc_apicbprog_0x00040001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h
new file mode 100644
index 0000000..6ff3baf
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h
@@ -0,0 +1,1154 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040024
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00040001
+#define RPC_LOC_OPEN_VERSION 0x00040001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00040001
+#define RPC_LOC_API_NULL_VERSION 0x00040001
+#define RPC_LOC_STOP_FIX_VERSION 0x00040001
+#define RPC_LOC_IOCTL_VERSION 0x00040001
+#define RPC_LOC_START_FIX_VERSION 0x00040001
+#define RPC_LOC_CLOSE_VERSION 0x00040001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00040001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0004
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[1200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
new file mode 100644
index 0000000..e62eb36
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
new file mode 100644
index 0000000..92d4e15
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api.h b/loc_api/libloc_api-rpc/inc-3200/loc_api.h
new file mode 100644
index 0000000..8998aca
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-3200/loc_api.h
@@ -0,0 +1,198 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00010001
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00010001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00010001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00010001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00010001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00010001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00010001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00010001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00010001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00010001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00010001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00010001();
+extern bool_t rpc_loc_api_null_0x00010001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00010001();
+extern bool_t rpc_loc_open_0x00010001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00010001();
+extern bool_t rpc_loc_close_0x00010001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00010001();
+extern bool_t rpc_loc_start_fix_0x00010001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00010001();
+extern bool_t rpc_loc_stop_fix_0x00010001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00010001();
+extern bool_t rpc_loc_ioctl_0x00010001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00010001();
+extern bool_t rpc_loc_api_api_versions_0x00010001_svc();
+extern int loc_apiprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h
new file mode 100644
index 0000000..4f2f8f9
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00010001
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001();
+extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc();
+extern int loc_apicbprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
new file mode 100644
index 0000000..04be079
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
@@ -0,0 +1,1031 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_OPEN_VERSION 0x00010001
+#define RPC_LOC_CLOSE_VERSION 0x00010001
+#define RPC_LOC_START_FIX_VERSION 0x00010001
+#define RPC_LOC_STOP_FIX_VERSION 0x00010001
+#define RPC_LOC_IOCTL_VERSION 0x00010001
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00010001
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+#define RPC_LOC_API_API_MAJOR_NUM 0x0001
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ struct {
+ u_int nmea_sentences_len;
+ char *nmea_sentences_val;
+ } nmea_sentences;
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ struct {
+ u_int addr_len;
+ char *addr_val;
+ } addr;
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int requestor_id_string_len;
+ char *requestor_id_string_val;
+ } requestor_id_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int client_name_string_len;
+ char *client_name_string_val;
+ } client_name_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ u_char maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ struct {
+ u_int ext_client_address_len;
+ char *ext_client_address_val;
+ } ext_client_address;
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int lcs_codeword_string_len;
+ char *lcs_codeword_string_val;
+ } lcs_codeword_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ struct {
+ u_int notification_text_len;
+ char *notification_text_val;
+ } notification_text;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char *apn_name;
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+#define RPC_LOC_API_NULL_VERSION 0x00010001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00010001
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
new file mode 100644
index 0000000..e62eb36
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
new file mode 100644
index 0000000..92d4e15
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/loc_api/libloc_api-rpc/inc/debug.h b/loc_api/libloc_api-rpc/inc/debug.h
new file mode 100644
index 0000000..a71b23a
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc/debug.h
@@ -0,0 +1,57 @@
+/*
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "libgps-rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ LOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ LOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ LOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h b/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..ef972bd
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
@@ -0,0 +1,100 @@
+/******************************************************************************
+ @file: loc_api_rpc_glue.h
+ @brief: Loc API Android glue code header
+
+ DESCRIPTION
+ Loc API Android glue code header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/17/09 dx Initial version
+
+$Id: //source/qcom/qct/modem/gps/cgps/dev/locationmiddleware/locapi/app-linux/source/test/loc_api_test/loc_api_cb_log.h#4 $
+======================================================================*/
+
+#ifndef LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#include "loc_api_common.h"
+#include "loc_api.h"
+#include "loc_api_cb.h"
+#include "loc_api_fixup.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..7fcfd6c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
@@ -0,0 +1,61 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 "rpc/rpc.h"
+#include "loc_api_common.h"
+#include "loc_api.h"
+#include "loc_api_cb.h"
+#include "loc_api_fixup.h"
+
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ svrPort = NULL;
+}
diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk
new file mode 100644
index 0000000..74d5423
--- /dev/null
+++ b/loc_api/libloc_api_50001/Android.mk
@@ -0,0 +1,104 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_eng
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_nmea.cpp \
+ LocEngAdapter.cpp
+
+LOCAL_SRC_FILES += \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_COPY_HEADERS_TO:= libloc_eng/
+LOCAL_COPY_HEADERS:= \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+## Libs
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_eng \
+ libloc_core \
+ libgps.utils \
+ libdl
+
+ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false)
+endif
+
+LOCAL_SRC_FILES += \
+ loc.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+
+ifeq ($(TARGET_USES_QCOM_BSP), true)
+LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
+endif
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp
new file mode 100644
index 0000000..c47502b
--- /dev/null
+++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -0,0 +1,422 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_EngAdapter"
+
+#include <LocEngAdapter.h>
+#include "loc_eng_msg.h"
+#include "loc_log.h"
+
+using namespace loc_core;
+
+LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
+ LocAdapterBase(adapter->getMsgTask()),
+ mLocEngAdapter(adapter)
+{
+}
+void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
+ sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
+}
+void LocInternalAdapter::startFixInt() {
+ sendMsg(new LocEngStartFix(mLocEngAdapter));
+}
+void LocInternalAdapter::stopFixInt() {
+ sendMsg(new LocEngStopFix(mLocEngAdapter));
+}
+void LocInternalAdapter::getZppInt() {
+ sendMsg(new LocEngGetZpp(mLocEngAdapter));
+}
+
+LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ MsgTask::tCreate tCreator) :
+ LocAdapterBase(mask,
+ //Get the AFW context if VzW context has not already been intialized in
+ //loc_ext
+ context == NULL?
+ LocDualContext::getLocFgContext(tCreator,
+ LocDualContext::mLocationHalName)
+ :context),
+ mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
+ mUlp(new UlpProxyBase()), mNavigating(false),
+ mSupportsAgpsRequests(false),
+ mSupportsPositionInjection(false),
+ mSupportsTimeInjection(false),
+ mPowerVote(0)
+{
+ memset(&mFixCriteria, 0, sizeof(mFixCriteria));
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ LOC_LOGD("LocEngAdapter created");
+}
+
+inline
+LocEngAdapter::~LocEngAdapter()
+{
+ delete mInternalAdapter;
+ LOC_LOGV("LocEngAdapter deleted");
+}
+
+void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
+ struct LocSetUlpProxy : public LocMsg {
+ LocAdapterBase* mAdapter;
+ UlpProxyBase* mUlp;
+ inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
+ LocMsg(), mAdapter(adapter), mUlp(ulp) {
+ }
+ virtual void proc() const {
+ LOC_LOGV("%s] ulp %p adapter %p", __func__,
+ mUlp, mAdapter);
+ mAdapter->setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
+}
+
+void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ if (ulp == mUlp) {
+ //This takes care of the case when double initalization happens
+ //and we get the same object back for UlpProxyBase . Do nothing
+ return;
+ }
+
+ LOC_LOGV("%s] %p", __func__, ulp);
+ if (NULL == ulp) {
+ LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__);
+ ulp = new UlpProxyBase();
+ }
+
+ if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) {
+ // need to send this mode and start msg to ULP
+ ulp->sendFixMode(mUlp->mPosMode);
+ }
+
+ if(mUlp->mFixSet) {
+ ulp->sendStartFix();
+ }
+
+ delete mUlp;
+ mUlp = ulp;
+}
+
+int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask)
+{
+ struct LocEngAdapterGpsLock : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LOC_GPS_LOCK_MASK mLockMask;
+ inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) :
+ LocMsg(), mAdapter(adapter), mLockMask(lockMask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setGpsLock(mLockMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+ };
+ sendMsg(new LocEngAdapterGpsLock(this, lockMask));
+ return 0;
+}
+
+void LocEngAdapter::requestPowerVote()
+{
+ if (getPowerVoteRight()) {
+ /* Power voting without engine lock:
+ * 101: vote down, 102-104 - vote up
+ * These codes are used not to confuse with actual engine lock
+ * functionality, that can't be used in SSR scenario, as it
+ * conflicts with initialization sequence.
+ */
+ bool powerUp = getPowerVote();
+ LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp);
+ setGpsLock(powerUp ? 103 : 101);
+ }
+}
+
+void LocInternalAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ sendMsg(new LocEngReportPosition(mLocEngAdapter,
+ location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask));
+}
+
+
+void LocEngAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ if (! mUlp->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask )) {
+ mInternalAdapter->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask);
+ }
+}
+
+void LocInternalAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt){
+ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
+ locationExtended, svExt));
+}
+
+void LocEngAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+
+ // We want to send SV info to ULP to help it in determining GNSS
+ // signal strength ULP will forward the SV reports to HAL without
+ // any modifications
+ if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
+ mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
+ }
+}
+
+void LocEngAdapter::setInSession(bool inSession)
+{
+ mNavigating = inSession;
+ mLocApi->setInSession(inSession);
+ if (!mNavigating) {
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ }
+}
+
+void LocInternalAdapter::reportStatus(GpsStatusValue status)
+{
+ sendMsg(new LocEngReportStatus(mLocEngAdapter, status));
+}
+
+void LocEngAdapter::reportStatus(GpsStatusValue status)
+{
+ if (!mUlp->reportStatus(status)) {
+ mInternalAdapter->reportStatus(status);
+ }
+}
+
+inline
+void LocEngAdapter::reportNmea(const char* nmea, int length)
+{
+ sendMsg(new LocEngReportNmea(mOwner, nmea, length));
+}
+
+inline
+bool LocEngAdapter::reportXtraServer(const char* url1,
+ const char* url2,
+ const char* url3,
+ const int maxlength)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReportXtraServer(mOwner, url1,
+ url2, url3, maxlength));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestATL(mOwner,
+ connHandle, agps_type));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::releaseATL(int connHandle)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReleaseATL(mOwner, connHandle));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestXtraData()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestXtra(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestTime()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestTime(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data)
+{
+ if (mSupportsAgpsRequests) {
+ notif.size = sizeof(notif);
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ sendMsg(new LocEngRequestNi(mOwner, notif, data));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestSuplES(int connHandle)
+{
+ if (mSupportsAgpsRequests)
+ sendMsg(new LocEngRequestSuplEs(mOwner, connHandle));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallOpened()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsOpened(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallClosed()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsClosed(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+void LocEngAdapter::handleEngineDownEvent()
+{
+ sendMsg(new LocEngDown(mOwner));
+}
+
+inline
+void LocEngAdapter::handleEngineUpEvent()
+{
+ sendMsg(new LocEngUp(mOwner));
+}
+
+enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty)
+{
+ loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d",
+ __func__, __LINE__, mSupportsTimeInjection);
+
+ if (mSupportsTimeInjection) {
+ LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
+ result = mLocApi->setTime(time, timeReference, uncertainty);
+ } else {
+ mSupportsTimeInjection = true;
+ }
+ return result;
+}
+
+enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
+{
+ enum loc_api_adapter_err ret;
+ ENTRY_LOG();
+ enum xtra_version_check eCheck;
+ switch (check) {
+ case 0:
+ eCheck = DISABLED;
+ break;
+ case 1:
+ eCheck = AUTO;
+ break;
+ case 2:
+ eCheck = XTRA2;
+ break;
+ case 3:
+ eCheck = XTRA3;
+ break;
+ default:
+ eCheck = DISABLED;
+ }
+ ret = mLocApi->setXtraVersionCheck(eCheck);
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+{
+ sendMsg(new LocEngReportGpsMeasurement(mOwner,
+ gpsMeasurementData));
+}
+
+/*
+ Update Registration Mask
+ */
+void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+{
+ LOC_LOGD("entering %s", __func__);
+ int result = LOC_API_ADAPTER_ERR_FAILURE;
+ result = mLocApi->updateRegistrationMask(event, isEnabled);
+ if (result == LOC_API_ADAPTER_ERR_SUCCESS) {
+ LOC_LOGD("%s] update registration mask succeed.", __func__);
+ } else {
+ LOC_LOGE("%s] update registration mask failed.", __func__);
+ }
+}
+
+/*
+ Set Gnss Constellation Config
+ */
+bool LocEngAdapter::gnssConstellationConfig()
+{
+ LOC_LOGD("entering %s", __func__);
+ bool result = false;
+ result = mLocApi->gnssConstellationConfig();
+ return result;
+}
diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h
new file mode 100644
index 0000000..6302662
--- /dev/null
+++ b/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -0,0 +1,350 @@
+/* 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 LOC_API_ENG_ADAPTER_H
+#define LOC_API_ENG_ADAPTER_H
+
+#include <ctype.h>
+#include <hardware/gps.h>
+#include <loc.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <platform_lib_includes.h>
+
+#define MAX_URL_LEN 256
+
+using namespace loc_core;
+
+class LocEngAdapter;
+
+class LocInternalAdapter : public LocAdapterBase {
+ LocEngAdapter* mLocEngAdapter;
+public:
+ LocInternalAdapter(LocEngAdapter* adapter);
+
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void setPositionModeInt(LocPosMode& posMode);
+ virtual void startFixInt();
+ virtual void stopFixInt();
+ virtual void getZppInt();
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+};
+
+typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
+
+class LocEngAdapter : public LocAdapterBase {
+ void* mOwner;
+ LocInternalAdapter* mInternalAdapter;
+ UlpProxyBase* mUlp;
+ LocPosMode mFixCriteria;
+ bool mNavigating;
+ // mPowerVote is encoded as
+ // mPowerVote & 0x20 -- powerVoteRight
+ // mPowerVote & 0x10 -- power On / Off
+ unsigned int mPowerVote;
+ static const unsigned int POWER_VOTE_RIGHT = 0x20;
+ static const unsigned int POWER_VOTE_VALUE = 0x10;
+
+public:
+ bool mSupportsAgpsRequests;
+ bool mSupportsPositionInjection;
+ bool mSupportsTimeInjection;
+
+ LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ MsgTask::tCreate tCreator);
+ virtual ~LocEngAdapter();
+
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ inline void requestUlp(unsigned long capabilities) {
+ mContext->requestUlp(mInternalAdapter, capabilities);
+ }
+ inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
+ inline UlpProxyBase* getUlpProxy() { return mUlp; }
+ inline void* getOwner() { return mOwner; }
+ inline bool hasAgpsExtendedCapabilities() {
+ return mContext->hasAgpsExtendedCapabilities();
+ }
+ inline bool hasCPIExtendedCapabilities() {
+ return mContext->hasCPIExtendedCapabilities();
+ }
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+
+ inline enum loc_api_adapter_err
+ startFix()
+ {
+ return mLocApi->startFix(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ stopFix()
+ {
+ return mLocApi->stopFix();
+ }
+ inline enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f)
+ {
+ return mLocApi->deleteAidingData(f);
+ }
+ inline enum loc_api_adapter_err
+ enableData(int enable)
+ {
+ return mLocApi->enableData(enable);
+ }
+ inline enum loc_api_adapter_err
+ setAPN(char* apn, int len)
+ {
+ return mLocApi->setAPN(apn, len);
+ }
+ inline enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy)
+ {
+ return mLocApi->injectPosition(latitude, longitude, accuracy);
+ }
+ inline enum loc_api_adapter_err
+ setXtraData(char* data, int length)
+ {
+ return mLocApi->setXtraData(data, length);
+ }
+ inline enum loc_api_adapter_err
+ requestXtraServer()
+ {
+ return mLocApi->requestXtraServer();
+ }
+ inline enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+ {
+ return mLocApi->atlOpenStatus(handle, is_succ, apn, bearer, agpsType);
+ }
+ inline enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ)
+ {
+ return mLocApi->atlCloseStatus(handle, is_succ);
+ }
+ inline enum loc_api_adapter_err
+ setPositionMode(const LocPosMode *posMode)
+ {
+ if (NULL != posMode) {
+ mFixCriteria = *posMode;
+ }
+ return mLocApi->setPositionMode(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ setServer(const char* url, int len)
+ {
+ return mLocApi->setServer(url, len);
+ }
+ inline enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+ {
+ return mLocApi->setServer(ip, port, type);
+ }
+ inline enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData)
+ {
+ return mLocApi->informNiResponse(userResponse, passThroughData);
+ }
+ inline enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version)
+ {
+ return mLocApi->setSUPLVersion(version);
+ }
+ inline enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile)
+ {
+ return mLocApi->setLPPConfig(profile);
+ }
+ inline enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider)
+ {
+ return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider);
+ }
+ inline enum loc_api_adapter_err
+ setSensorProperties(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)
+ {
+ return mLocApi->setSensorProperties(gyroBiasVarianceRandomWalk_valid, gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid, angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid, rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid, velocityBiasVarianceRandomWalk);
+ }
+ inline virtual enum loc_api_adapter_err
+ setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
+ {
+ return mLocApi->setSensorPerfControlConfig(controlMode, accelSamplesPerBatch, accelBatchesPerSec,
+ gyroSamplesPerBatch, gyroBatchesPerSec,
+ accelSamplesPerBatchHigh, accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
+ algorithmConfig);
+ }
+ inline virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging)
+ {
+ return mLocApi->setExtPowerConfig(isBatteryCharging);
+ }
+ inline virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+ {
+ return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
+ }
+ inline virtual int initDataServiceClient()
+ {
+ return mLocApi->initDataServiceClient();
+ }
+ inline virtual int openAndStartDataCall()
+ {
+ return mLocApi->openAndStartDataCall();
+ }
+ inline virtual void stopDataCall()
+ {
+ mLocApi->stopDataCall();
+ }
+ inline virtual void closeDataCall()
+ {
+ mLocApi->closeDataCall();
+ }
+ inline enum loc_api_adapter_err
+ getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
+ {
+ return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
+ }
+ enum loc_api_adapter_err setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty);
+ enum loc_api_adapter_err setXtraVersionCheck(int check);
+ inline virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+ {
+ mLocApi->installAGpsCert(pData, length, slotBitMask);
+ }
+ virtual void handleEngineDownEvent();
+ virtual void handleEngineUpEvent();
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+
+ inline const LocPosMode& getPositionMode() const
+ {return mFixCriteria;}
+ inline virtual bool isInSession()
+ { return mNavigating; }
+ void setInSession(bool inSession);
+
+ // Permit/prohibit power voting
+ inline void setPowerVoteRight(bool powerVoteRight) {
+ mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) :
+ (mPowerVote & ~POWER_VOTE_RIGHT);
+ }
+ inline bool getPowerVoteRight() const {
+ return (mPowerVote & POWER_VOTE_RIGHT) != 0 ;
+ }
+ // Set the power voting up/down and do actual operation if permitted
+ inline void setPowerVote(bool powerOn) {
+ mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) :
+ (mPowerVote & ~POWER_VOTE_VALUE);
+ requestPowerVote();
+ mContext->modemPowerVote(powerOn);
+ }
+ inline bool getPowerVote() const {
+ return (mPowerVote & POWER_VOTE_VALUE) != 0 ;
+ }
+ // Do power voting according to last settings if permitted
+ void requestPowerVote();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ inline int setGpsLock(LOC_GPS_LOCK_MASK lock)
+ {
+ return mLocApi->setGpsLock(lock);
+ }
+
+ int setGpsLockMsg(LOC_GPS_LOCK_MASK lock);
+
+ /*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+ */
+ inline int getGpsLock()
+ {
+ return mLocApi->getGpsLock();
+ }
+
+ /*
+ Update Registration Mask
+ */
+ void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+
+ /*
+ Set Gnss Constellation Config
+ */
+ bool gnssConstellationConfig();
+};
+
+#endif //LOC_API_ENG_ADAPTER_H
diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am
new file mode 100644
index 0000000..2374357
--- /dev/null
+++ b/loc_api/libloc_api_50001/Makefile.am
@@ -0,0 +1,76 @@
+AM_CFLAGS = \
+ -I../../utils \
+ -I../../platform_lib_abstractions \
+ -fno-short-enums \
+ -DFEATURE_GNSS_BIT_API
+
+libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp
+
+if USE_GLIB
+libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la
+
+
+libloc_eng_so_la_SOURCES = \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+
+if USE_GLIB
+libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_eng_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la
+
+
+libgps_default_so_la_SOURCES = \
+ loc.cpp \
+ gps.c
+
+if USE_GLIB
+libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_default_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la
+
+library_include_HEADERS = \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+library_includedir = $(pkgincludedir)/libloc_api_50001
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la
diff --git a/loc_api/libloc_api_50001/gps.c b/loc_api/libloc_api_50001/gps.c
new file mode 100644
index 0000000..29f20f4
--- /dev/null
+++ b/loc_api/libloc_api_50001/gps.c
@@ -0,0 +1,73 @@
+/* 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 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 <hardware/gps.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
+
+ if(dev == NULL)
+ return -1;
+
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = 1,
+ .hal_api_version = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp
new file mode 100644
index 0000000..dbda963
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc.cpp
@@ -0,0 +1,1143 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_afw"
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_eng.h>
+#include <loc_target.h>
+#include <loc_log.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <LocDualContext.h>
+#include <cutils/properties.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sstream>
+#include <string>
+
+using namespace loc_core;
+
+#define LOC_PM_CLIENT_NAME "GPS"
+
+//Globals defns
+static gps_location_callback gps_loc_cb = NULL;
+static gps_sv_status_callback gps_sv_cb = NULL;
+
+static void local_loc_cb(UlpLocation* location, void* locExt);
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
+
+static const GpsGeofencingInterface* get_geofence_interface(void);
+
+// Function declarations for sLocEngInterface
+static int loc_init(GpsCallbacks* callbacks);
+static int loc_start();
+static int loc_stop();
+static void loc_cleanup();
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_inject_location(double latitude, double longitude, float accuracy);
+static void loc_delete_aiding_data(GpsAidingData f);
+static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy,
+ uint32_t preferred_time);
+static const void* loc_get_extension(const char* name);
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_init,
+ loc_start,
+ loc_stop,
+ loc_cleanup,
+ loc_inject_time,
+ loc_inject_location,
+ loc_delete_aiding_data,
+ loc_set_position_mode,
+ loc_get_extension
+};
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_agps_init(AGpsCallbacks* callbacks);
+static int loc_agps_open(const char* apn);
+static int loc_agps_closed();
+static int loc_agps_open_failed();
+static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType);
+
+static const AGpsInterface sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface),
+ loc_agps_init,
+ loc_agps_open,
+ loc_agps_closed,
+ loc_agps_open_failed,
+ loc_agps_set_server,
+ loc_agps_open_with_apniptype
+};
+
+static int loc_xtra_init(GpsXtraCallbacks* callbacks);
+static int loc_xtra_inject_data(char* data, int length);
+
+static const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ loc_xtra_init,
+ loc_xtra_inject_data
+};
+
+static void loc_ni_init(GpsNiCallbacks *callbacks);
+static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+static const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_ni_init,
+ loc_ni_respond,
+};
+
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks);
+static void loc_gps_measurement_close();
+
+static const GpsMeasurementInterface sLocEngGpsMeasurementInterface =
+{
+ sizeof(GpsMeasurementInterface),
+ loc_gps_measurement_init,
+ loc_gps_measurement_close
+};
+
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
+static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
+
+static const AGpsRilInterface sLocEngAGpsRilInterface =
+{
+ sizeof(AGpsRilInterface),
+ loc_agps_ril_init,
+ loc_agps_ril_set_ref_location,
+ loc_agps_ril_set_set_id,
+ loc_agps_ril_ni_message,
+ loc_agps_ril_update_network_state,
+ loc_agps_ril_update_network_availability
+};
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length);
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length);
+
+static const SuplCertificateInterface sLocEngAGpsCertInterface =
+{
+ sizeof(SuplCertificateInterface),
+ loc_agps_install_certificates,
+ loc_agps_revoke_certificates
+};
+
+static void loc_configuration_update(const char* config_data, int32_t length);
+
+static const GnssConfigurationInterface sLocEngConfigInterface =
+{
+ sizeof(GnssConfigurationInterface),
+ loc_configuration_update
+};
+
+static loc_eng_data_s_type loc_afw_data;
+static int gss_fd = -1;
+static int sGnssType = GNSS_UNKNOWN;
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ ENTRY_LOG_CALLFLOW();
+ const GpsInterface* ret_val;
+
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ loc_eng_read_config();
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ ret_val = NULL;
+ } else {
+ ret_val = &sLocEngInterface;
+ }
+
+ loc_eng_read_config();
+
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ unsigned int target = TARGET_DEFAULT;
+ loc_eng_read_config();
+
+ target = loc_get_target();
+ LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
+
+ sGnssType = getTargetGnssType(target);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ //APQ8064
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ gss_fd = open("/dev/gss", O_RDONLY);
+ if (gss_fd < 0) {
+ LOC_LOGE("GSS open failed: %s\n", strerror(errno));
+ }
+ else {
+ LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
+ gps_conf.CAPABILITIES);
+ }
+ break;
+ case GNSS_NONE:
+ //MPQ8064
+ LOC_LOGE("No GPS HW on this target. Not returning interface.");
+ return NULL;
+ case GNSS_QCA1530:
+ // qca1530 chip is present
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ LOC_LOGD("qca1530 present: CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
+ break;
+ }
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/Ax
+
+===========================================================================*/
+static int loc_init(GpsCallbacks* callbacks)
+{
+ int retVal = -1;
+ ENTRY_LOG();
+ LOC_API_ADAPTER_EVENT_MASK_T event;
+
+ if (NULL == callbacks) {
+ LOC_LOGE("loc_init failed. cb = NULL\n");
+ EXIT_LOG(%d, retVal);
+ return retVal;
+ }
+
+ event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
+ callbacks->status_cb, /* status_cb */
+ local_sv_cb, /* sv_status_cb */
+ callbacks->nmea_cb, /* nmea_cb */
+ callbacks->set_capabilities_cb, /* set_capabilities_cb */
+ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
+ callbacks->release_wakelock_cb, /* release_wakelock_cb */
+ callbacks->create_thread_cb, /* create_thread_cb */
+ NULL, /* location_ext_parser */
+ NULL, /* sv_ext_parser */
+ callbacks->request_utc_time_cb, /* request_utc_time_cb */
+ };
+
+ gps_loc_cb = callbacks->location_cb;
+ gps_sv_cb = callbacks->sv_status_cb;
+
+ retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
+ loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->setGpsLockMsg(0);
+ loc_afw_data.adapter->requestUlp(getCarrierCapabilities());
+
+ if(retVal) {
+ LOC_LOGE("loc_eng_init() fail!");
+ goto err;
+ }
+
+ loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530);
+ loc_afw_data.adapter->setPowerVote(true);
+
+ LOC_LOGD("loc_eng_init() success!");
+
+err:
+ EXIT_LOG(%d, retVal);
+ return retVal;
+}
+
+/*===========================================================================
+FUNCTION loc_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_cleanup()
+{
+ ENTRY_LOG();
+
+ loc_afw_data.adapter->setPowerVote(false);
+ loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK);
+
+ loc_eng_cleanup(loc_afw_data);
+ gps_loc_cb = NULL;
+ gps_sv_cb = NULL;
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_start()
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_start(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_stop()
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ ret_val = loc_eng_stop(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_set_position_mode(GpsPositionMode mode,
+ GpsPositionRecurrence recurrence,
+ uint32_t min_interval,
+ uint32_t preferred_accuracy,
+ uint32_t preferred_time)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ LocPositionMode locMode;
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ locMode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ locMode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ locMode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+
+ LocPosMode params(locMode, recurrence, min_interval,
+ preferred_accuracy, preferred_time, NULL, NULL);
+ ret_val = loc_eng_set_position_mode(loc_afw_data, params);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG();
+ int ret_val = 0;
+
+ ret_val = loc_eng_inject_time(loc_afw_data, time,
+ timeReference, uncertainty);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_inject_location(double latitude, double longitude, float accuracy)
+{
+ ENTRY_LOG();
+
+ int ret_val = 0;
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_delete_aiding_data(GpsAidingData f)
+{
+ ENTRY_LOG();
+ loc_eng_delete_aiding_data(loc_afw_data, f);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+const GpsGeofencingInterface* get_geofence_interface(void)
+{
+ ENTRY_LOG();
+ void *handle;
+ const char *error;
+ typedef const GpsGeofencingInterface* (*get_gps_geofence_interface_function) (void);
+ get_gps_geofence_interface_function get_gps_geofence_interface;
+ static const GpsGeofencingInterface* geofence_interface = NULL;
+
+ dlerror(); /* Clear any existing error */
+
+ handle = dlopen ("libgeofence.so", RTLD_NOW);
+
+ if (!handle)
+ {
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlopen for libgeofence.so failed, error = %s\n", __func__, error);
+ }
+ goto exit;
+ }
+ dlerror(); /* Clear any existing error */
+ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
+ if ((error = dlerror()) != NULL && NULL != get_gps_geofence_interface) {
+ LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
+ goto exit;
+ }
+
+ geofence_interface = get_gps_geofence_interface();
+
+exit:
+ EXIT_LOG(%d, geofence_interface == NULL);
+ return geofence_interface;
+}
+/*===========================================================================
+FUNCTION loc_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* loc_get_extension(const char* name)
+{
+ ENTRY_LOG();
+ const void* ret_val = NULL;
+
+ LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsInterface;
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngNiInterface;
+ }
+ else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsRilInterface;
+ }
+ else if (strcmp(name, GPS_GEOFENCING_INTERFACE) == 0)
+ {
+ if ((gps_conf.CAPABILITIES | GPS_CAPABILITY_GEOFENCING) == gps_conf.CAPABILITIES ){
+ ret_val = get_geofence_interface();
+ }
+ }
+ else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsCertInterface;
+ }
+ else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngConfigInterface;
+ }
+ else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngGpsMeasurementInterface;
+ }
+ else
+ {
+ LOC_LOGE ("get_extension: Invalid interface passed in\n");
+ }
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_init(AGpsCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_agps_init(loc_afw_data, (AGpsExtCallbacks*)callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open(const char* apn)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType = AGPS_APN_BEARER_IPV4;
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_with_apniptype
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType;
+
+ switch (apnIpType) {
+ case APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_closed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_agps_open_failed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_set_server
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ LocServerType serverType;
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ break;
+ case AGPS_TYPE_C2K:
+ serverType = LOC_AGPS_CDMA_PDE_SERVER;
+ break;
+ default:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ }
+ int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTIONf571
+ loc_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ GpsXtraExtCallbacks extCallbacks;
+ memset(&extCallbacks, 0, sizeof(extCallbacks));
+ extCallbacks.download_request_cb = callbacks->download_request_cb;
+ int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_xtra_inject_data
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_inject_data(char* data, int length)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE))
+ ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
+ else
+ LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d",
+ __func__, data, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_init
+
+DESCRIPTION
+ This function initializes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_gps_measurement_init(loc_afw_data,
+ callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_close
+
+DESCRIPTION
+ This function closes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_gps_measurement_close()
+{
+ ENTRY_LOG();
+ loc_eng_gps_measurement_close(loc_afw_data);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_init(GpsNiCallbacks *callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG();
+ loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+// for XTRA
+static inline int createSocket() {
+ int socketFd = -1;
+
+ if ((socketFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ LOC_LOGe("create socket error. reason:%s", strerror(errno));
+
+ } else {
+ const char* socketPath = "/data/misc/location/xtra/socket_hal_xtra";
+ struct sockaddr_un addr = { .sun_family = AF_UNIX };
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socketPath);
+
+ if (::connect(socketFd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("cannot connect to XTRA. reason:%s", strerror(errno));
+ if (::close(socketFd)) {
+ LOC_LOGe("close socket error. reason:%s", strerror(errno));
+ }
+ socketFd = -1;
+ }
+ }
+
+ return socketFd;
+}
+
+static inline void closeSocket(const int socketFd) {
+ if (socketFd >= 0) {
+ if(::close(socketFd)) {
+ LOC_LOGe("close socket error. reason:%s", strerror(errno));
+ }
+ }
+}
+
+static inline bool sendConnectionEvent(const bool connected, const uint8_t type) {
+ int socketFd = createSocket();
+ if (socketFd < 0) {
+ LOC_LOGe("XTRA unreachable. sending failed.");
+ return false;
+ }
+
+ std::stringstream ss;
+ ss << "connection";
+ ss << " " << (connected ? "1" : "0");
+ ss << " " << type;
+ ss << "\n"; // append seperator
+
+ const std::string& data = ss.str();
+ int remain = data.length();
+ ssize_t sent = 0;
+
+ while (remain > 0 &&
+ (sent = ::send(socketFd, data.c_str() + (data.length() - remain),
+ remain, MSG_NOSIGNAL)) > 0) {
+ remain -= sent;
+ }
+
+ if (sent < 0) {
+ LOC_LOGe("sending error. reason:%s", strerror(errno));
+ }
+
+ closeSocket(socketFd);
+
+ return (remain == 0);
+}
+
+// Below stub functions are members of sLocEngAGpsRilInterface
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {
+ // for XTRA
+ sendConnectionEvent((connected != 0) ? true : false,
+ (uint8_t)type);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_ril_update_network_availability(int available, const char* apn)
+{
+ ENTRY_LOG();
+ loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length)
+{
+ ENTRY_LOG();
+ LOC_LOGE("%s:%d]: agps_revoke_certificates not supported");
+ int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static void loc_configuration_update(const char* config_data, int32_t length)
+{
+ ENTRY_LOG();
+ loc_eng_configuration_update(loc_afw_data, config_data, length);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ case GNSS_QCA1530:
+ //APQ
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ break;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_loc_cb(UlpLocation* location, void* locExt)
+{
+ ENTRY_LOG();
+ if (NULL != location) {
+ CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
+
+ if (NULL != gps_loc_cb) {
+ gps_loc_cb(&location->gpsLocation);
+ }
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
+{
+ ENTRY_LOG();
+ if (NULL != gps_sv_cb) {
+ CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
+ gps_sv_cb(sv_status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h
new file mode 100644
index 0000000..e56fdcf
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc.h
@@ -0,0 +1,66 @@
+/* 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 __LOC_H__
+#define __LOC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/
+
+typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
+typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
+typedef void* (*loc_ext_parser)(void* data);
+
+typedef struct {
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ gps_request_utc_time request_utc_time_cb;
+} LocCallbacks;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_H__
diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp
new file mode 100644
index 0000000..7c62aa8
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng.cpp
@@ -0,0 +1,2998 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <time.h>
+#include <new>
+#include <LocEngAdapter.h>
+
+#include <cutils/sched_policy.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+#include <glib.h>
+#include <sys/syscall.h>
+#endif /* USE_GLIB */
+
+#include <string.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_dmn_conn.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_msg.h>
+#include <loc_eng_nmea.h>
+#include <msg_q.h>
+#include <loc.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_core_log.h"
+#include "loc_eng_log.h"
+
+#define SUCCESS TRUE
+#define FAILURE FALSE
+
+#ifndef GPS_CONF_FILE
+#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
+#endif
+
+#ifndef SAP_CONF_FILE
+#define SAP_CONF_FILE "/etc/sap.conf"
+#endif
+
+#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net"
+
+using namespace loc_core;
+
+boolean configAlreadyRead = false;
+unsigned int agpsStatus = 0;
+loc_gps_cfg_s_type gps_conf;
+loc_sap_cfg_s_type sap_conf;
+
+/* Parameter spec table */
+static loc_param_s_type gps_conf_table[] =
+{
+ {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'},
+ {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
+ {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+ {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
+ {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'},
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
+ {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
+ {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'},
+ {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'},
+ {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'},
+ {"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
+};
+
+static loc_param_s_type sap_conf_table[] =
+{
+ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'}
+};
+
+static void loc_default_parameters(void)
+{
+ /*Defaults for gps.conf*/
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.NMEA_PROVIDER = 0;
+ gps_conf.GPS_LOCK = 0;
+ gps_conf.SUPL_VER = 0x10000;
+ gps_conf.SUPL_MODE = 0x3;
+ gps_conf.CAPABILITIES = 0x7;
+ /* LTE Positioning Profile configuration is disable by default*/
+ gps_conf.LPP_PROFILE = 0;
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+ /*XTRA version check is disabled by default*/
+ gps_conf.XTRA_VERSION_CHECK=0;
+ /*Use emergency PDN by default*/
+ gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
+
+ /*Defaults for sap.conf*/
+ sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ sap_conf.SENSOR_USAGE = 0; /* Enabled */
+ sap_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 */
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ /* default provider is SSC */
+ sap_conf.SENSOR_PROVIDER = 1;
+
+ /* None of the 10 slots for agps certificates are writable by default */
+ gps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+}
+
+// 2nd half of init(), singled out for
+// modem restart to use.
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
+
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+// Internal functions
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_report_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_process_conn_request(loc_eng_data_s_type &loc_eng_data,
+ int connHandle, AGpsType agps_type);
+static void loc_eng_agps_close_status(loc_eng_data_s_type &loc_eng_data, int is_succ);
+static void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data) ;
+static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
+static void deleteAidingData(loc_eng_data_s_type &logEng);
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
+static int dataCallCb(void *cb_data);
+static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ loc_eng_data.adapter->deleteAidingData(loc_eng_data.aiding_data_for_deletion);
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+}
+
+static void* noProc(void* data)
+{
+ return NULL;
+}
+
+
+/*********************************************************************
+ * definitions of the static messages used in the file
+ *********************************************************************/
+// case LOC_ENG_MSG_REQUEST_NI:
+LocEngRequestNi::LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data) :
+ LocMsg(), mLocEng(locEng), mNotify(notif), mPayload(data) {
+ locallog();
+}
+void LocEngRequestNi::proc() const {
+ loc_eng_ni_request_handler(*((loc_eng_data_s_type*)mLocEng),
+ &mNotify, mPayload);
+}
+void LocEngRequestNi::locallog() const
+{
+ LOC_LOGV("id: %d\n type: %s\n flags: %d\n time out: %d\n "
+ "default response: %s\n requestor id encoding: %s\n"
+ " text encoding: %s\n passThroughData: %p",
+ mNotify.notification_id,
+ loc_get_ni_type_name(mNotify.ni_type),
+ mNotify.notify_flags,
+ mNotify.timeout,
+ loc_get_ni_response_name(mNotify.default_response),
+ loc_get_ni_encoding_name(mNotify.requestor_id_encoding),
+ loc_get_ni_encoding_name(mNotify.text_encoding),
+ mPayload);
+}
+inline void LocEngRequestNi::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_INFORM_NI_RESPONSE:
+// in loc_eng_ni.cpp
+
+// case LOC_ENG_MSG_START_FIX:
+LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStartFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_start_handler(*locEng);
+}
+inline void LocEngStartFix::locallog() const
+{
+ LOC_LOGV("LocEngStartFix");
+}
+inline void LocEngStartFix::log() const
+{
+ locallog();
+}
+void LocEngStartFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_STOP_FIX:
+LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStopFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_stop_handler(*locEng);
+}
+inline void LocEngStopFix::locallog() const
+{
+ LOC_LOGV("LocEngStopFix");
+}
+inline void LocEngStopFix::log() const
+{
+ locallog();
+}
+void LocEngStopFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_POSITION_MODE:
+LocEngPositionMode::LocEngPositionMode(LocEngAdapter* adapter,
+ LocPosMode &mode) :
+ LocMsg(), mAdapter(adapter), mPosMode(mode)
+{
+ mPosMode.logv();
+}
+inline void LocEngPositionMode::proc() const {
+ mAdapter->setPositionMode(&mPosMode);
+}
+inline void LocEngPositionMode::log() const {
+ mPosMode.logv();
+}
+void LocEngPositionMode::send() const {
+ mAdapter->sendMsg(this);
+}
+
+LocEngGetZpp::LocEngGetZpp(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngGetZpp::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_get_zpp_handler(*locEng);
+}
+inline void LocEngGetZpp::locallog() const
+{
+ LOC_LOGV("LocEngGetZpp");
+}
+inline void LocEngGetZpp::log() const
+{
+ locallog();
+}
+void LocEngGetZpp::send() const {
+ mAdapter->sendMsg(this);
+}
+
+struct LocEngSetTime : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUtcTime mTime;
+ const int64_t mTimeReference;
+ const int mUncertainty;
+ inline LocEngSetTime(LocEngAdapter* adapter,
+ GpsUtcTime t, int64_t tf, int unc) :
+ LocMsg(), mAdapter(adapter),
+ mTime(t), mTimeReference(tf), mUncertainty(unc)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setTime(mTime, mTimeReference, mUncertainty);
+ }
+ inline void locallog() const {
+ LOC_LOGV("time: %lld\n timeReference: %lld\n uncertainty: %d",
+ mTime, mTimeReference, mUncertainty);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+ // case LOC_ENG_MSG_INJECT_LOCATION:
+struct LocEngInjectLocation : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const double mLatitude;
+ const double mLongitude;
+ const float mAccuracy;
+ inline LocEngInjectLocation(LocEngAdapter* adapter,
+ double lat, double lon, float accur) :
+ LocMsg(), mAdapter(adapter),
+ mLatitude(lat), mLongitude(lon), mAccuracy(accur)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ inline void locallog() const {
+ LOC_LOGV("latitude: %f\n longitude: %f\n accuracy: %f",
+ mLatitude, mLongitude, mAccuracy);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_IPV4:
+struct LocEngSetServerIpv4 : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned int mNlAddr;
+ const int mPort;
+ const LocServerType mServerType;
+ inline LocEngSetServerIpv4(LocEngAdapter* adapter,
+ unsigned int ip,
+ int port,
+ LocServerType type) :
+ LocMsg(), mAdapter(adapter),
+ mNlAddr(ip), mPort(port), mServerType(type)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mNlAddr, mPort, mServerType);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s",
+ mNlAddr, mPort, loc_get_server_type_name(mServerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_URL:
+struct LocEngSetServerUrl : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLen;
+ char* mUrl;
+ inline LocEngSetServerUrl(LocEngAdapter* adapter,
+ char* urlString,
+ int url_len) :
+ LocMsg(), mAdapter(adapter),
+ mLen(url_len), mUrl(new char[mLen+1])
+ {
+ memcpy((void*)mUrl, (void*)urlString, url_len);
+ mUrl[mLen] = 0;
+ locallog();
+ }
+ inline ~LocEngSetServerUrl()
+ {
+ delete[] mUrl;
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mUrl, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
+struct LocEngAGlonassProtocol : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned long mAGlonassProtocl;
+ inline LocEngAGlonassProtocol(LocEngAdapter* adapter,
+ unsigned long protocol) :
+ LocMsg(), mAdapter(adapter), mAGlonassProtocl(protocol)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setAGLONASSProtocol(mAGlonassProtocl);
+ }
+ inline void locallog() const {
+ LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SUPL_VERSION:
+struct LocEngSuplVer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSuplVer;
+ inline LocEngSuplVer(LocEngAdapter* adapter,
+ int suplVer) :
+ LocMsg(), mAdapter(adapter), mSuplVer(suplVer)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSUPLVersion(mSuplVer);
+ }
+ inline void locallog() const {
+ LOC_LOGV("SUPL Version: %d", mSuplVer);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSuplMode : public LocMsg {
+ UlpProxyBase* mUlp;
+
+ inline LocEngSuplMode(UlpProxyBase* ulp) :
+ LocMsg(), mUlp(ulp)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mUlp->setCapabilities(getCarrierCapabilities());
+ }
+ inline void locallog() const {
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LPP_CONFIG:
+struct LocEngLppConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLppConfig;
+ inline LocEngLppConfig(LocEngAdapter* adapter,
+ int lppConfig) :
+ LocMsg(), mAdapter(adapter), mLppConfig(lppConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setLPPConfig(mLppConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG:
+struct LocEngSensorControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSensorsDisabled;
+ const int mSensorProvider;
+ inline LocEngSensorControlConfig(LocEngAdapter* adapter,
+ int sensorsDisabled, int sensorProvider) :
+ LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled),
+ mSensorProvider(sensorProvider)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d",
+ mSensorsDisabled, mSensorProvider);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PROPERTIES:
+struct LocEngSensorProperties : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const bool mGyroBiasVarianceRandomWalkValid;
+ const float mGyroBiasVarianceRandomWalk;
+ const bool mAccelRandomWalkValid;
+ const float mAccelRandomWalk;
+ const bool mAngleRandomWalkValid;
+ const float mAngleRandomWalk;
+ const bool mRateRandomWalkValid;
+ const float mRateRandomWalk;
+ const bool mVelocityRandomWalkValid;
+ const float mVelocityRandomWalk;
+ inline LocEngSensorProperties(LocEngAdapter* adapter,
+ bool gyroBiasRandomWalk_valid,
+ float gyroBiasRandomWalk,
+ bool accelRandomWalk_valid,
+ float accelRandomWalk,
+ bool angleRandomWalk_valid,
+ float angleRandomWalk,
+ bool rateRandomWalk_valid,
+ float rateRandomWalk,
+ bool velocityRandomWalk_valid,
+ float velocityRandomWalk) :
+ LocMsg(), mAdapter(adapter),
+ mGyroBiasVarianceRandomWalkValid(gyroBiasRandomWalk_valid),
+ mGyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
+ mAccelRandomWalkValid(accelRandomWalk_valid),
+ mAccelRandomWalk(accelRandomWalk),
+ mAngleRandomWalkValid(angleRandomWalk_valid),
+ mAngleRandomWalk(angleRandomWalk),
+ mRateRandomWalkValid(rateRandomWalk_valid),
+ mRateRandomWalk(rateRandomWalk),
+ mVelocityRandomWalkValid(velocityRandomWalk_valid),
+ mVelocityRandomWalk(velocityRandomWalk)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorProperties(mGyroBiasVarianceRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalkValid,
+ mAccelRandomWalk,
+ mAngleRandomWalkValid,
+ mAngleRandomWalk,
+ mRateRandomWalkValid,
+ mRateRandomWalk,
+ mVelocityRandomWalkValid,
+ mVelocityRandomWalk);
+ }
+ inline void locallog() const {
+ LOC_LOGV("Sensor properties validity, Gyro Random walk: %d "
+ "Accel Random Walk: %d "
+ "Angle Random Walk: %d Rate Random Walk: %d "
+ "Velocity Random Walk: %d\n"
+ "Sensor properties, Gyro Random walk: %f "
+ "Accel Random Walk: %f "
+ "Angle Random Walk: %f Rate Random Walk: %f "
+ "Velocity Random Walk: %f",
+ mGyroBiasVarianceRandomWalkValid,
+ mAccelRandomWalkValid,
+ mAngleRandomWalkValid,
+ mRateRandomWalkValid,
+ mVelocityRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalk,
+ mAngleRandomWalk,
+ mRateRandomWalk,
+ mVelocityRandomWalk
+ );
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG:
+struct LocEngSensorPerfControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mControlMode;
+ const int mAccelSamplesPerBatch;
+ const int mAccelBatchesPerSec;
+ const int mGyroSamplesPerBatch;
+ const int mGyroBatchesPerSec;
+ const int mAccelSamplesPerBatchHigh;
+ const int mAccelBatchesPerSecHigh;
+ const int mGyroSamplesPerBatchHigh;
+ const int mGyroBatchesPerSecHigh;
+ const int mAlgorithmConfig;
+ inline LocEngSensorPerfControlConfig(LocEngAdapter* adapter,
+ int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig) :
+ LocMsg(), mAdapter(adapter),
+ mControlMode(controlMode),
+ mAccelSamplesPerBatch(accelSamplesPerBatch),
+ mAccelBatchesPerSec(accelBatchesPerSec),
+ mGyroSamplesPerBatch(gyroSamplesPerBatch),
+ mGyroBatchesPerSec(gyroBatchesPerSec),
+ mAccelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
+ mAccelBatchesPerSecHigh(accelBatchesPerSecHigh),
+ mGyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
+ mGyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
+ mAlgorithmConfig(algorithmConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorPerfControlConfig(mControlMode,
+ mAccelSamplesPerBatch,
+ mAccelBatchesPerSec,
+ mGyroSamplesPerBatch,
+ mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh,
+ mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh,
+ mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("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",
+ mControlMode,
+ mAccelSamplesPerBatch, mAccelBatchesPerSec,
+ mGyroSamplesPerBatch, mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh, mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh, mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_EXT_POWER_CONFIG:
+struct LocEngExtPowerConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mIsBatteryCharging;
+ inline LocEngExtPowerConfig(LocEngAdapter* adapter,
+ int isBatteryCharging) :
+ LocMsg(), mAdapter(adapter),
+ mIsBatteryCharging(isBatteryCharging)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setExtPowerConfig(mIsBatteryCharging);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
+ mIsBatteryCharging);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_POSITION:
+LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology) :
+ LocMsg(), mAdapter(adapter), mLocation(loc),
+ mLocationExtended(locExtended),
+ mLocationExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->location_ext_parser(locExt)),
+ mStatus(st), mTechMask(technology)
+{
+ locallog();
+}
+void LocEngReportPosition::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
+ bool reported = false;
+ if (locEng->location_cb != NULL) {
+ if (LOC_SESS_FAILURE == mStatus) {
+ // in case we want to handle the failure case
+ locEng->location_cb(NULL, NULL);
+ reported = true;
+ }
+ // what's in the else if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ else if ((LOC_SESS_SUCCESS == mStatus &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID) &
+ mTechMask)) ||
+ (LOC_SESS_INTERMEDIATE == locEng->intermediateFix &&
+ !((mLocation.gpsLocation.flags &
+ GPS_LOCATION_HAS_ACCURACY) &&
+ (gps_conf.ACCURACY_THRES != 0) &&
+ (mLocation.gpsLocation.accuracy >
+ gps_conf.ACCURACY_THRES)))) {
+ locEng->location_cb((UlpLocation*)&(mLocation),
+ (void*)mLocationExt);
+ reported = true;
+ }
+ }
+
+ // if we have reported this fix
+ if (reported &&
+ // and if this is a singleshot
+ GPS_POSITION_RECURRENCE_SINGLE ==
+ locEng->adapter->getPositionMode().recurrence) {
+ if (LOC_SESS_INTERMEDIATE == mStatus) {
+ // modem could be still working for a final fix,
+ // although we no longer need it. So stopFix().
+ locEng->adapter->stopFix();
+ }
+ // turn off the session flag.
+ locEng->adapter->setInSession(false);
+ }
+
+ if (locEng->generateNmea &&
+ mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS &&
+ mTechMask & (LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID))
+ {
+ unsigned char generate_nmea = reported &&
+ (mStatus != LOC_SESS_FAILURE);
+ loc_eng_nmea_generate_pos(locEng, mLocation, mLocationExtended,
+ generate_nmea);
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(mLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+ }
+}
+void LocEngReportPosition::locallog() const {
+ LOC_LOGV("LocEngReportPosition");
+}
+void LocEngReportPosition::log() const {
+ locallog();
+}
+void LocEngReportPosition::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+// case LOC_ENG_MSG_REPORT_SV:
+LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExt) :
+ LocMsg(), mAdapter(adapter), mSvStatus(sv),
+ mLocationExtended(locExtended),
+ mSvExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->sv_ext_parser(svExt))
+{
+ locallog();
+}
+void LocEngReportSv::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->sv_status_cb != NULL) {
+ locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
+ (void*)mSvExt);
+ }
+
+ if (locEng->generateNmea)
+ {
+ loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
+ }
+ }
+}
+void LocEngReportSv::locallog() const {
+ LOC_LOGV("%s:%d] LocEngReportSv",__func__, __LINE__);
+}
+inline void LocEngReportSv::log() const {
+ locallog();
+}
+void LocEngReportSv::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REPORT_STATUS:
+LocEngReportStatus::LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus) :
+ LocMsg(), mAdapter(adapter), mStatus(engineStatus)
+{
+ locallog();
+}
+inline void LocEngReportStatus::proc() const
+{
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ loc_eng_report_status(*locEng, mStatus);
+ update_aiding_data_for_deletion(*locEng);
+}
+inline void LocEngReportStatus::locallog() const {
+ LOC_LOGV("LocEngReportStatus");
+}
+inline void LocEngReportStatus::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_NMEA:
+LocEngReportNmea::LocEngReportNmea(void* locEng,
+ const char* data, int len) :
+ LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
+{
+ memcpy((void*)mNmea, (void*)data, len);
+ locallog();
+}
+void LocEngReportNmea::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+
+ if (locEng->nmea_cb != NULL)
+ locEng->nmea_cb(now, mNmea, mLen);
+}
+inline void LocEngReportNmea::locallog() const {
+ LOC_LOGV("LocEngReportNmea");
+}
+inline void LocEngReportNmea::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_XTRA_SERVER:
+LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
+ const char *url1,
+ const char *url2,
+ const char *url3,
+ const int maxlength) :
+ LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
+ mServers(new char[3*(mMaxLen+1)])
+{
+ char * cptr = mServers;
+ memset(mServers, 0, 3*(mMaxLen+1));
+
+ // Override modem URLs with uncommented gps.conf urls
+ if( gps_conf.XTRA_SERVER_1[0] != '\0' ) {
+ url1 = &gps_conf.XTRA_SERVER_1[0];
+ }
+ if( gps_conf.XTRA_SERVER_2[0] != '\0' ) {
+ url2 = &gps_conf.XTRA_SERVER_2[0];
+ }
+ if( gps_conf.XTRA_SERVER_3[0] != '\0' ) {
+ url3 = &gps_conf.XTRA_SERVER_3[0];
+ }
+ // copy non xtra1.gpsonextra.net URLs into the forwarding buffer.
+ if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url1, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url2, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url3, mMaxLen + 1);
+ }
+ locallog();
+}
+
+void LocEngReportXtraServer::proc() const {
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->report_xtra_server_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("report_xtra_server_cb", %s, mServers);
+ locEngXtra->report_xtra_server_cb(mServers,
+ &(mServers[mMaxLen+1]),
+ &(mServers[(mMaxLen+1)<<1]));
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngReportXtraServer::locallog() const {
+ LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n"
+ " server3: %s\n",
+ mServers, &mServers[mMaxLen+1], &mServers[(mMaxLen+1)<<1]);
+}
+inline void LocEngReportXtraServer::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_BIT:
+// case LOC_ENG_MSG_RELEASE_BIT:
+LocEngReqRelBIT::LocEngReqRelBIT(void* locEng, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mIPv4Addr(ipv4),
+ mIPv6Addr(ipv6 ? new char[16] : NULL), mIsReq(isReq) {
+ if (NULL != ipv6)
+ memcpy(mIPv6Addr, ipv6, 16);
+ locallog();
+}
+inline LocEngReqRelBIT::~LocEngReqRelBIT() {
+ if (mIPv6Addr) {
+ delete[] mIPv6Addr;
+ }
+}
+void LocEngReqRelBIT::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ BITSubscriber s(getAgpsStateMachine(*locEng, mType),
+ mIPv4Addr, mIPv6Addr);
+ AgpsStateMachine* sm = (AgpsStateMachine*)s.mStateMachine;
+
+ if (mIsReq) {
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ sm->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelBIT::locallog() const {
+ LOC_LOGV("LocEngRequestBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)mIPv4Addr,
+ (unsigned char)(mIPv4Addr>>8),
+ (unsigned char)(mIPv4Addr>>16),
+ (unsigned char)(mIPv4Addr>>24),
+ NULL != mIPv6Addr ? mIPv6Addr : "");
+}
+inline void LocEngReqRelBIT::log() const {
+ locallog();
+}
+void LocEngReqRelBIT::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_RELEASE_BIT:
+struct LocEngReleaseBIT : public LocMsg {
+ const BITSubscriber mSubscriber;
+ inline LocEngReleaseBIT(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ LocMsg(),
+ mSubscriber(stateMachine, ipv4, ipv6)
+ {
+ locallog();
+ }
+ inline virtual void proc() const
+ {
+ AgpsStateMachine* sm = (AgpsStateMachine*)mSubscriber.mStateMachine;
+ sm->unsubscribeRsrc((Subscriber*)&mSubscriber);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngReleaseBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mSubscriber.ID>>24),
+ (unsigned char)(mSubscriber.ID>>16),
+ (unsigned char)(mSubscriber.ID>>8),
+ (unsigned char)mSubscriber.ID,
+ NULL != mSubscriber.mIPv6Addr ? mSubscriber.mIPv6Addr : "");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// LocEngSuplEsOpened
+LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsOpened::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_GRANTED);
+ }
+}
+void LocEngSuplEsOpened::locallog() const {
+ LOC_LOGV("LocEngSuplEsOpened");
+}
+void LocEngSuplEsOpened::log() const {
+ locallog();
+}
+
+// LocEngSuplEsClosed
+LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsClosed::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_RELEASED);
+ }
+}
+void LocEngSuplEsClosed::locallog() const {
+ LOC_LOGV("LocEngSuplEsClosed");
+}
+void LocEngSuplEsClosed::log() const {
+ locallog();
+}
+
+
+// case LOC_ENG_MSG_REQUEST_SUPL_ES:
+LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngRequestSuplEs::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ DSSubscriber s(sm, mID);
+ sm->subscribeRsrc((Subscriber*)&s);
+ }
+ else if (locEng->agnss_nif) {
+ AgpsStateMachine *sm = locEng->agnss_nif;
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ false);
+ sm->subscribeRsrc((Subscriber*)&s);
+ LOC_LOGD("%s:%d]: Using regular ATL for SUPL ES", __func__, __LINE__);
+ }
+ else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1);
+ }
+}
+inline void LocEngRequestSuplEs::locallog() const {
+ LOC_LOGV("LocEngRequestSuplEs");
+}
+inline void LocEngRequestSuplEs::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_ATL:
+LocEngRequestATL::LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type) :
+ LocMsg(), mLocEng(locEng), mID(id), mType(agps_type) {
+ locallog();
+}
+void LocEngRequestATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = (AgpsStateMachine*)
+ getAgpsStateMachine(*locEng, mType);
+ if (sm) {
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ AGPS_TYPE_INVALID == mType);
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngRequestATL::locallog() const {
+ LOC_LOGV("LocEngRequestATL");
+}
+inline void LocEngRequestATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_RELEASE_ATL:
+LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngReleaseATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+
+ if (locEng->agnss_nif) {
+ ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false);
+ if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->internet_nif) {
+ ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false);
+ if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from internet_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->ds_nif) {
+ DSSubscriber s3(locEng->ds_nif, mID);
+ if (locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from ds_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ LOC_LOGW("%s:%d]: Could not release ATL. "
+ "No subscribers found\n",
+ __func__, __LINE__);
+ locEng->adapter->atlCloseStatus(mID, 0);
+}
+inline void LocEngReleaseATL::locallog() const {
+ LOC_LOGV("LocEngReleaseATL");
+}
+inline void LocEngReleaseATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_WIFI:
+// case LOC_ENG_MSG_RELEASE_WIFI:
+LocEngReqRelWifi::LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mSenderId(sender_id),
+ mSSID(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == p ? NULL : new char[SSID_BUF_SIZE]),
+ mIsReq(isReq) {
+ if (NULL != s)
+ strlcpy(mSSID, s, SSID_BUF_SIZE);
+ if (NULL != p)
+ strlcpy(mPassword, p, SSID_BUF_SIZE);
+ locallog();
+}
+LocEngReqRelWifi::~LocEngReqRelWifi() {
+ if (NULL != mSSID) {
+ delete[] mSSID;
+ }
+ if (NULL != mPassword) {
+ delete[] mPassword;
+ }
+}
+void LocEngReqRelWifi::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->wifi_nif) {
+ WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
+ if (mIsReq) {
+ locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
+ }
+ } else {
+ locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngReqRelWifi::locallog() const {
+ LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
+ mIsReq ? "LocEngRequestWifi" : "LocEngReleaseWifi",
+ mSenderId,
+ NULL != mSSID ? mSSID : "",
+ NULL != mPassword ? mPassword : "");
+}
+inline void LocEngReqRelWifi::log() const {
+ locallog();
+}
+void LocEngReqRelWifi::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REQUEST_XTRA_DATA:
+LocEngRequestXtra::LocEngRequestXtra(void* locEng) :
+ mLocEng(locEng) {
+ locallog();
+}
+void LocEngRequestXtra::proc() const
+{
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->download_request_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("download_request_cb", %p, mLocEng);
+ locEngXtra->download_request_cb();
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngRequestXtra::locallog() const {
+ LOC_LOGV("LocEngReqXtra");
+}
+inline void LocEngRequestXtra::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_TIME:
+LocEngRequestTime::LocEngRequestTime(void* locEng) :
+ LocMsg(), mLocEng(locEng)
+{
+ locallog();
+}
+void LocEngRequestTime::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (gps_conf.CAPABILITIES & GPS_CAPABILITY_ON_DEMAND_TIME) {
+ if (locEng->request_utc_time_cb != NULL) {
+ locEng->request_utc_time_cb();
+ } else {
+ LOC_LOGE("Callback function for request time is NULL");
+ }
+ }
+}
+inline void LocEngRequestTime::locallog() const {
+ LOC_LOGV("LocEngReqTime");
+}
+inline void LocEngRequestTime::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_DELETE_AIDING_DATA:
+struct LocEngDelAidData : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ const GpsAidingData mType;
+ inline LocEngDelAidData(loc_eng_data_s_type* locEng,
+ GpsAidingData f) :
+ LocMsg(), mLocEng(locEng), mType(f)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocEng->aiding_data_for_deletion = mType;
+ update_aiding_data_for_deletion(*mLocEng);
+ }
+ inline void locallog() const {
+ LOC_LOGV("aiding data msak %d", mType);
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENABLE_DATA:
+struct LocEngEnableData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mEnable;
+ char* mAPN;
+ const int mLen;
+ inline LocEngEnableData(LocEngAdapter* adapter,
+ const char* name, int len, int enable) :
+ LocMsg(), mAdapter(adapter),
+ mEnable(enable), mAPN(NULL), mLen(len)
+ {
+ if (NULL != name) {
+ mAPN = new char[len+1];
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ }
+ locallog();
+ }
+ inline ~LocEngEnableData() {
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter->enableData(mEnable);
+ if (NULL != mAPN) {
+ mAdapter->setAPN(mAPN, mLen);
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("apn: %s\n enable: %d",
+ (NULL == mAPN) ? "NULL" : mAPN, mEnable);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_INJECT_XTRA_DATA:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_SET_CAPABILITIES:
+struct LocEngSetCapabilities : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_capabilities_cb) {
+ LOC_LOGV("calling set_capabilities_cb 0x%x",
+ gps_conf.CAPABILITIES);
+ mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES);
+ } else {
+ LOC_LOGV("set_capabilities_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetCapabilities");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LOC_INIT:
+struct LocEngInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_reinit(*mLocEng);
+ // set the capabilities
+ mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInit");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REQUEST_XTRA_SERVER:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
+struct LocEngAtlOpenSuccess : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ const int mLen;
+ char* mAPN;
+ const AGpsBearerType mBearerType;
+ inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
+ const char* name,
+ int len,
+ AGpsBearerType btype) :
+ LocMsg(),
+ mStateMachine(statemachine), mLen(len),
+ mAPN(new char[len+1]), mBearerType(btype)
+ {
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ locallog();
+ }
+ inline ~LocEngAtlOpenSuccess()
+ {
+ delete[] mAPN;
+ }
+ inline virtual void proc() const {
+ mStateMachine->setBearer(mBearerType);
+ mStateMachine->setAPN(mAPN, mLen);
+ mStateMachine->onRsrcEvent(RSRC_GRANTED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n"
+ " bearer type: %s",
+ loc_get_agps_type_name(mStateMachine->getType()),
+ mAPN,
+ loc_get_agps_bear_name(mBearerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_CLOSED:
+struct LocEngAtlClosed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_RELEASED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_OPEN_FAILED:
+struct LocEngAtlOpenFailed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_DENIED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenFailed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENGINE_DOWN:
+LocEngDown::LocEngDown(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngDown::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_down(*locEng);
+}
+inline void LocEngDown::locallog() const {
+ LOC_LOGV("LocEngDown");
+}
+inline void LocEngDown::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_ENGINE_UP:
+LocEngUp::LocEngUp(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngUp::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_up(*locEng);
+}
+inline void LocEngUp::locallog() const {
+ LOC_LOGV("LocEngUp");
+}
+inline void LocEngUp::log() const {
+ locallog();
+}
+
+struct LocEngDataClientInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngDataClientInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+ }
+ virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ if(!locEng->adapter->initDataServiceClient()) {
+ locEng->ds_nif = new DSStateMachine(servicerTypeExt,
+ (void *)dataCallCb,
+ locEng->adapter);
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngDataClientInit\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInstallAGpsCert : public LocMsg {
+ LocEngAdapter* mpAdapter;
+ const size_t mNumberOfCerts;
+ const uint32_t mSlotBitMask;
+ DerEncodedCertificate* mpData;
+ inline LocEngInstallAGpsCert(LocEngAdapter* adapter,
+ const DerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask) :
+ LocMsg(), mpAdapter(adapter),
+ mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask),
+ mpData(new DerEncodedCertificate[mNumberOfCerts])
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ mpData[i].data = new u_char[pData[i].length];
+ if (mpData[i].data) {
+ memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length);
+ mpData[i].length = pData[i].length;
+ } else {
+ LOC_LOGE("malloc failed for cert#%d", i);
+ break;
+ }
+ }
+ locallog();
+ }
+ inline ~LocEngInstallAGpsCert()
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ if (mpData[i].data) {
+ delete[] mpData[i].data;
+ }
+ }
+ delete[] mpData;
+ }
+ inline virtual void proc() const {
+ mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u",
+ mNumberOfCerts, mSlotBitMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngUpdateRegistrationMask : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ loc_registration_mask_status mIsEnabled;
+ inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng,
+ LOC_API_ADAPTER_EVENT_MASK_T mask,
+ loc_registration_mask_status isEnabled) :
+ LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ locEng->adapter->updateRegistrationMask(mMask,
+ mIsEnabled);
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngUpdateRegistrationMask\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngGnssConstellationConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (mAdapter->gnssConstellationConfig()) {
+ LOC_LOGV("Modem supports GNSS measurements\n");
+ gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
+ } else {
+ LOC_LOGV("Modem does not support GNSS measurements\n");
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngGnssConstellationConfig\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
+LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng,
+ GpsData &gpsData) :
+ LocMsg(), mLocEng(locEng), mGpsData(gpsData)
+{
+ locallog();
+}
+void LocEngReportGpsMeasurement::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gps_measurement_cb != NULL) {
+ locEng->gps_measurement_cb((GpsData*)&(mGpsData));
+ }
+ }
+}
+void LocEngReportGpsMeasurement::locallog() const {
+ IF_LOC_LOGV {
+ LOC_LOGV("%s:%d]: Received in GPS HAL."
+ "GNSS Measurements count: %d \n",
+ __func__, __LINE__, mGpsData.measurement_count);
+ for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
+ " GPS_HAL => Measurement ID | prn | time_offset_ns | state |"
+ " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |"
+ " pseudorange_rate_uncertainty_mps |"
+ " accumulated_delta_range_state | flags \n"
+ " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n",
+ i,
+ mGpsData.measurements[i].prn,
+ mGpsData.measurements[i].time_offset_ns,
+ mGpsData.measurements[i].state,
+ mGpsData.measurements[i].received_gps_tow_ns,
+ mGpsData.measurements[i].c_n0_dbhz,
+ mGpsData.measurements[i].pseudorange_rate_mps,
+ mGpsData.measurements[i].pseudorange_rate_uncertainty_mps,
+ mGpsData.measurements[i].accumulated_delta_range_state,
+ mGpsData.measurements[i].flags);
+ }
+ LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n"
+ " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type,
+ mGpsData.clock.time_ns);
+ }
+}
+inline void LocEngReportGpsMeasurement::log() const {
+ locallog();
+}
+
+/*********************************************************************
+ * Initialization checking macros
+ *********************************************************************/
+#define STATE_CHECK(ctx, x, ret) \
+ if (!(ctx)) \
+ { \
+ /* Not intialized, abort */\
+ LOC_LOGE("%s: log_eng state error: %s", __func__, x); \
+ EXIT_LOG(%s, x); \
+ ret; \
+ }
+#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
+
+uint32_t getCarrierCapabilities() {
+ #define carrierMSA (uint32_t)0x2
+ #define carrierMSB (uint32_t)0x1
+ #define gpsConfMSA (uint32_t)0x4
+ #define gpsConfMSB (uint32_t)0x2
+ uint32_t capabilities = gps_conf.CAPABILITIES;
+ if ((gps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
+ capabilities &= ~gpsConfMSA;
+ }
+ if ((gps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
+ capabilities &= ~gpsConfMSB;
+ }
+
+ LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
+ gps_conf.CAPABILITIES, gps_conf.SUPL_MODE, capabilities);
+ return capabilities;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event, ContextBase* context)
+
+{
+ int ret_val = 0;
+
+ ENTRY_LOG_CALLFLOW();
+ if (NULL == callbacks || 0 == event) {
+ LOC_LOGE("loc_eng_init: bad parameters cb %p eMask %d", callbacks, event);
+ ret_val = -1;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+ }
+
+ STATE_CHECK((NULL == loc_eng_data.adapter),
+ "instance already initialized", return 0);
+
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data));
+
+ // Save callbacks
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+ loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+ loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
+ callbacks->location_ext_parser : noProc;
+ loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
+ callbacks->sv_ext_parser : noProc;
+ loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
+ // initial states taken care of by the memset above
+ // loc_eng_data.engine_status -- GPS_STATUS_NONE;
+ // loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
+ // loc_eng_data.mute_session_state -- LOC_MUTE_SESS_NONE;
+
+ if ((event & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) && (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_AP))
+ {
+ event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
+ loc_eng_data.generateNmea = true;
+ }
+ else
+ {
+ loc_eng_data.generateNmea = false;
+ }
+
+ loc_eng_data.adapter =
+ new LocEngAdapter(event, &loc_eng_data, context,
+ (MsgTask::tCreate)callbacks->create_thread_cb);
+
+ LOC_LOGD("loc_eng_init created client, id = %p\n",
+ loc_eng_data.adapter);
+ loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngGnssConstellationConfig(adapter));
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE,
+ sap_conf.SENSOR_PROVIDER));
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+
+ /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
+ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) {
+ adapter->sendMsg(new LocEngSensorProperties(adapter,
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sap_conf.GYRO_BIAS_RANDOM_WALK,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY));
+ }
+
+ adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter,
+ sap_conf.SENSOR_CONTROL_MODE,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK));
+
+ adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0)));
+
+ loc_eng_xtra_version_check(loc_eng_data, gps_conf.XTRA_VERSION_CHECK);
+
+ LOC_LOGD("loc_eng_reinit reinit() successful");
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // XTRA has no state, so we are fine with it.
+
+ // we need to check and clear NI
+#if 0
+ // we need to check and clear ATL
+ if (NULL != loc_eng_data.agnss_nif) {
+ delete loc_eng_data.agnss_nif;
+ loc_eng_data.agnss_nif = NULL;
+ }
+ if (NULL != loc_eng_data.internet_nif) {
+ delete loc_eng_data.internet_nif;
+ loc_eng_data.internet_nif = NULL;
+ }
+#endif
+ if (loc_eng_data.adapter->isInSession())
+ {
+ LOC_LOGD("loc_eng_cleanup: fix not stopped. stop it now.");
+ loc_eng_stop(loc_eng_data);
+ }
+
+#if 0 // can't afford to actually clean up, for many reason.
+
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ delete loc_eng_data.adapter;
+ loc_eng_data.adapter = NULL;
+
+ loc_eng_dmn_conn_loc_api_server_unblock();
+ loc_eng_dmn_conn_loc_api_server_join();
+
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (!loc_eng_data.adapter->isInSession()) {
+ ret_val = loc_eng_data.adapter->startFix();
+
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS ||
+ ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN ||
+ ret_val == LOC_API_ADAPTER_ERR_PHONE_OFFLINE ||
+ ret_val == LOC_API_ADAPTER_ERR_INTERNAL)
+ {
+ loc_eng_data.adapter->setInSession(TRUE);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_stop_wrapper
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (loc_eng_data.adapter->isInSession()) {
+
+ ret_val = loc_eng_data.adapter->stopFix();
+ loc_eng_data.adapter->setInSession(FALSE);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
+
+DESCRIPTION
+ Mutes one session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: Success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ // The position mode for AUTO/GSS/QCA1530 can only be standalone
+ if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) &&
+ !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
+ (params.mode != LOC_POSITION_MODE_STANDALONE)) {
+ params.mode = LOC_POSITION_MODE_STANDALONE;
+ LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530.");
+ }
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
+ {
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngPositionMode(adapter, params));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
+ int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
+ uncertainty));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
+ double longitude, float accuracy)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ if(adapter->mSupportsPositionInjection)
+ {
+ adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
+ accuracy));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData f)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+
+ if (loc_eng_data.status_cb)
+ {
+ GpsStatus gs = { sizeof(gs),status };
+ CALLBACK_LOG_CALLFLOW("status_cb", %s,
+ loc_get_gps_status_name(gs.status));
+ loc_eng_data.status_cb(&gs);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ UlpLocation location;
+ LocPosTechMask tech_mask = LOC_POS_TECH_MASK_DEFAULT;
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+
+ ret_val = loc_eng_data.adapter->getZpp(location.gpsLocation, tech_mask);
+ //Mark the location source as from ZPP
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_ZPP;
+
+ loc_eng_data.adapter->getUlpProxy()->reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_SUCCESS,
+ tech_mask);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*
+ Callback function passed to Data Services State Machine
+ This becomes part of the state machine's servicer and
+ is used to send requests to the data services client
+*/
+static int dataCallCb(void *cb_data)
+{
+ LOC_LOGD("Enter dataCallCb\n");
+ int ret=0;
+ if(cb_data != NULL) {
+ dsCbData *cbData = (dsCbData *)cb_data;
+ LocEngAdapter *locAdapter = (LocEngAdapter *)cbData->mAdapter;
+ if(cbData->action == GPS_REQUEST_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_REQUEST_AGPS_DATA_CONN\n");
+ ret = locAdapter->openAndStartDataCall();
+ }
+ else if(cbData->action == GPS_RELEASE_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_RELEASE_AGPS_DATA_CONN\n");
+ locAdapter->stopDataCall();
+ }
+ }
+ else {
+ LOC_LOGE("NULL argument received. Failing.\n");
+ ret = -1;
+ goto err;
+ }
+
+err:
+ LOC_LOGD("Exit dataCallCb ret = %d\n", ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_reinit
+
+DESCRIPTION
+ 2nd half of loc_eng_agps_init(), singled out for modem restart to use.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+
+ // Set server addresses which came before init
+ if (loc_eng_data.supl_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_SUPL_SERVER,
+ loc_eng_data.supl_host_buf,
+ loc_eng_data.supl_port_buf);
+ }
+
+ if (loc_eng_data.c2k_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_CDMA_PDE_SERVER,
+ loc_eng_data.c2k_host_buf,
+ loc_eng_data.c2k_port_buf);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+ STATE_CHECK((NULL == loc_eng_data.agps_status_cb),
+ "agps instance already initialized",
+ return);
+ if (callbacks == NULL) {
+ LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks);
+ EXIT_LOG(%s, VOID_RET);
+ return;
+ }
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WWAN_ANY,
+ false);
+ loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WIFI,
+ true);
+
+ if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
+ (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) {
+ loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_SUPL,
+ false);
+
+ if (adapter->mSupportsAgpsRequests) {
+ if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data));
+ }
+ loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
+ NULL, NULL, &loc_eng_data);
+ }
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void deleteAidingData(loc_eng_data_s_type &logEng) {
+ if (logEng.engine_status != GPS_STATUS_ENGINE_ON &&
+ logEng.aiding_data_for_deletion != 0) {
+ logEng.adapter->deleteAidingData(logEng.aiding_data_for_deletion);
+ logEng.aiding_data_for_deletion = 0;
+ }
+}
+
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
+ AgpsStateMachine* stateMachine;
+ switch (agpsType) {
+ case AGPS_TYPE_WIFI: {
+ stateMachine = locEng.wifi_nif;
+ break;
+ }
+ case AGPS_TYPE_INVALID:
+ case AGPS_TYPE_SUPL: {
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ case AGPS_TYPE_SUPL_ES: {
+ locEng.ds_nif ?
+ stateMachine = locEng.ds_nif:
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ default:
+ stateMachine = locEng.internet_nif;
+ }
+ return stateMachine;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ if (apn == NULL)
+ {
+ LOC_LOGE("APN Name NULL\n");
+ return 0;
+ }
+
+ LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
+
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+
+ loc_eng_data.adapter->sendMsg(
+ new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform engine about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION resolve_in_addr
+
+DESCRIPTION
+ Translates a hostname to in_addr struct
+
+DEPENDENCIES
+ n/a
+
+RETURN VALUE
+ TRUE if successful
+
+SIDE EFFECTS
+ n/a
+
+===========================================================================*/
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
+{
+ ENTRY_LOG();
+ boolean ret_val = TRUE;
+
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ ret_val = FALSE;
+ }
+ }
+
+ EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server
+
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ int ret = 0;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ char url[MAX_URL_LEN];
+ unsigned int len = 0;
+ const char nohost[] = "NONE";
+ if (hostname == NULL ||
+ strncasecmp(nohost, hostname, sizeof(nohost)) == 0) {
+ url[0] = NULL;
+ } else {
+ len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port);
+ }
+
+ if (sizeof(url) > len) {
+ adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len));
+ }
+ } else if (LOC_AGPS_CDMA_PDE_SERVER == type ||
+ LOC_AGPS_CUSTOM_PDE_SERVER == type ||
+ LOC_AGPS_MPC_SERVER == type) {
+ struct in_addr addr;
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ ret = -2;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ adapter->sendMsg(new LocEngSetServerIpv4(adapter, ip, port, type));
+ }
+ } else {
+ LOC_LOGE("loc_eng_set_server, type %d cannot be resolved.\n", type);
+ }
+
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server_proxy
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type,
+ const char* hostname, int port)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = 0;
+
+ if (NULL != loc_eng_data.adapter)
+ {
+ ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port);
+ } else {
+ LOC_LOGW("set_server called before init. save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case LOC_AGPS_SUPL_SERVER:
+ strlcpy(loc_eng_data.supl_host_buf, hostname,
+ sizeof(loc_eng_data.supl_host_buf));
+ loc_eng_data.supl_port_buf = port;
+ loc_eng_data.supl_host_set = 1;
+ break;
+ case LOC_AGPS_CDMA_PDE_SERVER:
+ strlcpy(loc_eng_data.c2k_host_buf, hostname,
+ sizeof(loc_eng_data.c2k_host_buf));
+ loc_eng_data.c2k_port_buf = port;
+ loc_eng_data.c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int available, const char* apn)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ //This is to store the status of data availability over the network.
+ //If GPS is not enabled, the INIT_CHECK will fail and the modem will
+ //not be updated with the network's availability. Since the data status
+ //can change before GPS is enabled the, storing the status will enable
+ //us to inform the modem after GPS is enabled
+ agpsStatus = available;
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+ if (apn != NULL)
+ {
+ LOC_LOGD("loc_eng_agps_ril_update_network_availability: APN Name = [%s]\n", apn);
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngEnableData(adapter, apn, apn_len, available));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t numberOfCerts)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+
+ uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK;
+ uint32_t slotCount = 0;
+ for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) {
+ slotBitMaskCounter &= slotBitMaskCounter - 1;
+ }
+ LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u",
+ slotBitMask, slotCount, numberOfCerts);
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (numberOfCerts == 0) {
+ LOC_LOGE("No certs to install, since numberOfCerts is zero");
+ ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+ } else if (!adapter) {
+ LOC_LOGE("adapter is null!");
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ } else if (slotCount < numberOfCerts) {
+ LOC_LOGE("Not enough cert slots (%u) to install %u certs!",
+ slotCount, numberOfCerts);
+ ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES;
+ } else {
+ for (int i=0; i < numberOfCerts; ++i)
+ {
+ if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) {
+ LOC_LOGE("cert#(%u) length of %u is too big! greater than %u",
+ certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH);
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ break;
+ }
+ }
+
+ if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) {
+ adapter->sendMsg(new LocEngInstallAGpsCert(adapter,
+ certificates,
+ numberOfCerts,
+ slotBitMask));
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if (config_data && length > 0) {
+ loc_gps_cfg_s_type gps_conf_tmp = gps_conf;
+ UTIL_UPDATE_CONF(config_data, length, gps_conf_table);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ // it is possible that HAL is not init'ed at this time
+ if (adapter) {
+ if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) {
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ }
+ if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) {
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ }
+ if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) {
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter,
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+ }
+ if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) {
+ adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy()));
+ }
+ }
+
+ gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER;
+ gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE;
+ gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT;
+ gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK;
+ gps_conf = gps_conf_tmp;
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+ // Switch from WAIT to MUTE, for "engine on" or "session begin" event
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+
+ // Switch off MUTE session
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION &&
+ (status == GPS_STATUS_SESSION_END || status == GPS_STATUS_ENGINE_OFF))
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+
+ // Session End is not reported during Android navigating state
+ boolean navigating = loc_eng_data.adapter->isInSession();
+ if (status != GPS_STATUS_NONE &&
+ !(status == GPS_STATUS_SESSION_END && navigating) &&
+ !(status == GPS_STATUS_SESSION_BEGIN && !navigating))
+ {
+ if (loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ // Inform GpsLocationProvider about mNavigating status
+ loc_inform_gps_status(loc_eng_data, status);
+ }
+ else {
+ LOC_LOGD("loc_eng_report_status: muting the status report.");
+ }
+ }
+
+ // Only keeps ENGINE ON/OFF in engine_status
+ if (status == GPS_STATUS_ENGINE_ON || status == GPS_STATUS_ENGINE_OFF)
+ {
+ loc_eng_data.engine_status = status;
+ }
+
+ // Only keeps SESSION BEGIN/END in fix_session_status
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = status;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_engine_down
+ loc_eng_handle_engine_up
+
+DESCRIPTION
+ Calls this function when it is detected that modem restart is happening.
+ Either we detected the modem is down or received modem up event.
+ This must be called from the deferred thread to avoid race condition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_reset_on_engine_restart(loc_eng_data);
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_OFF);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_reinit(loc_eng_data);
+
+ loc_eng_data.adapter->requestPowerVote();
+
+ if (loc_eng_data.agps_status_cb != NULL) {
+ if (loc_eng_data.agnss_nif)
+ loc_eng_data.agnss_nif->dropAllSubscribers();
+ if (loc_eng_data.internet_nif)
+ loc_eng_data.internet_nif->dropAllSubscribers();
+
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ // modem is back up. If we crashed in the middle of navigating, we restart.
+ if (loc_eng_data.adapter->isInSession()) {
+ // This sets the copy in adapter to modem
+ loc_eng_data.adapter->setPositionMode(NULL);
+ loc_eng_data.adapter->setInSession(false);
+ loc_eng_start_handler(loc_eng_data);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+#ifdef USE_GLIB
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+#endif /* USE_GLIB */
+
+/*===========================================================================
+FUNCTION loc_eng_read_config
+
+DESCRIPTION
+ Initiates the reading of the gps config file stored in /etc dir
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_read_config(void)
+{
+ ENTRY_LOG_CALLFLOW();
+ if(configAlreadyRead == false)
+ {
+ // Initialize our defaults before reading of configuration file overwrites them.
+ loc_default_parameters();
+ // We only want to parse the conf file once. This is a good place to ensure that.
+ // In fact one day the conf file should go into context.
+ UTIL_READ_CONF(GPS_CONF_FILE, gps_conf_table);
+ UTIL_READ_CONF(SAP_CONF_FILE, sap_conf_table);
+ configAlreadyRead = true;
+ } else {
+ LOC_LOGV("GPS Config file has already been read\n");
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_init
+
+DESCRIPTION
+ Initialize gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb),
+ "gps measurement already initialized",
+ return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
+ STATE_CHECK((callbacks != NULL),
+ "callbacks can not be NULL",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+ STATE_CHECK(loc_eng_data.adapter,
+ "GpsInterface must be initialized first",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_ENABLED));
+ // set up the callback
+ loc_eng_data.gps_measurement_cb = callbacks->measurement_callback;
+ LOC_LOGD ("%s, event masks updated successfully", __func__);
+
+ return GPS_MEASUREMENT_OPERATION_SUCCESS;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_close
+
+DESCRIPTION
+ Close gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_DISABLED));
+ // set up the callback
+ loc_eng_data.gps_measurement_cb = NULL;
+ EXIT_LOG(%d, 0);
+}
diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h
new file mode 100644
index 0000000..a203e6b
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng.h
@@ -0,0 +1,270 @@
+/* Copyright (c) 2009-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_ENG_H
+#define LOC_ENG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+#define MAX_NUM_ATL_CONNECTIONS 2
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc.h>
+#include <loc_eng_xtra.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_agps.h>
+#include <loc_cfg.h>
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_eng_agps.h>
+#include <LocEngAdapter.h>
+
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+#define SUCCESS TRUE
+#define FAILURE FALSE
+#define INVALID_ATL_CONNECTION_HANDLE -1
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+enum loc_nmea_provider_e_type {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+};
+
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE = 0,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
+// Module data
+typedef struct loc_eng_data_s
+{
+ LocEngAdapter *adapter;
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ agps_status_extended agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_request_utc_time request_utc_time_cb;
+ gps_measurement_callback gps_measurement_cb;
+ boolean intermediateFix;
+ AGpsStatusValue agps_status;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ loc_eng_ni_data_s_type loc_eng_ni_data;
+
+ // AGPS state machines
+ AgpsStateMachine* agnss_nif;
+ AgpsStateMachine* internet_nif;
+ AgpsStateMachine* wifi_nif;
+ //State machine for Data Services
+ AgpsStateMachine* ds_nif;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // For muting session broadcast
+ loc_mute_session_e_type mute_session_state;
+
+ // For nmea generation
+ boolean generateNmea;
+ uint32_t sv_used_mask;
+ float hdop;
+ float pdop;
+ float vdop;
+
+ // Address buffers, for addressing setting before init
+ int supl_host_set;
+ char supl_host_buf[101];
+ int supl_port_buf;
+ int c2k_host_set;
+ char c2k_host_buf[101];
+ int c2k_port_buf;
+ int mpc_host_set;
+ char mpc_host_buf[101];
+ int mpc_port_buf;
+
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+} loc_eng_data_s_type;
+
+/* 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 CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t XTRA_VERSION_CHECK;
+ char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} loc_sap_cfg_s_type;
+
+extern loc_gps_cfg_s_type gps_conf;
+extern loc_sap_cfg_s_type sap_conf;
+
+
+uint32_t getCarrierCapabilities();
+
+//loc_eng functions
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
+ LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event,
+ ContextBase* context);
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data,
+ GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
+ double latitude, double longitude,
+ float accuracy);
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
+ GpsAidingData f);
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms);
+const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
+ const char* name);
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_read_config(void);
+
+//loc_eng_agps functions
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
+ AGpsExtCallbacks* callbacks);
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType);
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int avaiable, const char* apn);
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t length);
+
+//loc_eng_xtra functions
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks);
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length);
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, int check);
+
+//loc_eng_ni functions
+extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data,
+ GpsNiExtCallbacks *callbacks);
+extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response);
+extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough);
+extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length);
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks);
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // LOC_ENG_H
diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp
new file mode 100644
index 0000000..5016b5c
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -0,0 +1,970 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng_agps.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <platform_lib_includes.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_dmn_conn.h>
+#include <sys/time.h>
+
+//======================================================================
+// C callbacks
+//======================================================================
+
+// This is given to linked_list_add as the dealloc callback
+// data -- an instance of Subscriber
+static void deleteObj(void* data)
+{
+ delete (Subscriber*)data;
+}
+
+// This is given to linked_list_search() as the comparison callback
+// when the state manchine needs to process for particular subscriber
+// fromCaller -- caller provides this obj
+// fromList -- linked_list_search() function take this one from list
+static bool hasSubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ return s1->forMe(*notification);
+}
+
+// This is gvien to linked_list_search() to notify subscriber objs
+// when the state machine needs to inform all subscribers of resource
+// status changes, e.g. when resource is GRANTED.
+// fromCaller -- caller provides this ptr to a Notification obj.
+// fromList -- linked_list_search() function take this one from list
+static bool notifySubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ // we notify every subscriber indiscriminatively
+ // each subscriber decides if this notification is interesting.
+ return s1->notifyRsrcStatus(*notification) &&
+ // if we do not want to delete the subscriber from the
+ // the list, we must set this to false so this function
+ // returns false
+ notification->postNotifyDelete;
+}
+
+//======================================================================
+// Notification
+//======================================================================
+const int Notification::BROADCAST_ALL = 0x80000000;
+const int Notification::BROADCAST_ACTIVE = 0x80000001;
+const int Notification::BROADCAST_INACTIVE = 0x80000002;
+const unsigned char DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const unsigned int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+//======================================================================
+// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
+//======================================================================
+bool Subscriber::forMe(Notification ¬ification)
+{
+ if (NULL != notification.rcver) {
+ return equals(notification.rcver);
+ } else {
+ return Notification::BROADCAST_ALL == notification.groupID ||
+ (Notification::BROADCAST_ACTIVE == notification.groupID &&
+ !isInactive()) ||
+ (Notification::BROADCAST_INACTIVE == notification.groupID &&
+ isInactive());
+ }
+}
+bool BITSubscriber::equals(const Subscriber *s) const
+{
+ BITSubscriber* bitS = (BITSubscriber*)s;
+
+ return (ID == bitS->ID &&
+ (INADDR_NONE != (unsigned int)ID ||
+ 0 == strncmp(mIPv6Addr, bitS->mIPv6Addr, sizeof(mIPv6Addr))));
+}
+
+bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ ((LocEngAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_DENIED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ case RSRC_GRANTED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ break;
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+bool DSSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+ LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
+ if(notify) {
+ switch(notification.rsrcStatus) {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ case RSRC_GRANTED:
+ ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
+ break;
+ default:
+ notify = false;
+ }
+ }
+ return notify;
+}
+void DSSubscriber :: setInactive()
+{
+ mIsInactive = true;
+ ((DSStateMachine *)mStateMachine)->informStatus(RSRC_UNSUBSCRIBE, ID);
+}
+//======================================================================
+// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
+//======================================================================
+
+// AgpsReleasedState
+class AgpsReleasedState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasedState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasedState = this; }
+
+ inline ~AgpsReleasedState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasedState";}
+};
+
+AgpsState* AgpsReleasedState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ LOC_LOGD("AgpsReleasedState::onRsrcEvent; event:%d\n", (int)event);
+ if (mStateMachine->hasSubscribers()) {
+ LOC_LOGE("Error: %s subscriber list not empty!!!", whoami());
+ // I don't know how to recover from it. I am adding this rather
+ // for debugging purpose.
+ }
+
+ AgpsState* nextState = this;
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // no notification until we get RSRC_GRANTED
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // request from connecivity service for NIF
+ //The if condition is added so that if the data call setup fails
+ //for DS State Machine, we want to retry in released state.
+ //for AGps State Machine, sendRsrcRequest() will always return success
+ if(!mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN)) {
+ // move the state to PENDING
+ nextState = mPendingState;
+ }
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ // the list should really be empty, nothing to remove.
+ // but we might as well just tell the client it is
+ // unsubscribed. False tolerance, right?
+ Subscriber* subscriber = (Subscriber*) data;
+ Notification notification(subscriber, event, false);
+ subscriber->notifyRsrcStatus(notification);
+ }
+ // break;
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ default:
+ LOC_LOGW("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ break;
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsPendingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsPendingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mPendingState = this; }
+
+ inline ~AgpsPendingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsPendingState";}
+};
+
+AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsPendingState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_ACTIVE, event, false);
+ // notify all subscribers NIF resource GRANTED
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_RELEASED:
+ // no state change.
+ // we are expecting either GRANTED or DENIED. Handling RELEASED
+ // may like break our state machine in race conditions.
+ break;
+
+ case RSRC_DENIED:
+ {
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // notify all subscribers NIF resource RELEASED or DENIED
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+
+class AgpsAcquiredState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsAcquiredState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mAcquiredState = this; }
+
+ inline ~AgpsAcquiredState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() { return (char*)"AgpsAcquiredState"; }
+};
+
+
+AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;
+ LOC_LOGD("AgpsAcquiredState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // we already have the NIF resource, simply notify subscriber
+ Subscriber* subscriber = (Subscriber*) data;
+ // we have rsrc in hand, so grant it right away
+ Notification notification(subscriber, RSRC_GRANTED, false);
+ subscriber->notifyRsrcStatus(notification);
+ // add subscriber to the list
+ mStateMachine->addSubscriber(subscriber);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ LOC_LOGW("%s: %d, RSRC_GRANTED already received", whoami(), event);
+ // no state change.
+ break;
+
+ case RSRC_RELEASED:
+ {
+ LOC_LOGW("%s: %d, a force rsrc release", whoami(), event);
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_DENIED:
+ // no state change.
+ // we are expecting RELEASED. Handling DENIED
+ // may like break our state machine in race conditions.
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsReleasingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasingState = this; }
+
+ inline ~AgpsReleasingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasingState";}
+};
+
+AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsReleasingState::onRsrcEvent; event:%d\n", (int)event);
+
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_DENIED:
+ // A race condition subscriber unsubscribes before AFW denies resource.
+ case RSRC_RELEASED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_INACTIVE, event, true);
+ // notify all subscribers that are active NIF resource RELEASE
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+
+ if (mStateMachine->hasActiveSubscribers()) {
+ nextState = mPendingState;
+ // request from connecivity service for NIF
+ mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN);
+ } else {
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+//======================================================================
+//Servicer
+//======================================================================
+Servicer* Servicer :: getServicer(servicerType type, void *cb_func)
+{
+ LOC_LOGD(" Enter getServicer type:%d\n", (int)type);
+ switch(type) {
+ case servicerTypeNoCbParam:
+ return (new Servicer(cb_func));
+ case servicerTypeExt:
+ return (new ExtServicer(cb_func));
+ case servicerTypeAgps:
+ return (new AGpsServicer(cb_func));
+ default:
+ return NULL;
+ }
+}
+
+int Servicer :: requestRsrc(void *cb_data)
+{
+ callback();
+ return 0;
+}
+
+int ExtServicer :: requestRsrc(void *cb_data)
+{
+ int ret=-1;
+ LOC_LOGD("Enter ExtServicer :: requestRsrc\n");
+ ret = callbackExt(cb_data);
+ LOC_LOGD("Exit ExtServicer :: requestRsrc\n");
+ return(ret);
+}
+
+int AGpsServicer :: requestRsrc(void *cb_data)
+{
+ callbackAGps((AGpsStatus *)cb_data);
+ return 0;
+}
+
+//======================================================================
+// AgpsStateMachine
+//======================================================================
+
+AgpsStateMachine::AgpsStateMachine(servicerType servType,
+ void *cb_func,
+ AGpsExtType type,
+ bool enforceSingleSubscriber) :
+ mStatePtr(new AgpsReleasedState(this)),mType(type),
+ mAPN(NULL),
+ mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID),
+ mEnforceSingleSubscriber(enforceSingleSubscriber),
+ mServicer(Servicer :: getServicer(servType, (void *)cb_func))
+{
+ linked_list_init(&mSubscribers);
+
+ // setting up mReleasedState
+ mStatePtr->mPendingState = new AgpsPendingState(this);
+ mStatePtr->mAcquiredState = new AgpsAcquiredState(this);
+ mStatePtr->mReleasingState = new AgpsReleasingState(this);
+
+ // setting up mAcquiredState
+ mStatePtr->mAcquiredState->mReleasedState = mStatePtr;
+ mStatePtr->mAcquiredState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mAcquiredState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mPendingState
+ mStatePtr->mPendingState->mAcquiredState = mStatePtr->mAcquiredState;
+ mStatePtr->mPendingState->mReleasedState = mStatePtr;
+ mStatePtr->mPendingState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mReleasingState
+ mStatePtr->mReleasingState->mReleasedState = mStatePtr;
+ mStatePtr->mReleasingState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mReleasingState->mAcquiredState = mStatePtr->mAcquiredState;
+}
+
+AgpsStateMachine::~AgpsStateMachine()
+{
+ dropAllSubscribers();
+
+ // free the 3 states. We must read out all 3 pointers first.
+ // Otherwise we run the risk of getting pointers from already
+ // freed memory.
+ AgpsState* acquiredState = mStatePtr->mAcquiredState;
+ AgpsState* releasedState = mStatePtr->mReleasedState;
+ AgpsState* pendindState = mStatePtr->mPendingState;
+ AgpsState* releasingState = mStatePtr->mReleasingState;
+
+ delete acquiredState;
+ delete releasedState;
+ delete pendindState;
+ delete releasingState;
+ delete mServicer;
+ linked_list_destroy(&mSubscribers);
+
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ mAPN = NULL;
+ }
+}
+
+void AgpsStateMachine::setAPN(const char* apn, unsigned int len)
+{
+ if (NULL != mAPN) {
+ delete mAPN;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ memcpy(mAPN, apn, len);
+ mAPN[len] = NULL;
+
+ mAPNLen = len;
+ } else {
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+}
+
+void AgpsStateMachine::onRsrcEvent(AgpsRsrcStatus event)
+{
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+}
+
+void AgpsStateMachine::notifySubscribers(Notification& notification) const
+{
+ if (notification.postNotifyDelete) {
+ // just any non NULL value to get started
+ Subscriber* s = (Subscriber*)~0;
+ while (NULL != s) {
+ s = NULL;
+ // if the last param sets to true, _search will delete
+ // the node from the list for us. But the problem is
+ // once that is done, _search returns, leaving the
+ // rest of the list unprocessed. So we need a loop.
+ linked_list_search(mSubscribers, (void**)&s, notifySubscriber,
+ (void*)¬ification, true);
+ delete s;
+ }
+ } else {
+ // no loop needed if it the last param sets to false, which
+ // mean nothing gets deleted from the list.
+ linked_list_search(mSubscribers, NULL, notifySubscriber,
+ (void*)¬ification, false);
+ }
+}
+
+void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL == s) {
+ linked_list_add(mSubscribers, subscriber->clone(), deleteObj);
+ }
+}
+
+int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+
+ if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) {
+ AGpsExtStatus nifRequest;
+ nifRequest.size = sizeof(nifRequest);
+ nifRequest.type = mType;
+ nifRequest.status = action;
+
+ if (s == NULL) {
+ nifRequest.ipv4_addr = INADDR_NONE;
+ memset(&nifRequest.addr, 0, sizeof(nifRequest.addr));
+ nifRequest.ssid[0] = '\0';
+ nifRequest.password[0] = '\0';
+ } else {
+ s->setIPAddresses(nifRequest.addr);
+ s->setWifiInfo(nifRequest.ssid, nifRequest.password);
+ }
+
+ CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
+ mServicer->requestRsrc((void *)&nifRequest);
+ }
+ return 0;
+}
+
+void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
+{
+ if (mEnforceSingleSubscriber && hasSubscribers()) {
+ Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
+ notifySubscriber(¬ification, subscriber);
+ } else {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
+ }
+}
+
+bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL != s) {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_UNSUBSCRIBE, (void*)s);
+ return true;
+ }
+ return false;
+}
+
+bool AgpsStateMachine::hasActiveSubscribers() const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+ return NULL != s;
+}
+
+//======================================================================
+// DSStateMachine
+//======================================================================
+void delay_callback(void *callbackData, int result)
+{
+ if(callbackData) {
+ DSStateMachine *DSSMInstance = (DSStateMachine *)callbackData;
+ DSSMInstance->retryCallback();
+ }
+ else {
+ LOC_LOGE(" NULL argument received. Failing.\n");
+ goto err;
+ }
+err:
+ return;
+}
+
+DSStateMachine :: DSStateMachine(servicerType type, void *cb_func,
+ LocEngAdapter* adapterHandle):
+ AgpsStateMachine(type, cb_func, AGPS_TYPE_INVALID,false),
+ mLocAdapter(adapterHandle)
+{
+ LOC_LOGD("%s:%d]: New DSStateMachine\n", __func__, __LINE__);
+ mRetries = 0;
+}
+
+void DSStateMachine :: retryCallback(void)
+{
+ DSSubscriber *subscriber = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&subscriber, hasSubscriber,
+ (void*)¬ification, false);
+ if(subscriber)
+ mLocAdapter->requestSuplES(subscriber->ID);
+ else
+ LOC_LOGE("DSStateMachine :: retryCallback: No subscriber found." \
+ "Cannot retry data call\n");
+ return;
+}
+
+int DSStateMachine :: sendRsrcRequest(AGpsStatusValue action) const
+{
+ DSSubscriber* s = NULL;
+ dsCbData cbData;
+ int ret=-1;
+ int connHandle=-1;
+ LOC_LOGD("Enter DSStateMachine :: sendRsrcRequest\n");
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+ if(s) {
+ connHandle = s->ID;
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - subscriber found\n");
+ }
+ else
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - No subscriber found\n");
+
+ cbData.action = action;
+ cbData.mAdapter = mLocAdapter;
+ ret = mServicer->requestRsrc((void *)&cbData);
+ //Only the request to start data call returns a success/failure
+ //The request to stop data call will always succeed
+ //Hence, the below block will only be executed when the
+ //request to start the data call fails
+ switch(ret) {
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - Failure returned: %d\n",ret);
+ ((DSStateMachine *)this)->incRetries();
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+ LOC_LOGE(" Failed to start Data call. Fallback to normal ATL SUPL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ }
+ else {
+ if(loc_timer_start(DATA_CALL_RETRY_DELAY_MSEC, delay_callback, (void *)this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ ret = -1;
+ goto err;
+ }
+ }
+ break;
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No profile found for emergency call. Fallback to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("%s:%d]: Request to start data call sent\n", __func__, __LINE__);
+ break;
+ case -1:
+ //One of the ways this case can be encountered is if the callback function
+ //receives a null argument, it just exits with -1 error
+ LOC_LOGE("Error: Something went wrong somewhere. Falling back to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Unrecognized return value\n", __func__, __LINE__);
+ }
+err:
+ LOC_LOGD("EXIT DSStateMachine :: sendRsrcRequest; ret = %d\n", ret);
+ return ret;
+}
+
+void DSStateMachine :: onRsrcEvent(AgpsRsrcStatus event)
+{
+ void* currState = (void *)mStatePtr;
+ LOC_LOGD("Enter DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_GRANTED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ case RSRC_RELEASED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_RELEASED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ //To handle the case where we get a RSRC_RELEASED in
+ //pending state, we translate that to a RSRC_DENIED state
+ //since the callback from DSI is either RSRC_GRANTED or RSRC_RELEASED
+ //for when the call is connected or disconnected respectively.
+ if((void *)mStatePtr != currState)
+ break;
+ else {
+ event = RSRC_DENIED;
+ LOC_LOGE(" Switching event to RSRC_DENIED\n");
+ }
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+ LOC_LOGD("Exit DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+}
+
+void DSStateMachine :: informStatus(AgpsRsrcStatus status, int ID) const
+{
+ LOC_LOGD("DSStateMachine :: informStatus. Status=%d\n",(int)status);
+ switch(status) {
+ case RSRC_UNSUBSCRIBE:
+ mLocAdapter->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_RELEASED:
+ mLocAdapter->closeDataCall();
+ break;
+ case RSRC_DENIED:
+ ((DSStateMachine *)this)->mRetries = 0;
+ mLocAdapter->requestATL(ID, AGPS_TYPE_SUPL);
+ break;
+ case RSRC_GRANTED:
+ mLocAdapter->atlOpenStatus(ID, 1,
+ NULL,
+ AGPS_APN_BEARER_INVALID,
+ AGPS_TYPE_INVALID);
+ break;
+ default:
+ LOC_LOGW("DSStateMachine :: informStatus - unknown status");
+ }
+ return;
+}
diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h
new file mode 100644
index 0000000..2d689ce
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -0,0 +1,431 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_ENG_AGPS_H__
+#define __LOC_ENG_AGPS_H__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_core_log.h>
+#include <linked_list.h>
+#include <loc_timer.h>
+#include <LocEngAdapter.h>
+
+// forward declaration
+class AgpsStateMachine;
+class Subscriber;
+
+// NIF resource events
+typedef enum {
+ RSRC_SUBSCRIBE,
+ RSRC_UNSUBSCRIBE,
+ RSRC_GRANTED,
+ RSRC_RELEASED,
+ RSRC_DENIED,
+ RSRC_STATUS_MAX
+} AgpsRsrcStatus;
+
+typedef enum {
+ servicerTypeNoCbParam,
+ servicerTypeAgps,
+ servicerTypeExt
+}servicerType;
+
+//DS Callback struct
+typedef struct {
+ LocEngAdapter *mAdapter;
+ AGpsStatusValue action;
+}dsCbData;
+
+// information bundle for subscribers
+struct Notification {
+ // goes to every subscriber
+ static const int BROADCAST_ALL;
+ // goes to every ACTIVE subscriber
+ static const int BROADCAST_ACTIVE;
+ // goes to every INACTIVE subscriber
+ static const int BROADCAST_INACTIVE;
+
+ // go to a specific subscriber
+ const Subscriber* rcver;
+ // broadcast
+ const int groupID;
+ // the new resource status event
+ const AgpsRsrcStatus rsrcStatus;
+ // should the subscriber be deleted after the notification
+ const bool postNotifyDelete;
+
+ // convenient constructor
+ inline Notification(const int broadcast,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(subscriber), groupID(-1), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const int broadcast) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber) :
+ rcver(subscriber), groupID(-1), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+};
+
+class AgpsState {
+ // allows AgpsStateMachine to access private data
+ // no class members are public. We don't want
+ // anyone but state machine to use state.
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+ // state transitions are done here.
+ // Each state implements its own transitions (of course).
+ inline virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data) = 0;
+
+protected:
+ // handle back to state machine
+ const AgpsStateMachine* mStateMachine;
+ // each state has pointers to all 3 states
+ // one of which is to itself.
+ AgpsState* mReleasedState;
+ AgpsState* mAcquiredState;
+ AgpsState* mPendingState;
+ AgpsState* mReleasingState;
+
+ inline AgpsState(const AgpsStateMachine *stateMachine) :
+ mStateMachine(stateMachine),
+ mReleasedState(NULL),
+ mAcquiredState(NULL),
+ mPendingState(NULL),
+ mReleasingState(NULL) {}
+ virtual ~AgpsState() {}
+
+public:
+ // for logging purpose
+ inline virtual char* whoami() = 0;
+};
+
+class Servicer {
+ void (*callback)(void);
+public:
+ static Servicer* getServicer(servicerType type, void *cb_func);
+ virtual int requestRsrc(void *cb_data);
+ Servicer() {}
+ Servicer(void *cb_func)
+ { callback = (void(*)(void))(cb_func); }
+ virtual ~Servicer(){}
+ inline virtual char *whoami() {return (char*)"Servicer";}
+};
+
+class ExtServicer : public Servicer {
+ int (*callbackExt)(void *cb_data);
+public:
+ int requestRsrc(void *cb_data);
+ ExtServicer() {}
+ ExtServicer(void *cb_func)
+ { callbackExt = (int(*)(void *))(cb_func); }
+ virtual ~ExtServicer(){}
+ inline virtual char *whoami() {return (char*)"ExtServicer";}
+};
+
+class AGpsServicer : public Servicer {
+ void (*callbackAGps)(AGpsStatus* status);
+public:
+ int requestRsrc(void *cb_data);
+ AGpsServicer() {}
+ AGpsServicer(void *cb_func)
+ { callbackAGps = (void(*)(AGpsStatus *))(cb_func); }
+ virtual ~AGpsServicer(){}
+ inline virtual char *whoami() {return (char*)"AGpsServicer";}
+};
+
+class AgpsStateMachine {
+protected:
+ // a linked list of subscribers.
+ void* mSubscribers;
+ //handle to whoever provides the service
+ Servicer *mServicer;
+ // allows AgpsState to access private data
+ // each state is really internal data to the
+ // state machine, so it should be able to
+ // access anything within the state machine.
+ friend class AgpsState;
+ // pointer to the current state.
+ AgpsState* mStatePtr;
+private:
+ // NIF type: AGNSS or INTERNET.
+ const AGpsExtType mType;
+ // apn to the NIF. Each state machine tracks
+ // resource state of a particular NIF. For each
+ // NIF, there is also an active APN.
+ char* mAPN;
+ // for convenience, we don't do strlen each time.
+ unsigned int mAPNLen;
+ // bear
+ AGpsBearerType mBearer;
+ // ipv4 address for routing
+ bool mEnforceSingleSubscriber;
+
+public:
+ AgpsStateMachine(servicerType servType, void *cb_func,
+ AGpsExtType type, bool enforceSingleSubscriber);
+ virtual ~AgpsStateMachine();
+
+ // self explanatory methods below
+ void setAPN(const char* apn, unsigned int len);
+ inline const char* getAPN() const { return (const char*)mAPN; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return (AGpsExtType)mType; }
+
+ // someone, a ATL client or BIT, is asking for NIF
+ void subscribeRsrc(Subscriber *subscriber);
+
+ // someone, a ATL client or BIT, is done with NIF
+ bool unsubscribeRsrc(Subscriber *subscriber);
+
+ // add a subscriber in the linked list, if not already there.
+ void addSubscriber(Subscriber* subscriber) const;
+
+ virtual void onRsrcEvent(AgpsRsrcStatus event);
+
+ // put the data together and send the FW
+ virtual int sendRsrcRequest(AGpsStatusValue action) const;
+
+ //if list is empty, linked_list_empty returns 1
+ //else if list is not empty, returns 0
+ //so hasSubscribers() returns 1 if list is not empty
+ //and returns 0 if list is empty
+ inline bool hasSubscribers() const
+ { return !linked_list_empty(mSubscribers); }
+
+ bool hasActiveSubscribers() const;
+
+ inline void dropAllSubscribers() const
+ { linked_list_flush(mSubscribers); }
+
+ // private. Only a state gets to call this.
+ void notifySubscribers(Notification& notification) const;
+
+};
+
+class DSStateMachine : public AgpsStateMachine {
+ static const unsigned char MAX_START_DATA_CALL_RETRIES;
+ static const unsigned int DATA_CALL_RETRY_DELAY_MSEC;
+ LocEngAdapter* mLocAdapter;
+ unsigned char mRetries;
+public:
+ DSStateMachine(servicerType type,
+ void *cb_func,
+ LocEngAdapter* adapterHandle);
+ int sendRsrcRequest(AGpsStatusValue action) const;
+ void onRsrcEvent(AgpsRsrcStatus event);
+ void retryCallback();
+ void informStatus(AgpsRsrcStatus status, int ID) const;
+ inline void incRetries() {mRetries++;}
+ inline virtual char *whoami() {return (char*)"DSStateMachine";}
+};
+
+// each subscriber is a AGPS client. In the case of ATL, there could be
+// multiple clients from modem. In the case of BIT, there is only one
+// cilent from BIT daemon.
+struct Subscriber {
+ const uint32_t ID;
+ const AgpsStateMachine* mStateMachine;
+ inline Subscriber(const int id,
+ const AgpsStateMachine* stateMachine) :
+ ID(id), mStateMachine(stateMachine) {}
+ inline virtual ~Subscriber() {}
+
+ virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ virtual void setIPAddresses(struct sockaddr_storage& addr) = 0;
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ { ssid[0] = 0; password[0] = 0; }
+
+ inline virtual bool equals(const Subscriber *s) const
+ { return ID == s->ID; }
+
+ // notifies a subscriber a new NIF resource status, usually
+ // either GRANTE, DENIED, or RELEASED
+ virtual bool notifyRsrcStatus(Notification ¬ification) = 0;
+
+ virtual bool waitForCloseComplete() { return false; }
+ virtual void setInactive() {}
+ virtual bool isInactive() { return false; }
+
+ virtual Subscriber* clone() = 0;
+ // checks if this notification is for me, i.e.
+ // either has my id, or has a broadcast id.
+ bool forMe(Notification ¬ification);
+};
+
+// BITSubscriber, created with requests from BIT daemon
+struct BITSubscriber : public Subscriber {
+ char mIPv6Addr[16];
+
+ inline BITSubscriber(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ Subscriber(ipv4, stateMachine)
+ {
+ if (NULL == ipv6) {
+ mIPv6Addr[0] = 0;
+ } else {
+ memcpy(mIPv6Addr, ipv6, sizeof(mIPv6Addr));
+ }
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ }
+
+ virtual Subscriber* clone()
+ {
+ return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
+ }
+
+ virtual bool equals(const Subscriber *s) const;
+ inline virtual ~BITSubscriber(){}
+};
+
+// ATLSubscriber, created with requests from ATL
+struct ATLSubscriber : public Subscriber {
+ const LocEngAdapter* mLocAdapter;
+ const bool mBackwardCompatibleMode;
+ inline ATLSubscriber(const int id,
+ const AgpsStateMachine* stateMachine,
+ const LocEngAdapter* adapter,
+ const bool compatibleMode) :
+ Subscriber(id, stateMachine), mLocAdapter(adapter),
+ mBackwardCompatibleMode(compatibleMode){}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = INADDR_NONE; v6[0] = 0; }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual Subscriber* clone()
+ {
+ return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
+ mBackwardCompatibleMode);
+ }
+ inline virtual ~ATLSubscriber(){}
+};
+
+// WIFISubscriber, created with requests from MSAPM or QuIPC
+struct WIFISubscriber : public Subscriber {
+ char * mSSID;
+ char * mPassword;
+ loc_if_req_sender_id_e_type senderId;
+ bool mIsInactive;
+ inline WIFISubscriber(const AgpsStateMachine* stateMachine,
+ char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
+ Subscriber(sender_id, stateMachine),
+ mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
+ senderId(sender_id)
+ {
+ if (NULL != mSSID)
+ strlcpy(mSSID, ssid, SSID_BUF_SIZE);
+ if (NULL != mPassword)
+ strlcpy(mPassword, password, SSID_BUF_SIZE);
+ mIsInactive = false;
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ {
+ if (NULL != mSSID)
+ strlcpy(ssid, mSSID, SSID_BUF_SIZE);
+ else
+ ssid[0] = '\0';
+ if (NULL != mPassword)
+ strlcpy(password, mPassword, SSID_BUF_SIZE);
+ else
+ password[0] = '\0';
+ }
+
+ inline virtual bool waitForCloseComplete() { return true; }
+
+ inline virtual void setInactive() { mIsInactive = true; }
+ inline virtual bool isInactive() { return mIsInactive; }
+
+ virtual Subscriber* clone()
+ {
+ return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
+ }
+ inline virtual ~WIFISubscriber(){}
+};
+
+struct DSSubscriber : public Subscriber {
+ bool mIsInactive;
+ inline DSSubscriber(const AgpsStateMachine *stateMachine,
+ const int id) :
+ Subscriber(id, stateMachine)
+ {
+ mIsInactive = false;
+ }
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+ virtual Subscriber* clone()
+ {return new DSSubscriber(mStateMachine, ID);}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+ inline virtual bool waitForCloseComplete() { return true; }
+ virtual void setInactive();
+ inline virtual bool isInactive()
+ { return mIsInactive; }
+ inline virtual ~DSSubscriber(){}
+ inline virtual char *whoami() {return (char*)"DSSubscriber";}
+};
+
+#endif //__LOC_ENG_AGPS_H__
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
new file mode 100644
index 0000000..c257dff
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2011-2012, 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 <linux/stat.h>
+#include <fcntl.h>
+#include <linux/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <grp.h>
+#include <sys/stat.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_msg.h"
+
+static int loc_api_server_msgqid;
+static int loc_api_resp_msgqid;
+static int quipc_msgqid;
+static int msapm_msgqid;
+static int msapu_msgqid;
+
+static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
+static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
+static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
+static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
+static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
+
+static int loc_api_server_proc_init(void *context)
+{
+ loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
+ //change mode/group for the global_loc_api_q_path pipe
+ int result = chmod (global_loc_api_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
+ }
+
+ struct group * gps_group = getgrnam("gps");
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_q_path, gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+ else
+ {
+ LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
+ }
+
+ loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
+
+ //change mode/group for the global_loc_api_resp_q_path pipe
+ result = chmod (global_loc_api_resp_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
+ }
+
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_resp_q_path,
+ gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+
+ quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
+ msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
+ msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
+
+ LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
+ return 0;
+}
+
+static int loc_api_server_proc_pre(void *context)
+{
+ return 0;
+}
+
+static int loc_api_server_proc(void *context)
+{
+ int length, sz;
+ int result = 0;
+ static int cnt = 0;
+ struct ctrl_msgbuf * p_cmsgbuf;
+ struct ctrl_msgbuf cmsg_resp;
+
+ sz = sizeof(struct ctrl_msgbuf) + 256;
+ p_cmsgbuf = (struct ctrl_msgbuf *) malloc(sz);
+
+ if (!p_cmsgbuf) {
+ LOC_LOGE("%s:%d] Out of memory\n", __func__, __LINE__);
+ return -1;
+ }
+
+ cnt ++;
+ LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
+ length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
+ if (length <= 0) {
+ free(p_cmsgbuf);
+ LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
+ usleep(1000);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ switch(p_cmsgbuf->ctrl_type) {
+ case GPSONE_LOC_API_IF_REQUEST:
+ result = loc_eng_dmn_conn_loc_api_server_if_request_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_LOC_API_IF_RELEASE:
+ result = loc_eng_dmn_conn_loc_api_server_if_release_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_UNBLOCK:
+ LOC_LOGD("%s:%d] GPSONE_UNBLOCK\n", __func__, __LINE__);
+ break;
+
+ default:
+ LOC_LOGE("%s:%d] unsupported ctrl_type = %d\n",
+ __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ break;
+ }
+
+ free(p_cmsgbuf);
+ return 0;
+}
+
+static int loc_api_server_proc_post(void *context)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
+ return 0;
+}
+
+static int loc_eng_dmn_conn_unblock_proc(void)
+{
+ struct ctrl_msgbuf cmsgbuf;
+ cmsgbuf.ctrl_type = GPSONE_UNBLOCK;
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgsnd(loc_api_server_msgqid, & cmsgbuf, sizeof(cmsgbuf));
+ return 0;
+}
+
+static struct loc_eng_dmn_conn_thelper thelper;
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * resp_q_path, void *agps_handle)
+{
+ int result;
+
+ loc_api_handle = agps_handle;
+
+ if (loc_api_q_path) global_loc_api_q_path = loc_api_q_path;
+ if (resp_q_path) global_loc_api_resp_q_path = resp_q_path;
+
+ result = loc_eng_dmn_conn_launch_thelper( &thelper,
+ loc_api_server_proc_init,
+ loc_api_server_proc_pre,
+ loc_api_server_proc,
+ loc_api_server_proc_post,
+ create_thread_cb,
+ (char *) global_loc_api_q_path);
+ if (result != 0) {
+ LOC_LOGE("%s:%d]\n", __func__, __LINE__);
+ return -1;
+ }
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_unblock(void)
+{
+ loc_eng_dmn_conn_unblock_thelper(&thelper);
+ loc_eng_dmn_conn_unblock_proc();
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_join(void)
+{
+ loc_eng_dmn_conn_join_thelper(&thelper);
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
+ struct ctrl_msgbuf cmsgbuf;
+ LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
+ cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
+ cmsgbuf.cmsg.cmsg_response.result = status;
+ switch (sender_id) {
+ case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapu_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ default: {
+ LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
+ }
+ }
+ return 0;
+}
+
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
new file mode 100644
index 0000000..1d8c142
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
@@ -0,0 +1,59 @@
+/* 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_ENG_DATA_SERVER_H
+#define LOC_ENG_DATA_SERVER_H
+
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+#ifdef _ANDROID_
+
+#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q"
+
+#else
+
+#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
+
+#endif
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
+int loc_eng_dmn_conn_loc_api_server_unblock(void);
+int loc_eng_dmn_conn_loc_api_server_join(void);
+int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
+
+#endif /* LOC_ENG_DATA_SERVER_H */
+
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
new file mode 100644
index 0000000..a1076ff
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -0,0 +1,223 @@
+/* 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.
+ *
+ */
+#include <linux/stat.h>
+#include <fcntl.h>
+
+#include <linux/types.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgget
+
+DESCRIPTION
+ This function get a message queue
+
+ q_path - name path of the message queue
+ mode -
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ message queue id
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode)
+{
+ int msgqid;
+ msgqid = loc_eng_dmn_conn_glue_pipeget(q_path, mode);
+ return msgqid;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgremove
+
+DESCRIPTION
+ remove a message queue
+
+ q_path - name path of the message queue
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid)
+{
+ int result;
+ result = loc_eng_dmn_conn_glue_piperemove(q_path, msgqid);
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgsnd
+
+DESCRIPTION
+ Send a message
+
+ msgqid - message queue id
+ msgp - pointer to the message to be sent
+ msgsz - size of the message
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes sent out or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+ pmsg->msgsz = msgsz;
+
+ result = loc_eng_dmn_conn_glue_pipewrite(msgqid, msgp, msgsz);
+ if (result != (int) msgsz) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) msgsz);
+ return -1;
+ }
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgrcv
+
+DESCRIPTION
+ receive a message
+
+ msgqid - message queue id
+ msgp - pointer to the buffer to hold the message
+ msgsz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes received or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgbufsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, &(pmsg->msgsz), sizeof(pmsg->msgsz));
+ if (result != sizeof(pmsg->msgsz)) {
+ LOC_LOGE("%s:%d] pipe broken %d\n", __func__, __LINE__, result);
+ return -1;
+ }
+
+ if (msgbufsz < pmsg->msgsz) {
+ LOC_LOGE("%s:%d] msgbuf is too small %d < %d\n", __func__, __LINE__, (int) msgbufsz, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, (uint8_t *) msgp + sizeof(pmsg->msgsz), pmsg->msgsz - sizeof(pmsg->msgsz));
+ if (result != (int) (pmsg->msgsz - sizeof(pmsg->msgsz))) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ return pmsg->msgsz;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgunblock
+
+DESCRIPTION
+ unblock a message queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid)
+{
+ return loc_eng_dmn_conn_glue_pipeunblock(msgqid);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgflush
+
+DESCRIPTION
+ flush out the message in a queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes that are flushed out.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgflush(int msgqid)
+{
+ int length;
+ char buf[128];
+
+ do {
+ length = loc_eng_dmn_conn_glue_piperead(msgqid, buf, 128);
+ LOC_LOGD("%s:%d] %s\n", __func__, __LINE__, buf);
+ } while(length);
+ return length;
+}
+
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
new file mode 100644
index 0000000..d685c87
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
@@ -0,0 +1,51 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_MSG_H
+#define LOC_ENG_DMN_CONN_GLUE_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#include <linux/types.h>
+#include "loc_eng_dmn_conn_glue_pipe.h"
+
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode);
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid);
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgflush(int msgqid);
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
new file mode 100644
index 0000000..dffcad0
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -0,0 +1,214 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+// #include <linux/stat.h>
+#include <fcntl.h>
+// #include <linux/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "loc_eng_dmn_conn_glue_pipe.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeget
+
+DESCRIPTION
+ create a named pipe.
+
+ pipe_name - pipe name path
+ mode - mode
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
+{
+ int fd;
+ int result;
+
+ LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
+ result = mkfifo(pipe_name, 0660);
+
+ if ((result == -1) && (errno != EEXIST)) {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ return result;
+ }
+
+ // The mode in mkfifo is not honoured and does not provide the
+ // group permissions. Doing chmod to add group permissions.
+ result = chmod (pipe_name, 0660);
+ if (result != 0){
+ LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
+ pipe_name, strerror(errno));
+ }
+
+ fd = open(pipe_name, mode);
+ if (fd <= 0)
+ {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ }
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return fd;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperemove
+
+DESCRIPTION
+ remove a pipe
+
+ pipe_name - pipe name path
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd)
+{
+ close(fd);
+ if (pipe_name) unlink(pipe_name);
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipewrite
+
+DESCRIPTION
+ write to a pipe
+
+ fd - fd of a pipe
+ buf - buffer for the data to write
+ sz - size of the data in buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes written or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz)
+{
+ int result;
+
+ result = write(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, result = %d\n", fd, (long) buf, (int) sz, (int) result); */
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperead
+
+DESCRIPTION
+ read from a pipe
+
+ fd - fd for the pipe
+ buf - buffer to hold the data read from pipe
+ sz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes read from pipe or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz)
+{
+ int len;
+
+ len = read(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, len = %d\n", fd, (long) buf, (int) sz, len); */
+ return len;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeunblock
+
+DESCRIPTION
+ unblock a pipe
+
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 for success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeunblock(int fd)
+{
+ int result;
+ struct flock flock_v;
+ LOC_LOGD("\n");
+// result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY);
+ flock_v.l_type = F_UNLCK;
+ flock_v.l_len = 32;
+ result = fcntl(fd, F_SETLK, &flock_v);
+ if (result < 0) {
+ LOC_LOGE("fcntl failure, %s\n", strerror(errno));
+ }
+
+ return result;
+}
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
new file mode 100644
index 0000000..b2fa3a0
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
@@ -0,0 +1,50 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_PIPE_H
+#define LOC_ENG_DMN_CONN_GLUE_PIPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <linux/types.h>
+
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode);
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd);
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz);
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz);
+
+int loc_eng_dmn_conn_glue_pipeflush(int fd);
+int loc_eng_dmn_conn_glue_pipeunblock(int fd);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
new file mode 100644
index 0000000..edd53f2
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-2012, 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 <string.h>
+#include <unistd.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_msg.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+void* loc_api_handle = NULL;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ if (NULL == loc_api_handle) {
+ LOC_LOGE("%s:%d] NO agps data handle\n", __func__, __LINE__);
+ return 1;
+ }
+
+ if (NULL != loc_api_handle) {
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ true);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+ }
+
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+#endif
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ false);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+#endif
+ return 0;
+}
+
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
new file mode 100644
index 0000000..1c0edd5
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_HANDLER
+#define LOC_ENG_DATA_SERVER_HANDLER
+
+#include <linux/types.h>
+#include <arpa/inet.h>
+
+//for SSID_BUF_SIZE
+#include <hardware/gps.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+
+enum {
+ /* 0x0 - 0xEF is reserved for daemon internal */
+ GPSONE_LOC_API_IF_REQUEST = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE,
+ GPSONE_LOC_API_RESPONSE,
+ GPSONE_UNBLOCK,
+};
+
+enum {
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS,
+ GPSONE_LOC_API_IF_FAILURE,
+};
+
+
+struct ctrl_msg_response {
+ int result;
+};
+
+struct ctrl_msg_unblock {
+ int reserved;
+};
+
+typedef enum {
+ IF_REQUEST_TYPE_SUPL = 0,
+ IF_REQUEST_TYPE_WIFI,
+ IF_REQUEST_TYPE_ANY
+} ctrl_if_req_type_e_type;
+
+typedef enum {
+ IF_REQUEST_SENDER_ID_QUIPC = 0,
+ IF_REQUEST_SENDER_ID_MSAPM,
+ IF_REQUEST_SENDER_ID_MSAPU,
+ IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ IF_REQUEST_SENDER_ID_MODEM
+} ctrl_if_req_sender_id_e_type;
+
+struct ctrl_msg_if_request {
+ ctrl_if_req_type_e_type type;
+ ctrl_if_req_sender_id_e_type sender_id;
+ unsigned long ipv4_addr;
+ unsigned char ipv6_addr[16];
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+};
+
+/* do not change this structure */
+struct ctrl_msgbuf {
+ size_t msgsz;
+ uint16_t reserved1;
+ uint32_t reserved2;
+ uint8_t ctrl_type;
+ union {
+ struct ctrl_msg_response cmsg_response;
+ struct ctrl_msg_unblock cmsg_unblock;
+ struct ctrl_msg_if_request cmsg_if_request;
+ } cmsg;
+};
+
+extern void* loc_api_handle;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
+
+#endif /* LOC_ENG_DATA_SERVER_HANDLER */
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
new file mode 100644
index 0000000..9fed9d4
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -0,0 +1,399 @@
+/* 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.
+ *
+ */
+#include <stdio.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+/*===========================================================================
+FUNCTION thelper_signal_init
+
+DESCRIPTION
+ This function will initialize the conditional variable resources.
+
+ thelper - thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+ thelper->thread_exit = 0;
+ thelper->thread_ready = 0;
+ result = pthread_cond_init( &thelper->thread_cond, NULL);
+ if (result) {
+ return result;
+ }
+
+ result = pthread_mutex_init(&thelper->thread_mutex, NULL);
+ if (result) {
+ pthread_cond_destroy(&thelper->thread_cond);
+ }
+ return result;
+}
+
+/*===========================================================================
+FUNCTION
+
+DESCRIPTION
+ This function will destroy the conditional variable resources
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result, ret_result = 0;
+ result = pthread_cond_destroy( &thelper->thread_cond);
+ if (result) {
+ ret_result = result;
+ }
+
+ result = pthread_mutex_destroy(&thelper->thread_mutex);
+ if (result) {
+ ret_result = result;
+ }
+
+ return ret_result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_wait
+
+DESCRIPTION
+ This function will be blocked on the conditional variable until thelper_signal_ready
+ is called
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = 0;
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ if (!thelper->thread_ready && !thelper->thread_exit) {
+ result = pthread_cond_wait(&thelper->thread_cond, &thelper->thread_mutex);
+ }
+
+ if (thelper->thread_exit) {
+ result = -1;
+ }
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_ready
+
+DESCRIPTION
+ This function will wake up the conditional variable
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 1;
+ result = pthread_cond_signal(&thelper->thread_cond);
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_block
+
+DESCRIPTION
+ This function will set the thread ready to 0 to block the thelper_signal_wait
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ if thread_ready is set
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = thelper->thread_ready;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 0;
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_main
+
+DESCRIPTION
+ This function is the main thread. It will be launched as a child thread
+
+ data - pointer to the instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ NULL
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void * thelper_main(void *data)
+{
+ int result = 0;
+ struct loc_eng_dmn_conn_thelper * thelper = (struct loc_eng_dmn_conn_thelper *) data;
+
+ if (thelper->thread_proc_init) {
+ result = thelper->thread_proc_init(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ thelper_signal_ready(thelper);
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ thelper_signal_ready(thelper);
+
+ if (thelper->thread_proc_pre) {
+ result = thelper->thread_proc_pre(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ do {
+ if (thelper->thread_proc) {
+ result = thelper->thread_proc(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ }
+ } while (thelper->thread_exit == 0);
+
+ if (thelper->thread_proc_post) {
+ result = thelper->thread_proc_post(thelper->thread_context);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ return NULL;
+}
+
+static void thelper_main_2(void *data)
+{
+ thelper_main(data);
+ return;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_launch_thelper
+
+DESCRIPTION
+ This function will initialize the thread context and launch the thelper_main
+
+ thelper - pointer to thelper instance
+ thread_proc_init - The initialization function pointer
+ thread_proc_pre - The function to call before task loop and after initialization
+ thread_proc - The task loop
+ thread_proc_post - The function to call after the task loop
+ context - the context for the above four functions
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context)
+{
+ int result;
+
+ thelper_signal_init(thelper);
+
+ if (context) {
+ thelper->thread_context = context;
+ }
+
+ thelper->thread_proc_init = thread_proc_init;
+ thelper->thread_proc_pre = thread_proc_pre;
+ thelper->thread_proc = thread_proc;
+ thelper->thread_proc_post = thread_proc_post;
+
+ LOC_LOGD("%s:%d] 0x%lx call pthread_create\n", __func__, __LINE__, (long) thelper);
+ if (create_thread_cb) {
+ result = 0;
+ thelper->thread_id = create_thread_cb("loc_eng_dmn_conn",
+ thelper_main_2, (void *)thelper);
+ } else {
+ result = pthread_create(&thelper->thread_id, NULL,
+ thelper_main, (void *)thelper);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] 0x%lx pthread_create done\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_wait(thelper);
+
+ LOC_LOGD("%s:%d] 0x%lx pthread ready\n", __func__, __LINE__, (long) thelper);
+ return thelper->thread_exit;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_unblock_thelper
+
+DESCRIPTION
+ This function unblocks thelper_main to release the thread
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ thelper->thread_exit = 1;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_join_thelper
+
+ thelper - pointer to thelper instance
+
+DESCRIPTION
+ This function will wait for the thread of thelper_main to finish
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ result = pthread_join(thelper->thread_id, NULL);
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_destroy(thelper);
+
+ return result;
+}
+
diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
new file mode 100644
index 0000000..89e598b
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+#define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+
+struct loc_eng_dmn_conn_thelper {
+ unsigned char thread_exit;
+ unsigned char thread_ready;
+ pthread_cond_t thread_cond;
+ pthread_mutex_t thread_mutex;
+ pthread_t thread_id;
+ void * thread_context;
+ int (*thread_proc_init) (void * context);
+ int (*thread_proc_pre) (void * context);
+ int (*thread_proc) (void * context);
+ int (*thread_proc_post) (void * context);
+};
+
+typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg);
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context);
+
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+
+/* if only need to use signal */
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */
diff --git a/loc_api/libloc_api_50001/loc_eng_log.cpp b/loc_api/libloc_api_50001/loc_eng_log.cpp
new file mode 100644
index 0000000..3a34167
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_log.cpp
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include "loc_log.h"
+#include "loc_eng_log.h"
+
diff --git a/loc_api/libloc_api_50001/loc_eng_log.h b/loc_api/libloc_api_50001/loc_eng_log.h
new file mode 100644
index 0000000..a68bd84
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_log.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h
new file mode 100644
index 0000000..5626c34
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -0,0 +1,306 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_ENG_MSG_H
+#define LOC_ENG_MSG_H
+
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <stdlib.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_eng_log.h>
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include <LocEngAdapter.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+#ifdef USE_GLIB
+
+#include <glib.h>
+
+#endif /* USE_GLIB */
+#include "platform_lib_includes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+using namespace loc_core;
+
+struct LocEngPositionMode : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const LocPosMode mPosMode;
+ LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
+ virtual void proc() const;
+ virtual void log() const;
+ void send() const;
+};
+
+
+struct LocEngStartFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStartFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngStopFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStopFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportPosition : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const UlpLocation mLocation;
+ const GpsLocationExtended mLocationExtended;
+ const void* mLocationExt;
+ const enum loc_sess_status mStatus;
+ const LocPosTechMask mTechMask;
+ LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportSv : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsSvStatus mSvStatus;
+ const GpsLocationExtended mLocationExtended;
+ const void* mSvExt;
+ LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExtended);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportStatus : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsStatusValue mStatus;
+ LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportNmea : public LocMsg {
+ void* mLocEng;
+ char* const mNmea;
+ const int mLen;
+ LocEngReportNmea(void* locEng,
+ const char* data, int len);
+ inline virtual ~LocEngReportNmea()
+ {
+ delete[] mNmea;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportXtraServer : public LocMsg {
+ void* mLocEng;
+ int mMaxLen;
+ char *mServers;
+ LocEngReportXtraServer(void* locEng,
+ const char *url1, const char *url2,
+ const char *url3, const int maxlength);
+ inline virtual ~LocEngReportXtraServer()
+ {
+ delete[] mServers;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsOpened : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsOpened(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsClosed : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsClosed(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestSuplEs : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngRequestSuplEs(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ const AGpsExtType mType;
+ LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReleaseATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngReleaseATL(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReqRelBIT : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const int mIPv4Addr;
+ char* const mIPv6Addr;
+ const bool mIsReq;
+ LocEngReqRelBIT(void* instance, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq);
+ virtual ~LocEngReqRelBIT();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReqRelWifi : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const loc_if_req_sender_id_e_type mSenderId;
+ char* const mSSID;
+ char* const mPassword;
+ const bool mIsReq;
+ LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq);
+ virtual ~LocEngReqRelWifi();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngRequestXtra : public LocMsg {
+ void* mLocEng;
+ LocEngRequestXtra(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestTime : public LocMsg {
+ void* mLocEng;
+ LocEngRequestTime(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestNi : public LocMsg {
+ void* mLocEng;
+ const GpsNiNotification mNotify;
+ const void *mPayload;
+ LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngDown : public LocMsg {
+ void* mLocEng;
+ LocEngDown(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngUp : public LocMsg {
+ void* mLocEng;
+ LocEngUp(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngGetZpp : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngGetZpp(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportGpsMeasurement : public LocMsg {
+ void* mLocEng;
+ const GpsData mGpsData;
+ LocEngReportGpsMeasurement(void* locEng,
+ GpsData &gpsData);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_MSG_H */
diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp
new file mode 100644
index 0000000..4597b98
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -0,0 +1,414 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <MsgTask.h>
+
+#include <loc_eng.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+static void* ni_thread_proc(void *args);
+
+struct LocEngInformNiResponse : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUserResponseType mResponse;
+ const void *mPayload;
+ inline LocEngInformNiResponse(LocEngAdapter* adapter,
+ GpsUserResponseType resp,
+ const void* data) :
+ LocMsg(), mAdapter(adapter),
+ mResponse(resp), mPayload(data)
+ {
+ locallog();
+ }
+ inline ~LocEngInformNiResponse()
+ {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const
+ {
+ mAdapter->informNiResponse(mResponse, mPayload);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInformNiResponse - "
+ "response: %s\n mPayload: %p",
+ loc_get_ni_response_name(mResponse),
+ mPayload);
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough)
+{
+ ENTRY_LOG();
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) {
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ }
+ } else {
+ if (NULL != loc_eng_ni_data_p->session.rawRequest ||
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+ }
+
+
+ if (pSession) {
+ /* Save request */
+ pSession->rawRequest = (void*)passThrough;
+ pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter;
+ pSession->adapter = loc_eng_data.adapter;
+
+ /* Fill in notification */
+ ((GpsNiNotification*)notif)->notification_id = pSession->reqID;
+
+ if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session(loc_eng_data);
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif->ni_type, notif->timeout, notif->default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif->requestor_id, notif->requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif->text, notif->text_encoding);
+ if (notif->extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif->extras);
+ }
+
+ /* 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 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft);
+
+ int rc = 0;
+ rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(pSession->thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+
+ CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
+ loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION ni_thread_proc
+
+===========================================================================*/
+static void* ni_thread_proc(void *args)
+{
+ ENTRY_LOG();
+
+ loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n",
+ (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 = GPS_NI_RESPONSE_NORESP;
+ LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/
+
+ LOC_LOGD("pSession->resp is %d\n",pSession->resp);
+
+ // 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()
+ LocEngAdapter* adapter = pSession->adapter;
+ LocEngInformNiResponse *msg = NULL;
+
+ if (NULL != pSession->rawRequest) {
+ if (pSession->resp != GPS_NI_RESPONSE_IGNORE) {
+ LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n");
+ msg = new LocEngInformNiResponse(adapter,
+ pSession->resp,
+ pSession->rawRequest);
+ } else {
+ LOC_LOGD("this is the ignore reply for SUPL ES\n");
+ free(pSession->rawRequest);
+ }
+ pSession->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&pSession->tLock);
+
+ pSession->respTimeLeft = 0;
+ pSession->reqID = 0;
+
+ if (NULL != msg) {
+ LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n");
+ adapter->sendMsg(msg);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+ return NULL;
+}
+
+void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ // only if modem has requested but then died.
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ free(loc_eng_ni_data_p->sessionEs.rawRequest);
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->sessionEs.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock);
+ }
+
+ if (NULL != loc_eng_ni_data_p->session.rawRequest) {
+ free(loc_eng_ni_data_p->session.rawRequest);
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if(callbacks == NULL)
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
+ else if (NULL == callbacks->notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
+ } else if (NULL != loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
+ } else {
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_data_p->sessionEs.respTimeLeft = 0;
+ loc_eng_ni_data_p->sessionEs.respRecvd = FALSE;
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+ loc_eng_ni_data_p->sessionEs.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL);
+
+ loc_eng_ni_data_p->session.respTimeLeft = 0;
+ loc_eng_ni_data_p->session.respRecvd = FALSE;
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+ loc_eng_ni_data_p->session.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL);
+
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ EXIT_LOG(%s, VOID_RET);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function receives user response from upper layer framework
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG_CALLFLOW();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif_id == loc_eng_ni_data_p->sessionEs.reqID &&
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (user_response == GPS_NI_RESPONSE_ACCEPT &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE;
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+ } else if (notif_id == loc_eng_ni_data_p->session.reqID &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+
+ if (pSession) {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ pthread_mutex_lock(&pSession->tLock);
+ pSession->resp = user_response;
+ pSession->respRecvd = TRUE;
+ pthread_cond_signal(&pSession->tCond);
+ pthread_mutex_unlock(&pSession->tLock);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/loc_api/libloc_api_50001/loc_eng_ni.h b/loc_api/libloc_api_50001/loc_eng_ni.h
new file mode 100644
index 0000000..068f5cd
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_ni.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009,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 LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <stdbool.h>
+#include <LocEngAdapter.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+#define GPS_NI_RESPONSE_IGNORE 4
+
+typedef struct {
+ pthread_t thread; /* NI thread */
+ int respTimeLeft; /* examine time for NI response */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ int reqID; /* ID to check against response */
+ GpsUserResponseType resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+ LocEngAdapter* adapter;
+} loc_eng_ni_session_s_type;
+
+typedef struct {
+ loc_eng_ni_session_s_type session; /* SUPL NI Session */
+ loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */
+ int reqIDCounter;
+} loc_eng_ni_data_s_type;
+
+
+#endif /* LOC_ENG_NI_H */
diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp
new file mode 100644
index 0000000..2485c59
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -0,0 +1,835 @@
+/* Copyright (c) 2012, 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng_nmea"
+#define GPS_PRN_START 1
+#define GPS_PRN_END 32
+#define GLONASS_PRN_START 65
+#define GLONASS_PRN_END 96
+#include <loc_eng.h>
+#include <loc_eng_nmea.h>
+#include <math.h>
+#include "log_util.h"
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_send
+
+DESCRIPTION
+ send out NMEA sentence
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
+{
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ if (loc_eng_data_p->nmea_cb != NULL)
+ loc_eng_data_p->nmea_cb(now, pNmea, length);
+ LOC_LOGD("NMEA <%s", pNmea);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_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
+
+===========================================================================*/
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 0;
+
+ pNmea++; //skip the $
+ while (*pNmea != '\0')
+ {
+ checksum ^= *pNmea++;
+ length++;
+ }
+
+ int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
+ return (length + checksumLength);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ unsigned char generate_nmea)
+{
+ ENTRY_LOG();
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ if (NULL == pTm) {
+ LOC_LOGE("gmtime failed");
+ return;
+ }
+
+ char sentence[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;
+
+ if (generate_nmea) {
+ // ------------------
+ // ------$GPGSA------
+ // ------------------
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+ uint32_t mask = loc_eng_data_p->sv_used_mask;
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i;
+ mask = mask >> 1;
+ }
+ // clear the cache so they can't be used again
+ loc_eng_data_p->sv_used_mask = 0;
+
+ char fixType;
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ {
+ 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;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPVTG------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & 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, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPRMC------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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 & 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 & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPGGA------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ gpsQuality = '1'; // 1 means GPS fix
+ else
+ gpsQuality = '2'; // 2 means DGPS fix
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, loc_eng_data_p->hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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 & GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ // clear the dop cache so they can't be used again
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
+ const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int svCount = svStatus.num_svs;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+ int gpsCount = 0;
+ int glnCount = 0;
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+
+ for(svNumber=1; svNumber <= svCount; svNumber++) {
+ if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&&
+ (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+ {
+ gpsCount++;
+ }
+ else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )
+ {
+ glnCount++;
+ }
+ }
+
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ if (gpsCount <= 0)
+ {
+ // no svs in view, so just send a blank $GPGSV sentence
+ strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = gpsCount/4 + (gpsCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, gpsCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ } //if
+
+ // ------------------
+ // ------$GLGSV------
+ // ------------------
+
+ if (glnCount <= 0)
+ {
+ // no svs in view, so just send a blank $GLGSV sentence
+ strlcpy(sentence, "$GLGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = glnCount/4 + (glnCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GLGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, glnCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) {
+
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ }//if
+
+ if (svStatus.used_in_fix_mask == 0)
+ { // No sv used, so there will be no position report, so send
+ // blank NMEA sentences
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ { // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask;
+
+ // For RPC, the DOP are sent during sv report, so cache them
+ // now to be sent during position report.
+ // For QMI, the DOP will be in position report.
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ loc_eng_data_p->pdop = locationExtended.pdop;
+ loc_eng_data_p->hdop = locationExtended.hdop;
+ loc_eng_data_p->vdop = locationExtended.vdop;
+ }
+ else
+ {
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+ }
+
+ }
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.h b/loc_api/libloc_api_50001/loc_eng_nmea.h
new file mode 100644
index 0000000..40c6dbb
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2012, 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 <hardware/gps.h>
+
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
+
+#endif // LOC_ENG_NMEA_H
diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/loc_api/libloc_api_50001/loc_eng_xtra.cpp
new file mode 100644
index 0000000..7bb8083
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -0,0 +1,213 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+struct LocEngRequestXtraServer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngRequestXtraServer(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->requestXtraServer();
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngRequestXtraServer");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInjectXtraData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ char* mData;
+ const int mLen;
+ inline LocEngInjectXtraData(LocEngAdapter* adapter,
+ char* data, int len):
+ LocMsg(), mAdapter(adapter),
+ mData(new char[len]), mLen(len)
+ {
+ memcpy((void*)mData, (void*)data, len);
+ locallog();
+ }
+ inline ~LocEngInjectXtraData()
+ {
+ delete[] mData;
+ }
+ inline virtual void proc() const {
+ mAdapter->setXtraData(mData, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("length: %d\n data: %p", mLen, mData);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSetXtraVersionCheck : public LocMsg {
+ LocEngAdapter *mAdapter;
+ int mCheck;
+ inline LocEngSetXtraVersionCheck(LocEngAdapter* adapter,
+ int check):
+ mAdapter(adapter), mCheck(check) {}
+ inline virtual void proc() const {
+ locallog();
+ mAdapter->setXtraVersionCheck(mCheck);
+ }
+ inline void locallog() const {
+ LOC_LOGD("%s:%d]: mCheck: %d",
+ __func__, __LINE__, mCheck);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks)
+{
+ int ret_val = -1;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+ ENTRY_LOG();
+
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
+ } else {
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr->report_xtra_server_cb = callbacks->report_xtra_server_cb;
+
+ ret_val = 0;
+ }
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_inject_data
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_request_server
+
+DESCRIPTION
+ Request the Xtra server url from the modem
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngRequestXtraServer(adapter));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_version_check
+
+DESCRIPTION
+ Injects the enable/disable value for checking XTRA version
+ that is specified in gps.conf
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data,
+ int check)
+{
+ ENTRY_LOG();
+ LocEngAdapter *adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngSetXtraVersionCheck(adapter, check));
+ EXIT_LOG(%d, 0);
+}
diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.h b/loc_api/libloc_api_50001/loc_eng_xtra.h
new file mode 100644
index 0000000..175f497
--- /dev/null
+++ b/loc_api/libloc_api_50001/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2009,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 LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ report_xtra_server report_xtra_server_cb;
+
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H
diff --git a/msm8084/Android.mk b/msm8084/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/msm8084/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/msm8084/core/Android.mk b/msm8084/core/Android.mk
new file mode 100644
index 0000000..c7ea75c
--- /dev/null
+++ b/msm8084/core/Android.mk
@@ -0,0 +1,55 @@
+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_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ liblog \
+ libcutils \
+ libgps.utils \
+ libdl
+
+LOCAL_SRC_FILES += \
+ MsgTask.cpp \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils
+
+LOCAL_COPY_HEADERS_TO:= libloc_core/
+LOCAL_COPY_HEADERS:= \
+ MsgTask.h \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ LBSProxyBase.h \
+ UlpProxyBase.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8084/core/ContextBase.cpp b/msm8084/core/ContextBase.cpp
new file mode 100644
index 0000000..4c05a48
--- /dev/null
+++ b/msm8084/core/ContextBase.cpp
@@ -0,0 +1,126 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
+{
+ LBSProxyBase* proxy = NULL;
+ LOC_LOGD("%s:%d]: getLBSProxy libname: %s\n", __func__, __LINE__, libName);
+ dlerror();
+ void* lib = dlopen(libName, RTLD_NOW);
+
+ if ((void*)NULL != lib) {
+ dlerror();
+ getLBSProxy_t* getter = (getLBSProxy_t*)dlsym(lib, "getLBSProxy");
+ if (NULL != getter) {
+ proxy = (*getter)();
+ }
+ else {
+ LOC_LOGD("%s:%d]: getter is NULL. Reason: %s", __func__, __LINE__, dlerror());
+ }
+ }
+ else {
+ LOC_LOGD("%s:%d]: lib is NULL. Reason: %s", __func__, __LINE__, dlerror());
+ }
+ 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;
+
+ // first if can not be MPQ
+ if (TARGET_MPQ != loc_get_target()) {
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ dlerror();
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask,exMask, this);
+ }
+ else {
+ LOC_LOGD("%s:%d]: getter is NULL. Reason: %s", __func__, __LINE__, dlerror());
+ }
+ }
+ // 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 NULL in RPC", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask, exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, 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())
+{
+}
+
+}
diff --git a/msm8084/core/ContextBase.h b/msm8084/core/ContextBase.h
new file mode 100644
index 0000000..2adbedd
--- /dev/null
+++ b/msm8084/core/ContextBase.h
@@ -0,0 +1,70 @@
+/* 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 __LOC_CONTEXT_BASE__
+#define __LOC_CONTEXT_BASE__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <MsgTask.h>
+#include <LocApiBase.h>
+#include <LBSProxyBase.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class ContextBase {
+ static LBSProxyBase* getLBSProxy(const char* libName);
+ LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
+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() { delete mLocApi; delete mLBSProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mLBSProxy->requestUlp(adapter, capabilities);
+ }
+ inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/msm8084/core/IzatProxyBase.h b/msm8084/core/IzatProxyBase.h
new file mode 100644
index 0000000..e7e3d3f
--- /dev/null
+++ b/msm8084/core/IzatProxyBase.h
@@ -0,0 +1,60 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef IZAT_PROXY_BASE_H
+#define IZAT_PROXY_BASE_H
+
+#include <gps_extended.h>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+
+class IzatProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) const {
+ return NULL;
+ }
+protected:
+ inline IzatProxyBase() {}
+public:
+ inline virtual ~IzatProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {}
+ inline virtual bool hasAgpsExt() const { return false; }
+};
+
+typedef IzatProxyBase* (getIzatProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/msm8084/core/LBSProxyBase.h b/msm8084/core/LBSProxyBase.h
new file mode 100644
index 0000000..0b7dbdf
--- /dev/null
+++ b/msm8084/core/LBSProxyBase.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2013-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 IZAT_PROXY_BASE_H
+#define IZAT_PROXY_BASE_H
+#include <gps_extended.h>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {}
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual bool hasCPIExtendedCapabilities() const { return false; }
+ virtual void injectFeatureConfig(ContextBase* context) const {}
+};
+
+typedef LBSProxyBase* (getLBSProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/msm8084/core/LocAdapterBase.cpp b/msm8084/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..23184df
--- /dev/null
+++ b/msm8084/core/LocAdapterBase.cpp
@@ -0,0 +1,139 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 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, LocAdapterProxyBase *adapterProxyBase) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask())
+{
+ mLocApi->addAdapter(this);
+}
+
+void LocAdapterBase::handleEngineUpEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineUpEvent();
+ }
+}
+
+void LocAdapterBase::handleEngineDownEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineDownEvent();
+ }
+}
+
+void LocAdapterBase::
+ reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportStatus(GpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmea(const char* nmea, int length)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestXtraData()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestTime()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestLocation()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestATL(int connHandle, AGpsType agps_type)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotify(GpsNiNotification ¬ify, const void* data)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ shutdown()
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportGpsMeasurementData(GpsData &gpsMeasurementData)
+DEFAULT_IMPL()
+} // namespace loc_core
diff --git a/msm8084/core/LocAdapterBase.h b/msm8084/core/LocAdapterBase.h
new file mode 100644
index 0000000..e6ff26a
--- /dev/null
+++ b/msm8084/core/LocAdapterBase.h
@@ -0,0 +1,110 @@
+/* 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 LOC_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+protected:
+ const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL), mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ 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);
+ }
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeInt(LocPosMode& posMode) {}
+ virtual void startFixInt() {}
+ virtual void stopFixInt() {}
+ virtual void getZppInt() {}
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotify(GpsNiNotification ¬ify,
+ const void* data);
+ inline virtual bool isInSession() { return false; }
+ virtual void shutdown();
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/msm8084/core/LocAdapterProxyBase.h b/msm8084/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..25af10b
--- /dev/null
+++ b/msm8084/core/LocAdapterProxyBase.h
@@ -0,0 +1,59 @@
+/* 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_ADAPTER_PROXY_BASE_H
+#define LOC_ADAPTER_PROXY_BASE_H
+
+#include <ContextBase.h>
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocAdapterProxyBase {
+private:
+ const LocAdapterBase *mLocAdapterBase;
+protected:
+ inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context):
+ mLocAdapterBase(new LocAdapterBase(mask, context, this)) {
+ }
+ inline virtual ~LocAdapterProxyBase() {
+ delete mLocAdapterBase;
+ }
+ ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
+public:
+ inline virtual void handleEngineUpEvent() {};
+ inline virtual void handleEngineDownEvent() {};
+};
+
+} // namespace loc_core
+
+#endif //LOC_ADAPTER_PROXY_BASE_H
diff --git a/msm8084/core/LocApiBase.cpp b/msm8084/core/LocApiBase.cpp
new file mode 100644
index 0000000..6969fe5
--- /dev/null
+++ b/msm8084/core/LocApiBase.cpp
@@ -0,0 +1,506 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <log_util.h>
+#include <LocDualContext.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ inline LocOpenMsg(LocApiBase* locApi,
+ LOC_API_ADAPTER_EVENT_MASK_T mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->open(mMask);
+ }
+ inline void locallog() {
+ LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
+ __func__, __LINE__, mMask);
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0), mContext(context)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ mMsgTask->sendMsg(new LocOpenMsg(this,
+ (adapter->getEvtMask())));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ }
+ }
+ }
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ LocDualContext::injectFeatureConfig(mContext);
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
+}
+
+void LocApiBase::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask)
+ );
+}
+
+void LocApiBase::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSv(svStatus,
+ locationExtended,
+ svExt)
+ );
+}
+
+void LocApiBase::reportStatus(GpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+void LocApiBase::reportNmea(const char* nmea, int length)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmea(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::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, AGpsType agps_type)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ deleteAidingData(GpsAidingData f)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int enable)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* apn, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double latitude, double longitude, float accuracy)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, AGpsType agpsType)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int handle, int is_succ)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(const char* url, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSUPLVersion(uint32_t version)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setLPPConfig(uint32_t profile)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage,
+ int sensorProvider)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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)
+
+enum loc_api_adapter_err LocApiBase::
+ setExtPowerConfig(int isBatteryCharging)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ initDataServiceClient()
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+int LocApiBase::
+ setGpsLock(LOC_GPS_LOCK_MASK lock)
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+DEFAULT_IMPL()
+
+int LocApiBase::
+ getGpsLock()
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+DEFAULT_IMPL(-1)
+
+bool LocApiBase::
+ gnssConstellationConfig()
+DEFAULT_IMPL(false)
+
+} // namespace loc_core
diff --git a/msm8084/core/LocApiBase.h b/msm8084/core/LocApiBase.h
new file mode 100644
index 0000000..46950e6
--- /dev/null
+++ b/msm8084/core/LocApiBase.h
@@ -0,0 +1,242 @@
+/* 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 LOC_API_BASE_H
+#define LOC_API_BASE_H
+
+#include <stddef.h>
+#include <ctype.h>
+#include <gps_extended.h>
+#include <MsgTask.h>
+#include <log_util.h>
+
+namespace loc_core {
+class ContextBase;
+
+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 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++);
+
+class LocAdapterBase;
+struct LocSsrMsg;
+struct LocOpenMsg;
+
+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 class ContextBase;
+ const MsgTask* mMsgTask;
+ ContextBase *mContext;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+
+ void addAdapter(LocAdapterBase* adapter);
+ void removeAdapter(LocAdapterBase* adapter);
+
+ // upward calls
+ void handleEngineUpEvent();
+ void handleEngineDownEvent();
+ void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask =
+ LOC_POS_TECH_MASK_DEFAULT);
+ void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ void reportStatus(GpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, AGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging);
+ virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol);
+ virtual enum loc_api_adapter_err
+ getWwanZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient();
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+ virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+
+ inline virtual void setInSession(bool inSession) {}
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+
+ /*
+ Update gps reporting events
+ */
+ virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+ /*
+ Check if the modem support the service
+ */
+ virtual bool gnssConstellationConfig();
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/msm8084/core/LocDualContext.cpp b/msm8084/core/LocDualContext.cpp
new file mode 100644
index 0000000..41ad4f0
--- /dev/null
+++ b/msm8084/core/LocDualContext.cpp
@@ -0,0 +1,165 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+ContextBase* LocDualContext::mInjectContext = NULL;
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
+
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name);
+ }
+ return mMsgTask;
+}
+
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tAssociate, name);
+ } else if (tAssociate) {
+ mMsgTask->associate(tAssociate);
+ }
+ return mMsgTask;
+}
+
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mFgContext) {
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mFgContext) {
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ return mFgContext;
+
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mBgContext) {
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ return mBgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mBgContext) {
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ return mBgContext;
+}
+
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Enter", __func__, __LINE__);
+ if(curContext == mInjectContext) {
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+ }
+ LOC_LOGD("%s:%d]: Exit", __func__, __LINE__);
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mLBSLibName)
+{
+}
+
+}
diff --git a/msm8084/core/LocDualContext.h b/msm8084/core/LocDualContext.h
new file mode 100644
index 0000000..cdc4df3
--- /dev/null
+++ b/msm8084/core/LocDualContext.h
@@ -0,0 +1,73 @@
+/* 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 __LOC_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+ static ContextBase* mInjectContext;
+ static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
+ const char* name);
+ static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name);
+
+protected:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static void injectFeatureConfig(ContextBase *context);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/msm8084/core/MsgTask.cpp b/msm8084/core/MsgTask.cpp
new file mode 100644
index 0000000..5d375aa
--- /dev/null
+++ b/msm8084/core/MsgTask.cpp
@@ -0,0 +1,147 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+#define MAX_TASK_COMM_LEN 15
+
+static void LocMsgDestroy(void* msg) {
+ delete (LocMsg*)msg;
+}
+
+MsgTask::MsgTask(tCreate tCreator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(NULL){
+ if (tCreator) {
+ tCreator(threadName, loopMain,
+ (void*)new MsgTask(mQ, mAssociator));
+ } else {
+ createPThread(threadName);
+ }
+}
+
+MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(tAssociator){
+ createPThread(threadName);
+}
+
+inline
+MsgTask::MsgTask(const void* q, tAssociate associator) :
+ mQ(q), mAssociator(associator){
+}
+
+MsgTask::~MsgTask() {
+ msg_q_unblock((void*)mQ);
+}
+
+void MsgTask::associate(tAssociate tAssociator) const {
+ struct LocAssociateMsg : public LocMsg {
+ tAssociate mAssociator;
+ inline LocAssociateMsg(tAssociate associator) :
+ LocMsg(), mAssociator(associator) {}
+ inline virtual void proc() const {
+ if (mAssociator) {
+ LOC_LOGD("MsgTask::associate");
+ mAssociator();
+ }
+ }
+ };
+ sendMsg(new LocAssociateMsg(tAssociator));
+}
+
+void MsgTask::createPThread(const char* threadName) {
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ pthread_t tid;
+ // create the thread here, then if successful
+ // and a name is given, we set the thread name
+ if (!pthread_create(&tid, &attr, loopMain,
+ (void*)new MsgTask(mQ, mAssociator)) &&
+ NULL != threadName) {
+ char lname[MAX_TASK_COMM_LEN+1];
+ memcpy(lname, threadName, MAX_TASK_COMM_LEN);
+ lname[MAX_TASK_COMM_LEN] = 0;
+ pthread_setname_np(tid, lname);
+ }
+}
+
+void MsgTask::sendMsg(const LocMsg* msg) const {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void* MsgTask::loopMain(void* arg) {
+ MsgTask* copy = (MsgTask*)arg;
+
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+
+ if (NULL != copy->mAssociator) {
+ copy->mAssociator();
+ }
+
+ LocMsg* msg;
+ int cnt = 0;
+
+ while (1) {
+ LOC_LOGD("MsgTask::loop() %d listening ...\n", cnt++);
+
+ msq_q_err_type result = msg_q_rcv((void*)copy->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));
+ // destroy the Q and exit
+ msg_q_destroy((void**)&(copy->mQ));
+ delete copy;
+ return NULL;
+ }
+
+ msg->log();
+ // there is where each individual msg handling is invoked
+ msg->proc();
+
+ delete msg;
+ }
+
+ delete copy;
+
+ return NULL;
+}
+
+}
diff --git a/msm8084/core/MsgTask.h b/msm8084/core/MsgTask.h
new file mode 100644
index 0000000..d50bb31
--- /dev/null
+++ b/msm8084/core/MsgTask.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __MSG_TASK__
+#define __MSG_TASK__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <pthread.h>
+
+namespace loc_core {
+
+struct LocMsg {
+ inline LocMsg() {}
+ inline virtual ~LocMsg() {}
+ virtual void proc() const = 0;
+ inline virtual void log() const {}
+};
+
+class MsgTask {
+public:
+ typedef void* (*tStart)(void*);
+ typedef pthread_t (*tCreate)(const char* name, tStart start, void* arg);
+ typedef int (*tAssociate)();
+ MsgTask(tCreate tCreator, const char* threadName);
+ MsgTask(tAssociate tAssociator, const char* threadName);
+ ~MsgTask();
+ void sendMsg(const LocMsg* msg) const;
+ void associate(tAssociate tAssociator) const;
+
+private:
+ const void* mQ;
+ tAssociate mAssociator;
+ MsgTask(const void* q, tAssociate associator);
+ static void* loopMain(void* copy);
+ void createPThread(const char* name);
+};
+
+} // namespace loc_core
+
+#endif //__MSG_TASK__
diff --git a/msm8084/core/UlpProxyBase.h b/msm8084/core/UlpProxyBase.h
new file mode 100644
index 0000000..b9a8224
--- /dev/null
+++ b/msm8084/core/UlpProxyBase.h
@@ -0,0 +1,85 @@
+/* Copyright (c) 2013-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 ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ LocPosMode mPosMode;
+ bool mFixSet;
+ inline UlpProxyBase() {
+ mPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mFixSet = false;
+ }
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { mFixSet = true; return false; }
+ inline virtual bool sendStopFix() { mFixSet = false; return false; }
+ inline virtual bool sendFixMode(LocPosMode ¶ms) {
+ mPosMode = params;
+ return false;
+ }
+
+ inline virtual bool reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
+ }
+ inline virtual bool reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt) {
+ return false;
+ }
+ inline virtual bool reportStatus(GpsStatusValue status) {
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* adapter) {}
+ inline virtual void setCapabilities(unsigned long capabilities) {}
+ inline virtual bool reportBatchingSession(GpsExtBatchOptions &options,
+ bool active) {
+ return false;
+ }
+ inline virtual bool reportPositions(GpsExtLocation * locations,
+ int32_t number_of_locations,
+ enum loc_sess_status status,
+ LocPosTechMask techMask) {
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/msm8084/core/gps_extended.h b/msm8084/core/gps_extended.h
new file mode 100644
index 0000000..88b0415
--- /dev/null
+++ b/msm8084/core/gps_extended.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gps_extended_c.h>
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ GpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ char credentials[14];
+ char provider[8];
+ LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ const char* cred, const char* prov) :
+ mode(m), recurrence(recr),
+ min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
+ preferred_accuracy(accu), preferred_time(time) {
+ 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(GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(MIN_POSSIBLE_FIX_INTERVAL),
+ preferred_accuracy(50), preferred_time(120000) {
+ 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 &&
+ !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/msm8084/core/gps_extended_c.h b/msm8084/core/gps_extended_c.h
new file mode 100644
index 0000000..b62e0ea
--- /dev/null
+++ b/msm8084/core/gps_extended_c.h
@@ -0,0 +1,399 @@
+/* Copyright (c) 2013-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 GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <hardware/gps.h>
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** GpsLocation has valid "is indoor?" flag */
+#define GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** GpsLocation has valid floor number */
+#define GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** GpsLocation has valid map URL*/
+#define GPS_LOCATION_HAS_MAP_URL 0x0100
+/** GpsLocation has valid map index */
+#define GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+/** 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 source is ZPP only */
+#define ULP_LOCATION_IS_FROM_ZPP 0x0004
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+/** Positioin is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+
+/*Emergency SUPL*/
+#define GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+#define AGPS_CERTIFICATE_MAX_LENGTH 2000
+#define AGPS_CERTIFICATE_MAX_SLOTS 10
+
+enum loc_registration_mask_status {
+ LOC_REGISTRATION_MASK_ENABLED,
+ LOC_REGISTRATION_MASK_DISABLED
+};
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ GpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+/** AGPS type */
+typedef int16_t AGpsExtType;
+#define AGPS_TYPE_INVALID -1
+#define AGPS_TYPE_ANY 0
+#define AGPS_TYPE_SUPL 1
+#define AGPS_TYPE_C2K 2
+#define AGPS_TYPE_WWAN_ANY 3
+#define AGPS_TYPE_WIFI 4
+#define AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+#define GPS_DELETE_ALMANAC_CORR 0x00001000
+#define GPS_DELETE_FREQ_BIAS_EST 0x00002000
+#define GPS_DELETE_EPHEMERIS_GLO 0x00004000
+#define GPS_DELETE_ALMANAC_GLO 0x00008000
+#define GPS_DELETE_SVDIR_GLO 0x00010000
+#define GPS_DELETE_SVSTEER_GLO 0x00020000
+#define GPS_DELETE_ALMANAC_CORR_GLO 0x00040000
+#define GPS_DELETE_TIME_GPS 0x00080000
+#define GPS_DELETE_TIME_GLO 0x00100000
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(GpsCallbacks) */
+ size_t size;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ gps_request_utc_time request_utc_time_cb;
+} GpsExtCallbacks;
+
+/** GPS extended batch options */
+typedef struct {
+ double max_power_allocation_mW;
+ uint32_t sources_to_use;
+ uint32_t flags;
+ int64_t period_ns;
+} GpsExtBatchOptions;
+
+/** 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 {
+ gps_xtra_download_request download_request_cb;
+ 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) */
+ size_t size;
+
+ AGpsExtType type;
+ AGpsStatusValue 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;
+ gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ gps_ni_notify_callback notify_cb;
+ gps_create_thread create_thread_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
+} 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;
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+
+/** GpsLocationExtended has valid latitude and longitude. */
+#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0)
+/** GpsLocationExtended has valid altitude. */
+#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE (1U<<1)
+/** GpsLocationExtended has valid speed. */
+#define GPS_LOCATION_EXTENDED_HAS_SPEED (1U<<2)
+/** GpsLocationExtended has valid bearing. */
+#define GPS_LOCATION_EXTENDED_HAS_BEARING (1U<<4)
+/** GpsLocationExtended has valid accuracy. */
+#define GPS_LOCATION_EXTENDED_HAS_ACCURACY (1U<<8)
+
+/** GPS extended supports geofencing */
+#define GPS_EXTENDED_CAPABILITY_GEOFENCE 0x0000001
+/** GPS extended supports batching */
+#define GPS_EXTENDED_CAPABILITY_BATCHING 0x0000002
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint16_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
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+} GpsLocationExtended;
+
+typedef struct GpsExtLocation_s {
+ size_t size;
+ uint16_t flags;
+ double latitude;
+ double longitude;
+ double altitude;
+ float speed;
+ float bearing;
+ float accuracy;
+ int64_t timestamp;
+ uint32_t sources_used;
+} GpsExtLocation;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+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)
+
+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_ENGINE_DOWN = 100,
+ LOC_API_ADAPTER_ERR_FAILURE,
+ 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, // GNSS Measurement report
+
+ 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 (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
+
+typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_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)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
+
diff --git a/msm8084/core/loc_core_log.cpp b/msm8084/core/loc_core_log.cpp
new file mode 100644
index 0000000..430f4b8
--- /dev/null
+++ b/msm8084/core/loc_core_log.cpp
@@ -0,0 +1,251 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_core_log.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static loc_name_val_s_type gps_status_name[] =
+{
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
+};
+static int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(GpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
+};
+static int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( GPS_DELETE_ALMANAC ),
+ NAME_VAL( GPS_DELETE_POSITION ),
+ NAME_VAL( GPS_DELETE_TIME ),
+ NAME_VAL( GPS_DELETE_IONO ),
+ NAME_VAL( GPS_DELETE_UTC ),
+ NAME_VAL( GPS_DELETE_HEALTH ),
+ NAME_VAL( GPS_DELETE_SVDIR ),
+ NAME_VAL( GPS_DELETE_SVSTEER ),
+ NAME_VAL( GPS_DELETE_SADATA ),
+ NAME_VAL( GPS_DELETE_RTI ),
+ NAME_VAL( GPS_DELETE_CELLDB_INFO ),
+ NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
+ NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
+ NAME_VAL( GPS_DELETE_EPHEMERIS_GLO ),
+ NAME_VAL( GPS_DELETE_ALMANAC_GLO ),
+ NAME_VAL( GPS_DELETE_SVDIR_GLO ),
+ NAME_VAL( GPS_DELETE_SVSTEER_GLO ),
+ NAME_VAL( GPS_DELETE_ALMANAC_CORR_GLO ),
+ NAME_VAL( GPS_DELETE_TIME_GPS ),
+ NAME_VAL( GPS_DELETE_TIME_GLO )
+};
+static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(GpsAidingData data)
+{
+ return NULL;
+}
+
+
+static loc_name_val_s_type loc_eng_agps_types[] =
+{
+ NAME_VAL( AGPS_TYPE_INVALID ),
+ NAME_VAL( AGPS_TYPE_ANY ),
+ NAME_VAL( AGPS_TYPE_SUPL ),
+ NAME_VAL( AGPS_TYPE_C2K ),
+ NAME_VAL( AGPS_TYPE_WWAN_ANY )
+};
+static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(AGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_types[] =
+{
+ NAME_VAL( GPS_NI_TYPE_VOICE ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ),
+ NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL )
+};
+static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(GpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_responses[] =
+{
+ NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY )
+};
+static int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(GpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_encodings[] =
+{
+ NAME_VAL( GPS_ENC_NONE ),
+ NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( GPS_ENC_UNKNOWN )
+};
+static int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static loc_name_val_s_type loc_eng_agps_status_names[] =
+{
+ NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
+};
+static int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(AGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/msm8084/core/loc_core_log.h b/msm8084/core/loc_core_log.h
new file mode 100644
index 0000000..8a1825a
--- /dev/null
+++ b/msm8084/core/loc_core_log.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_CORE_LOG_H
+#define LOC_CORE_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <gps_extended.h>
+
+const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+const char* loc_get_position_mode_name(GpsPositionMode mode);
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(GpsAidingData data);
+const char* loc_get_agps_type_name(AGpsType type);
+const char* loc_get_ni_type_name(GpsNiType type);
+const char* loc_get_ni_response_name(GpsUserResponseType response);
+const char* loc_get_ni_encoding_name(GpsNiEncodingType 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(AGpsStatusValue status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CORE_LOG_H */
diff --git a/msm8084/etc/Android.mk b/msm8084/etc/Android.mk
new file mode 100644
index 0000000..80e1461
--- /dev/null
+++ b/msm8084/etc/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH := $(call my-dir)
+#include $(CLEAR_VARS)
+#
+#LOCAL_MODULE := gps.conf
+#LOCAL_MODULE_TAGS := optional
+#LOCAL_MODULE_CLASS := ETC
+#LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/
+#LOCAL_SRC_FILES := gps.conf
+#
+#include $(BUILD_PREBUILT)
diff --git a/msm8084/etc/gps.conf b/msm8084/etc/gps.conf
new file mode 100644
index 0000000..fb8a312
--- /dev/null
+++ b/msm8084/etc/gps.conf
@@ -0,0 +1,101 @@
+#Uncommenting these urls would only enable
+#the power up auto injection and force injection(test case).
+#XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin
+#XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin
+#XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin
+
+# Error Estimate
+# _SET = 1
+# _CLEAR = 0
+ERR_ESTIMATE=0
+
+#Test
+NTP_SERVER=time.gpsonextra.net
+#Asia
+# NTP_SERVER=asia.pool.ntp.org
+#Europe
+# NTP_SERVER=europe.pool.ntp.org
+#North America
+# NTP_SERVER=north-america.pool.ntp.org
+
+# 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 = 2
+
+# Intermediate position report, 1=enable, 0=disable
+INTERMEDIATE_POS=0
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# Emergency SUPL, 1=enable, 0=disable
+SUPL_ES=1
+
+# GPS Capabilities bit mask
+# SCHEDULING = 0x01
+# MSB = 0x02
+# MSA = 0x04
+# ON_DEMAND_TIME = 0x10
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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
+SUPL_HOST=supl.google.com
+SUPL_PORT=7276
+
+# 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
+# for installation (slots 2, 4, and 10)
+# 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 = 0
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=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
diff --git a/msm8084/loc_api/Android.mk b/msm8084/loc_api/Android.mk
new file mode 100644
index 0000000..743b386
--- /dev/null
+++ b/msm8084/loc_api/Android.mk
@@ -0,0 +1,17 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+
+LOCAL_PATH := $(call my-dir)
+
+# add RPC dirs if RPC is available
+ifneq ($(TARGET_NO_RPC),true)
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
+
+endif #TARGET_NO_RPC
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
+
+#call the subfolders
+include $(addsuffix Android.mk, $(GPS_DIR_LIST))
+
+endif#BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8084/loc_api/NOTICE b/msm8084/loc_api/NOTICE
new file mode 100644
index 0000000..85b5740
--- /dev/null
+++ b/msm8084/loc_api/NOTICE
@@ -0,0 +1,13 @@
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/Android.mk b/msm8084/loc_api/libloc_api-rpc-50001/Android.mk
new file mode 100644
index 0000000..6c5d533
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+include $(call all-subdir-makefiles)
+endif
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
new file mode 100644
index 0000000..bb3d924
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
@@ -0,0 +1,60 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+RPC_INC:=rpc_inc
+
+source_files:= \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpc.cpp
+
+LOCAL_SRC_FILES:= $(source_files)
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-DDEBUG -DUSE_QCOM_AUTO_RPC -DUSE_QCOM_AUTO_RPC
+LOCAL_CFLAGS+=$(GPS_FEATURES)
+
+# for loc_api_fixup.c
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= \
+ librpc \
+ libutils \
+ libcutils \
+ libcommondefs \
+ libgps.utils \
+ libloc_core
+
+LOCAL_STATIC_LIBRARIES := \
+ libloc_api_rpcgen
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/rpc_inc \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/loc_api/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/librpc \
+ $(TARGET_OUT_HEADERS)/libloc-rpc/rpc_inc \
+ $(TOP)/hardware/msm7k/librpc
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc-qc/$(RPC_INC)
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_rpc_glue.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_api_sync_call.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ $(RPC_INC)/LocApiRpc.h
+
+LOCAL_MODULE:= libloc_api-rpc-qc
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
new file mode 100644
index 0000000..f5c5136
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
@@ -0,0 +1,46 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I../../../platform_lib_abstractions \
+ -I./rpc_inc \
+ -I../libloc_api-rpc-stub/inc \
+ -I../../libloc_api_50001 \
+ $(MSM7K_CFLAGS) \
+ -DUSE_QCOM_AUTO_RPC
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ rpc_inc/loc_api_rpc_glue.h \
+ rpc_inc/loc_api_fixup.h \
+ rpc_inc/loc_api_sync_call.h \
+ rpc_inc/loc_apicb_appinit.h \
+
+c_sources = \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpcAdapter.cpp \
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpc_qc_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpc_qc_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpc_qc_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpc_qc_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpc_qc_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpc_qc_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpc_qc.la
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
new file mode 100644
index 0000000..01d67f4
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
@@ -0,0 +1,140 @@
+/* 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 LOC_API_RPC_H
+#define LOC_API_RPC_H
+
+#include <rpc/rpc.h>
+#include <loc_api_rpcgen_common_rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <LocApiBase.h>
+#include <loc_log.h>
+
+using namespace loc_core;
+
+class LocApiRpc : public LocApiBase {
+protected:
+ // RPC communication establishment
+ rpc_loc_client_handle_type client_handle;
+
+private:
+ int dataEnableLastSet;
+ char apnLastSet[MAX_APN_LEN];
+
+ static const LOC_API_ADAPTER_EVENT_MASK_T maskAll;
+ static const rpc_loc_event_mask_type locBits[];
+ static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ static rpc_loc_lock_e_type convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask);
+ static enum loc_api_adapter_err convertErr(int rpcErr);
+ static GpsNiEncodingType convertNiEncodingType(int loc_encoding);
+ static int NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv);
+
+ void reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr);
+ void reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+ void reportStatus(const rpc_loc_status_event_s_type *status_report_ptr);
+ void reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+ void ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr);
+ void NIEvent(const rpc_loc_ni_event_s_type *ni_req_ptr);
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+public:
+ LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ ~LocApiRpc();
+
+ virtual int locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+
+ void locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event);
+
+ // RPC adapter interface implementations
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& mode);
+ inline virtual enum loc_api_adapter_err
+ enableData(int enable) { return enableData(enable, false); }
+ virtual enum loc_api_adapter_err
+ enableData(int enable, boolean force);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ inline virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len) { return setAPN(apn, len, false); }
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len, boolean force);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(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 enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual void setInSession(bool inSession);
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+};
+
+extern "C" LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+#endif //LOC_API_RPC_H
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
new file mode 100644
index 0000000..49a6d0b
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
@@ -0,0 +1,69 @@
+/* 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "LocSvc_rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ ALOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ ALOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ ALOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
new file mode 100644
index 0000000..c483b4a
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
@@ -0,0 +1,226 @@
+/* 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 LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RPC failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+// Special return value for modem restart incurred RPC failure
+#define RPC_LOC_API_RPC_MODEM_RESTART (-1235)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE 0x00000200
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* EFS data access */
+#define RPC_LOC_EFS_MAX_PATH_LEN_BYTES 64 /* Max file name length in bytes that can be written*/
+#define RPC_LOC_EFS_MAX_FILE_LEN_BYTES 2000 /* Max file size in bytes that can be written */
+
+/* WIPER valid information flag in log report */
+#define RPC_LOC_WIPER_LOG_TIME_VALID 0x01
+#define RPC_LOC_WIPER_LOG_POS_VALID 0x02
+#define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04
+
+/* General WIPER defines */
+#define RPC_LOC_WIPER_MAC_ADDR_LENGTH 6 // Do not change this number since it affects RPC and log packet sizes
+#define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes
+
+/* WIPER AP Qualifier */
+#define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1 /* AP is being used by WPS */
+#define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */
+#define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4 /* AP has encryption turned on */
+#define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8 /* AP is in infrastructure mode and not in ad-hoc/unknown mode */
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+/* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */
+/* values for apn_profiles[0].srv_system_type */
+#define LOC_APN_PROFILE_SRV_SYS_CDMA 0x01
+#define LOC_APN_PROFILE_SRV_SYS_HDR 0x02
+#define LOC_APN_PROFILE_SRV_SYS_GSM 0x04
+#define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08
+#define LOC_APN_PROFILE_SRV_SYS_LTE 0x10
+#define LOC_APN_PROFILE_SRV_SYS_MAX 0x1F
+/* values for apn_profiles[0].pdp_type */
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4 0x01
+#define LOC_APN_PROFILE_PDN_TYPE_IPV6 0x02
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4V6 0x03
+#define LOC_APN_PROFILE_PDN_TYPE_PPP 0x04
+#define LOC_APN_PROFILE_PDN_TYPE_MAX 0x04
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
new file mode 100644
index 0000000..f037428
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
@@ -0,0 +1,59 @@
+/* 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 LOC_API_LOG_H
+#define LOC_API_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_api_rpcgen_common_rpc.h"
+
+extern int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open);
+extern const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask);
+extern const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type);
+extern const char* loc_get_ioctl_status_name(uint32 status);
+extern const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status);
+extern const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state);
+extern const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state);
+extern const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_LOG_H */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..6df33ae
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
@@ -0,0 +1,123 @@
+/* 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 LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+#include "loc_api_fixup.h"
+#include "loc_api_sync_call.h"
+#include <rpc/clnt.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ void* userData,
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+typedef void (loc_reset_notif_cb_f_type)(
+ void* userData,
+ CLIENT* clnt,
+ enum rpc_reset_event event
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_global_cb,
+ void* userData
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern void loc_clear
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+extern int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
new file mode 100644
index 0000000..43208bd
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
@@ -0,0 +1,90 @@
+/* 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 LOC_API_CB_SYNC_H
+#define LOC_API_CB_SYNC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include "loc_api_rpc_glue.h"
+#define LOC_SYNC_CALL_SLOTS_MAX 8
+
+typedef struct {
+ pthread_mutex_t lock;
+
+ /* Client ID */
+ rpc_loc_client_handle_type loc_handle;
+
+ /* Callback waiting conditional variable */
+ pthread_cond_t loc_cb_arrived_cond;
+
+ /* Callback waiting data block, protected by loc_cb_data_mutex */
+ boolean in_use;
+ boolean signal_sent;
+ boolean not_available;
+ rpc_loc_event_mask_type loc_cb_wait_event_mask; /* event to wait for */
+ rpc_loc_ioctl_e_type ioctl_type; /* ioctl to wait for */
+ rpc_loc_event_payload_u_type loc_cb_received_payload; /* received payload */
+ rpc_loc_event_mask_type loc_cb_received_event_mask; /* received event */
+} loc_sync_call_slot_s_type;
+
+typedef struct {
+ int num_of_slots;
+ loc_sync_call_slot_s_type slots[LOC_SYNC_CALL_SLOTS_MAX];
+} loc_sync_call_slot_array_s_type;
+
+/* Init function */
+void loc_api_sync_call_init();
+
+/* Destroy function */
+void loc_api_sync_call_destroy();
+
+/* Process Loc API callbacks to wake up blocked user threads */
+void loc_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+/* Reentrant synchronous IOCTL call, using Loc API return code */
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..ba41d08
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
@@ -0,0 +1,45 @@
+/* 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 LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
new file mode 100644
index 0000000..87d6b7c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
@@ -0,0 +1,1461 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc"
+
+#include <unistd.h>
+#include <math.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#endif /* USE_GLIB */
+#include <LocApiRpc.h>
+#include <LocAdapterBase.h>
+#include <loc_api_fixup.h>
+#include <loc_api_rpc_glue.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_api_log.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include <librpc.h>
+#include <platform_lib_includes.h>
+
+using namespace loc_core;
+
+#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
+#define XTRA_BLOCK_SIZE (3072)
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+/*===========================================================================
+FUNCTION loc_event_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int32 loc_event_cb
+(
+ void* user,
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event));
+ loc_callback_log(loc_event, loc_event_payload);
+ int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_rpc_global_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open for RPC global events
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event));
+ ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event);
+ EXIT_LOG(%p, VOID_RET);
+}
+
+const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll =
+ LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+const rpc_loc_event_mask_type LocApiRpc::locBits[] =
+{
+ RPC_LOC_EVENT_PARSED_POSITION_REPORT,
+ RPC_LOC_EVENT_SATELLITE_REPORT,
+ RPC_LOC_EVENT_NMEA_1HZ_REPORT,
+ RPC_LOC_EVENT_NMEA_POSITION_REPORT,
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST,
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST,
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST,
+ RPC_LOC_EVENT_IOCTL_REPORT,
+ RPC_LOC_EVENT_STATUS_REPORT,
+ RPC_LOC_EVENT_WPS_NEEDED_REQUEST
+};
+
+// constructor
+LocApiRpc::LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) :
+ LocApiBase(msgTask, exMask, context),
+ client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
+ dataEnableLastSet(-1)
+{
+ memset(apnLastSet, 0, sizeof(apnLastSet));
+ loc_api_glue_init();
+}
+
+LocApiRpc::~LocApiRpc()
+{
+ close();
+}
+
+rpc_loc_event_mask_type
+LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ rpc_loc_event_mask_type newMask = 0;
+
+ for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) {
+ if (mask & bit) {
+ newMask |= locBits[i];
+ mask ^= bit;
+ }
+ }
+
+ return newMask;
+}
+
+rpc_loc_lock_e_type
+LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask)
+{
+ if (isGpsLockAll(lockMask))
+ return RPC_LOC_LOCK_ALL;
+ if (isGpsLockMO(lockMask))
+ return RPC_LOC_LOCK_MI;
+ if (isGpsLockMT(lockMask))
+ return RPC_LOC_LOCK_MT;
+ if (isGpsLockNone(lockMask))
+ return RPC_LOC_LOCK_NONE;
+ return (rpc_loc_lock_e_type)lockMask;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::convertErr(int rpcErr)
+{
+ switch(rpcErr)
+ {
+ case RPC_LOC_API_SUCCESS:
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+ case RPC_LOC_API_GENERAL_FAILURE:
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ case RPC_LOC_API_UNSUPPORTED:
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ case RPC_LOC_API_INVALID_HANDLE:
+ return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ case RPC_LOC_API_INVALID_PARAMETER:
+ return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
+ case RPC_LOC_API_ENGINE_BUSY:
+ return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
+ case RPC_LOC_API_PHONE_OFFLINE:
+ return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
+ case RPC_LOC_API_TIMEOUT:
+ return LOC_API_ADAPTER_ERR_TIMEOUT;
+ case RPC_LOC_API_RPC_MODEM_RESTART:
+ return LOC_API_ADAPTER_ERR_ENGINE_DOWN;
+ case RPC_LOC_API_RPC_FAILURE:
+ return LOC_API_ADAPTER_ERR_FAILURE;
+ default:
+ return LOC_API_ADAPTER_ERR_UNKNOWN;
+ }
+}
+
+void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event)
+{
+ static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX;
+
+ switch (event) {
+ case RPC_SUBSYSTEM_RESTART_BEGIN:
+ if (RPC_LOC_ENGINE_STATE_OFF != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_OFF;
+ handleEngineDownEvent();
+ }
+ break;
+ case RPC_SUBSYSTEM_RESTART_END:
+ if (RPC_LOC_ENGINE_STATE_ON != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_ON;
+ handleEngineUpEvent();
+ }
+ break;
+ }
+}
+
+int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ // Parsed report
+ if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
+ {
+ reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ parsed_location_report);
+ }
+
+ // Satellite report
+ if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
+ {
+ reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report);
+ }
+
+ // Status report
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report);
+ }
+
+ // NMEA
+ if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
+ {
+ reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
+ }
+ // XTRA support: supports only XTRA download
+ if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST)
+ {
+ if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
+ {
+ requestXtraData();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_TIME_REQ)
+ {
+ requestTime();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ)
+ {
+ requestLocation();
+ }
+ }
+
+ // AGPS data request
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ loc_server_request);
+ }
+
+ // NI notify request
+ if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request);
+ }
+
+ return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to
+ // cause any issues in RPC thread context
+}
+
+enum loc_api_adapter_err
+LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ // RPC does not dynamically update the event mask. And in the
+ // case of RPC, all we support are positioning (gps + agps)
+ // masks anyways, so we simply mask all of them on always.
+ // After doing so the first time in a power cycle, we know there
+ // will the following if condition will never be true any more.
+ mask = maskAll;
+
+ if (mask != mMask) {
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ close();
+ }
+
+ mMask = mask;
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and bckground.
+ client_handle = loc_open(convertMask(mask),
+ loc_event_cb,
+ loc_rpc_global_cb, this);
+
+ if (client_handle < 0) {
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+ ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ }
+ }
+
+ return ret_val;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::close()
+{
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ loc_clear(client_handle);
+ }
+
+ loc_close(client_handle);
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::startFix(const LocPosMode& posMode) {
+ LOC_LOGD("LocApiRpc::startFix() called");
+ return convertErr(
+ loc_start_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::stopFix() {
+ LOC_LOGD("LocApiRpc::stopFix() called");
+ return convertErr(
+ loc_stop_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setPositionMode(const LocPosMode& posMode)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ rpc_loc_operation_mode_e_type op_mode;
+ int ret_val;
+ const LocPosMode* fixCriteria = &posMode;
+
+ ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode);
+
+ switch (fixCriteria->mode)
+ {
+ case LOC_POSITION_MODE_MS_BASED:
+ op_mode = RPC_LOC_OPER_MODE_MSB;
+ break;
+ case LOC_POSITION_MODE_MS_ASSISTED:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ break;
+ case LOC_POSITION_MODE_RESERVED_1:
+ op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_2:
+ op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_3:
+ op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_4:
+ case LOC_POSITION_MODE_RESERVED_5:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ fix_criteria_ptr->preferred_response_time = 0;
+ break;
+ default:
+ op_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ }
+
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->preferred_operation_mode = op_mode;
+
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+
+ if (fixCriteria->preferred_accuracy > 0) {
+ fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+ }
+ if (fixCriteria->preferred_time > 0) {
+ fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
+ }
+
+ switch (fixCriteria->recurrence) {
+ case GPS_POSITION_RECURRENCE_SINGLE:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
+ break;
+ case GPS_POSITION_RECURRENCE_PERIODIC:
+ default:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
+ break;
+ }
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_time_s_type *time_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+ int ret_val;
+
+ LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+
+ time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time;
+ time_info_ptr->time_utc = time;
+ time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::injectPosition(double latitude, double longitude, float accuracy)
+{
+ /* IOCTL data */
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_pos_s_type *assistance_data_position =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position;
+ int ret_val;
+
+ /************************************************
+ * Fill in latitude, longitude & accuracy
+ ************************************************/
+
+ /* This combo is required */
+ assistance_data_position->valid_mask =
+ RPC_LOC_ASSIST_POS_VALID_LATITUDE |
+ RPC_LOC_ASSIST_POS_VALID_LONGITUDE |
+ RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR |
+ RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL;
+
+ assistance_data_position->latitude = latitude;
+ assistance_data_position->longitude = longitude;
+ assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */
+ assistance_data_position->confidence_horizontal = 63; /* 63% (1 std dev) assumed */
+
+ /* Log */
+ LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n",
+ (double) assistance_data_position->latitude,
+ (double) assistance_data_position->longitude,
+ (double) assistance_data_position->hor_unc_circular);
+
+ ret_val = loc_eng_ioctl( client_handle,
+ RPC_LOC_IOCTL_INJECT_POSITION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+{
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+
+ memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back,
+ passThroughData, sizeof (rpc_loc_ni_event_s_type));
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ default:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ }
+
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setAPN(char* apn, int len, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ int size = sizeof(apnLastSet);
+ if (force || memcmp(apnLastSet, apn, size)) {
+ if (len < size) {
+ // size will be not larger than its original value
+ size = len + 1;
+ }
+ memcpy(apnLastSet, apn, size);
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
+ memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
+
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+void LocApiRpc::setInSession(bool inSession)
+{
+ if (!inSession) {
+ enableData(dataEnableLastSet, true);
+ setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(const char* url, int len)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
+#if (AMSS_VERSION==3200)
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len;
+#else
+ strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url,
+ sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", url);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(unsigned int ip, int port, LocServerType type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ switch (type) {
+ case LOC_AGPS_MPC_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR;
+ break;
+ case LOC_AGPS_CUSTOM_PDE_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR;
+ break;
+ default:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
+ break;
+ }
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
+ LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::enableData(int enable, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ if (force || dataEnableLastSet != enable) {
+ dataEnableLastSet = enable;
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
+
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::deleteAidingData(GpsAidingData bits)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits;
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
+{
+ LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
+
+ UlpLocation location = {0};
+ GpsLocationExtended locationExtended = {0};
+
+ location.size = sizeof(location);
+ locationExtended.size = sizeof(locationExtended);
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
+ {
+ // Process the position from final and intermediate reports
+ if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS ||
+ location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS)
+ {
+ // Latitude & Longitude
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) &&
+ (location_report_ptr->latitude != 0 ||
+ location_report_ptr->longitude != 0))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = location_report_ptr->latitude;
+ location.gpsLocation.longitude = location_report_ptr->longitude;
+
+ // Time stamp (UTC)
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.gpsLocation.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ // Altitude
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ // Speed
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal +
+ location_report_ptr->speed_vertical * location_report_ptr->speed_vertical);
+ }
+
+ // Heading
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = location_report_ptr->heading;
+ }
+
+ // Uncertainty (circular)
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ // Technology Mask
+
+ tech_Mask |= location_report_ptr->technology_mask;
+ //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->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
+ locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
+ locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = location_report_ptr->vert_unc;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = location_report_ptr->speed_unc;
+ }
+
+ LOC_LOGV("reportPosition: fire callback\n");
+ enum loc_sess_status fixStatus =
+ (location_report_ptr->session_status
+ == RPC_LOC_SESS_STATUS_IN_PROGESS ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS);
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ (void*)location_report_ptr,
+ fixStatus,
+ tech_Mask);
+ }
+ }
+ else
+ {
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_FAILURE);
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status = %d\n",
+ location_report_ptr->session_status);
+ }
+ }
+ else
+ {
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status is not set\n");
+ }
+}
+
+void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
+{
+ GpsSvStatus SvStatus = {0};
+ GpsLocationExtended locationExtended = {0};
+ locationExtended.size = sizeof(locationExtended);
+ int num_svs_max = 0;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ num_svs_max = gnss_report_ptr->sv_count;
+ if (num_svs_max > GPS_MAX_SVS)
+ {
+ num_svs_max = GPS_MAX_SVS;
+ }
+ }
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ SvStatus.num_svs = 0;
+
+ for (int i = 0; i < num_svs_max; i++)
+ {
+ sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
+ {
+ if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+ }
+ // SBAS: GPS RPN: 120-151,
+ // In exteneded measurement report, we follow nmea standard, which is from 33-64.
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
+ }
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
+ }
+ // Unsupported SV system
+ else
+ {
+ continue;
+ }
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ }
+
+ SvStatus.num_svs++;
+ }
+ }
+
+ if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
+ locationExtended.pdop = gnss_report_ptr->position_dop;
+ locationExtended.hdop = gnss_report_ptr->horizontal_dop;
+ locationExtended.vdop = gnss_report_ptr->vertical_dop;
+ }
+
+ if (SvStatus.num_svs >= 0)
+ {
+ LocApiBase::reportSv(SvStatus,
+ locationExtended,
+ (void*)gnss_report_ptr);
+ }
+}
+
+void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
+{
+
+ if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
+ if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON);
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN);
+ }
+ else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_END);
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF);
+ }
+ else
+ {
+ LocApiBase::reportStatus(GPS_STATUS_NONE);
+ }
+ }
+
+}
+
+void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+{
+
+#if (AMSS_VERSION==3200)
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#else
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences,
+ nmea_report_ptr->length);
+ LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n",
+ nmea_report_ptr->nmea_sentences[3],
+ nmea_report_ptr->nmea_sentences[4],
+ nmea_report_ptr->nmea_sentences[5]);
+#endif /* #if (AMSS_VERSION==3200) */
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setXtraData(char* data, int length)
+{
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ int total_parts;
+ uint8 part;
+ uint16 part_len;
+ uint16 len_injected;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
+ rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data);
+
+ predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data;
+ predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA;
+ predicted_orbits_data_ptr->total_size = length;
+ total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1;
+ predicted_orbits_data_ptr->total_parts = total_parts;
+
+ len_injected = 0; // O bytes injected
+ ioctl_data.disc = ioctl_type;
+
+ // XTRA injection starts with part 1
+ for (part = 1; part <= total_parts; part++)
+ {
+ predicted_orbits_data_ptr->part = part;
+ predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE;
+ if (XTRA_BLOCK_SIZE > (length - len_injected))
+ {
+ predicted_orbits_data_ptr->part_len = length - len_injected;
+ }
+ predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
+ predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n",
+ predicted_orbits_data_ptr->part,
+ total_parts,
+ predicted_orbits_data_ptr->part_len,
+ len_injected);
+
+ if (part < total_parts)
+ {
+ // No callback in this case
+ rpc_ret_val = loc_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data);
+
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
+ break;
+ }
+ //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor
+ usleep(10 * 1000);
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ if (!loc_eng_ioctl(client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
+ NULL))
+ {
+ rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ }
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
+ }
+
+ return convertErr(rpc_ret_val);
+}
+
+/* Request the Xtra Server Url from the modem */
+enum loc_api_adapter_err
+LocApiRpc::requestXtraServer()
+{
+ loc_api_adapter_err err;
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ err = convertErr(loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_data));
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS != err)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err);
+ return err;
+ }
+ else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+
+ reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[0],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[1],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[2],
+ 255);
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+{
+ rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+
+ if (AGPS_TYPE_INVALID == agpsType) {
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr->conn_handle = handle;
+ conn_open_status_ptr->open_status = open_status;
+#if (AMSS_VERSION==3200)
+ conn_open_status_ptr->apn_name = apn; /* requires APN */
+#else
+ if (is_succ) {
+ strlcpy(conn_open_status_ptr->apn_name, apn,
+ sizeof conn_open_status_ptr->apn_name);
+ } else {
+ conn_open_status_ptr->apn_name[0] = 0;
+ }
+#endif /* #if (AMSS_VERSION==3200) */
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n",
+ log_succ_fail_string(is_succ),
+ apn);
+ } else {
+ rpc_loc_server_multi_open_status_s_type *conn_multi_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS;
+ conn_multi_open_status_ptr->conn_handle = handle;
+ conn_multi_open_status_ptr->open_status = open_status;
+ if (is_succ) {
+ strlcpy(conn_multi_open_status_ptr->apn_name, apn,
+ sizeof conn_multi_open_status_ptr->apn_name);
+ } else {
+ conn_multi_open_status_ptr->apn_name[0] = 0;
+ }
+
+ switch(bearer)
+ {
+ case AGPS_APN_BEARER_IPV4:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
+ break;
+ case AGPS_APN_BEARER_IPV6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6;
+ break;
+ case AGPS_APN_BEARER_IPV4V6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6;
+ break;
+ default:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
+ }
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
+ log_succ_fail_string(is_succ),
+ apn,
+ conn_multi_open_status_ptr->pdp_type);
+ }
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlCloseStatus(int handle, int is_succ)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
+ conn_close_status_ptr->conn_handle = handle;
+ conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr)
+{
+ int connHandle;
+ AGpsType agps_type;
+
+ LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)",
+ loc_get_event_atl_open_name(server_request_ptr->event));
+ switch (server_request_ptr->event)
+ {
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle;
+ if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type
+ == RPC_LOC_SERVER_CONNECTION_LBS) {
+ agps_type = AGPS_TYPE_SUPL;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle);
+ } else {
+ agps_type = AGPS_TYPE_WWAN_ANY;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle);
+ }
+ requestATL(connHandle, agps_type);
+ break;
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle);
+ requestATL(connHandle, AGPS_TYPE_INVALID);
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle);
+ releaseATL(connHandle);
+ break;
+ default:
+ LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event);
+ }
+}
+
+void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req)
+{
+ GpsNiNotification notif = {0};
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ LOC_LOGI("VX Notification");
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ // Requestor ID
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ vx_req->requester_id.requester_id,
+ vx_req->requester_id.requester_id_length);
+ notif.text_encoding = 0; // No text and no encoding
+ notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme);
+ NIEventFillVerfiyType(notif, vx_req->notification_priv_type);
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ LOC_LOGI("UMTS CP Notification\n");
+ notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE; // Stores notification text
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text.notification_text_val,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+ umts_cp_req->requestor_id.string_len);
+#else
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string,
+ umts_cp_req->requestor_id.string_len);
+#endif
+ notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type);
+
+ // LCS address (using extras field)
+ if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0)
+ {
+ // 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;
+
+#if (AMSS_VERSION==3200)
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
+#else
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address;
+#endif /* #if (AMSS_VERSION==3200) */
+
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source,
+ umts_cp_req->ext_client_address_data.ext_client_address_len);
+
+ // The address is ASCII string
+ if (addr_len)
+ {
+ strlcat(notif.extras, lcs_addr, sizeof notif.extras);
+ }
+ }
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ LOC_LOGI("SUPL Notification\n");
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#else
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#else
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: requestor_id not present.");
+ }
+
+ // Encoding type
+ if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
+ {
+ notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ }
+ else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+ }
+ break;
+
+ default:
+ LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ return;
+ }
+
+ // this copy will get freed in loc_eng_ni when loc_ni_respond() is called
+ rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy));
+ memcpy(copy, ni_req, sizeof(*copy));
+ requestNiNotify(notif, (const void*)copy);
+}
+
+int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv)
+{
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif.notify_flags = 0;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_ACCEPT;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_DENY;
+ return 1;
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setSUPLVersion(uint32_t version)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version;
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
+{
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ return GPS_ENC_SUPL_UTF8;
+ case RPC_LOC_NI_SUPL_UCS2:
+ return GPS_ENC_SUPL_UCS2;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ return GPS_ENC_SUPL_GSM_DEFAULT;
+ case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
+ return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ default:
+ return GPS_ENC_UNKNOWN;
+ }
+}
+
+LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context) {
+ return new LocApiRpc(msgTask, exMask, context);
+}
+
+/*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+*/
+int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+ LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask);
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask);
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val);
+ return (ret_val == TRUE ? 0 : -1);
+}
+
+/*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+*/
+int LocApiRpc :: getGpsLock()
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+ boolean ret_val;
+ int ret=0;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload);
+ if(ret_val == TRUE) {
+ ret = (int)callback_payload.data.engine_lock;
+ LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__);
+ ret = -1;
+ }
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return ret;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
new file mode 100644
index 0000000..837ef11
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
new file mode 100644
index 0000000..1c48232
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
@@ -0,0 +1,345 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc_glue"
+
+#include "loc_api_log.h"
+#include "loc_log.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "rpc/rpc.h"
+#include "loc_api_fixup.h"
+
+/* Event names */
+loc_name_val_s_type loc_event_name[] =
+ {
+ NAME_VAL( RPC_LOC_EVENT_PARSED_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_SATELLITE_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_1HZ_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_LOCATION_SERVER_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_IOCTL_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_STATUS_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ),
+ };
+int loc_event_num = sizeof loc_event_name / sizeof(loc_name_val_s_type);
+
+/* Event names */
+loc_name_val_s_type loc_event_atl_open_name[] =
+ {
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_OPEN ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_CLOSE ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_MULTI_OPEN )
+ };
+int loc_event_atl_open_num = sizeof loc_event_atl_open_name / sizeof(loc_name_val_s_type);
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open)
+{
+ return loc_get_name_from_val(loc_event_atl_open_name, loc_event_atl_open_num,
+ (long) loc_event_atl_open);
+}
+
+/* IOCTL Type names */
+loc_name_val_s_type loc_ioctl_type_name[] =
+ {
+ NAME_VAL( RPC_LOC_IOCTL_GET_API_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_UTC_TIME ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_RTC_VALUE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_POSITION ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_ENGINE_STATE ),
+ NAME_VAL( RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_DATA_ENABLE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_DELETE_ASSIST_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR ),
+ };
+int loc_ioctl_type_num = sizeof loc_ioctl_type_name / sizeof(loc_name_val_s_type);
+
+/* IOCTL Status names */
+loc_name_val_s_type loc_ioctl_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_API_SUCCESS ),
+ NAME_VAL( RPC_LOC_API_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_API_UNSUPPORTED ),
+ NAME_VAL( RPC_LOC_API_INVALID_HANDLE ),
+ NAME_VAL( RPC_LOC_API_INVALID_PARAMETER ),
+ NAME_VAL( RPC_LOC_API_ENGINE_BUSY ),
+ NAME_VAL( RPC_LOC_API_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_API_TIMEOUT ),
+ NAME_VAL( RPC_LOC_API_RPC_FAILURE ),
+ NAME_VAL( RPC_LOC_API_RPC_MODEM_RESTART )
+ };
+int loc_ioctl_status_num = sizeof loc_ioctl_status_name / sizeof(loc_name_val_s_type);
+
+/* Fix session status names */
+loc_name_val_s_type loc_sess_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_SESS_STATUS_SUCCESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_IN_PROGESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_TIMEOUT ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_BAD_PARAMETER ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_ENGINE_LOCKED )
+ };
+int loc_sess_status_num = sizeof loc_sess_status_name / sizeof(loc_name_val_s_type);
+
+/* Engine state names */
+loc_name_val_s_type loc_engine_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_ENGINE_STATE_ON ),
+ NAME_VAL( RPC_LOC_ENGINE_STATE_OFF )
+ };
+int loc_engine_state_num = sizeof loc_engine_state_name / sizeof(loc_name_val_s_type);
+
+/* Fix session state names */
+loc_name_val_s_type loc_fix_session_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_BEGIN ),
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_END )
+ };
+int loc_fix_session_state_num = sizeof loc_fix_session_state_name / sizeof(loc_name_val_s_type);
+
+
+static const char* log_final_interm_string(int is_final)
+{
+ return is_final ? "final" : "intermediate";
+}
+
+/* Logs parsed report */
+static void log_parsed_report(const rpc_loc_parsed_position_s_type *parsed_report)
+{
+ rpc_loc_session_status_e_type status = parsed_report->session_status;
+ LOC_LOGD("Session status: %s Valid mask: 0x%X\n",
+ loc_get_sess_status_name(status),
+ (uint) parsed_report->valid_mask);
+ LOC_LOGD("Latitude: %.7f (%s)\n", parsed_report->latitude,
+ log_final_interm_string(
+ (parsed_report->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ parsed_report->session_status == RPC_LOC_SESS_STATUS_SUCCESS));
+ LOC_LOGD("Longitude: %.7f\n", parsed_report->longitude);
+ LOC_LOGD("Accuracy: %.7f\n", parsed_report->hor_unc_circular);
+}
+
+/* Logs status report */
+static void log_status_report(const rpc_loc_status_event_s_type *status_event)
+{
+ rpc_loc_status_event_e_type event = status_event->event;
+ switch (event) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ LOC_LOGD("Engine state: %s\n",
+ loc_get_engine_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.engine_state));
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ LOC_LOGD("Fix session state: %s\n",
+ loc_get_fix_session_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state));
+ break;
+ default:
+ break;
+ }
+}
+
+/* Logs valid fields in the GNSS SV constellation report */
+static void log_satellite_report(const rpc_loc_gnss_info_s_type *gnss)
+{
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP)
+ {
+ LOC_LOGV("position dop: %.3f\n", (float) gnss->position_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP)
+ {
+ LOC_LOGV("horizontal dop: %.3f\n", (float) gnss->horizontal_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP)
+ {
+ LOC_LOGV("vertical dop: %.3f\n", (float) gnss->vertical_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED)
+ {
+ LOC_LOGV("altitude assumed: %d\n", (int) gnss->altitude_assumed);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ LOC_LOGD("sv count: %d\n", (int) gnss->sv_count);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ LOC_LOGV("sv list: ");
+
+ if (gnss->sv_count)
+ {
+ LOC_LOGV("\n\tsys\tprn\thlth\tproc\teph\talm\telev\tazi\tsnr\n");
+ }
+ else {
+ LOC_LOGV("empty\n");
+ }
+
+ int i;
+ for (i = 0; i < gnss->sv_count; i++)
+ {
+ const rpc_loc_sv_info_s_type *sv = &gnss->sv_list.sv_list_val[i];
+ rpc_loc_sv_info_valid_mask_type mask = sv->valid_mask;
+ LOC_LOGV(" %d: \t%d\t%d\t%d\t%d\t%d\t%d\t%.3f\t%.3f\t%.3f\n", i,
+ CHECK_MASK(int, sv->system, mask, RPC_LOC_SV_INFO_VALID_SYSTEM),
+ CHECK_MASK(int, sv->prn, mask, RPC_LOC_SV_INFO_VALID_PRN),
+ CHECK_MASK(int, sv->health_status, mask, RPC_LOC_SV_INFO_VALID_HEALTH_STATUS),
+ CHECK_MASK(int, sv->process_status, mask, RPC_LOC_SV_INFO_VALID_PROCESS_STATUS),
+ CHECK_MASK(int, sv->has_eph, mask, RPC_LOC_SV_INFO_VALID_HAS_EPH),
+ CHECK_MASK(int, sv->has_alm, mask, RPC_LOC_SV_INFO_VALID_HAS_ALM),
+ CHECK_MASK(float, sv->elevation, mask, RPC_LOC_SV_INFO_VALID_ELEVATION),
+ CHECK_MASK(float, sv->azimuth, mask, RPC_LOC_SV_INFO_VALID_AZIMUTH),
+ CHECK_MASK(float, sv->snr, mask, RPC_LOC_SV_INFO_VALID_SNR)
+ );
+ }
+ }
+}
+
+/* Logs a callback event */
+int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ switch (loc_event)
+ {
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ log_satellite_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.gnss_report);
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ log_status_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.status_report);
+ break;
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ log_parsed_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.parsed_location_report);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask)
+{
+ return loc_get_name_from_mask(loc_event_name, loc_event_num,
+ (long) loc_event_mask);
+}
+
+/* Finds IOCTL type name */
+const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type)
+{
+ return loc_get_name_from_val(loc_ioctl_type_name, loc_ioctl_type_num,
+ (long) ioctl_type);
+}
+
+/* Finds IOCTL status name */
+const char* loc_get_ioctl_status_name(uint32 status)
+{
+ return loc_get_name_from_val(loc_ioctl_status_name, loc_ioctl_status_num,
+ (long) status);
+}
+
+/* Finds session status name */
+const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status)
+{
+ return loc_get_name_from_val(loc_sess_status_name, loc_sess_status_num,
+ (long) status);
+}
+
+/* Find engine state name */
+const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state)
+{
+ return loc_get_name_from_val(loc_engine_state_name, loc_engine_state_num,
+ (long) state);
+}
+
+/* Find engine state name */
+const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state)
+{
+ return loc_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num,
+ (long) state);
+}
+
+/* Event names */
+loc_name_val_s_type rpc_reset_event_name[] =
+{
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_BEGIN ),
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_END )
+};
+int rpc_reset_event_num = sizeof rpc_reset_event_name / sizeof(loc_name_val_s_type);
+
+const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event)
+{
+ return loc_get_name_from_val(rpc_reset_event_name, rpc_reset_event_num, event);
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
new file mode 100644
index 0000000..e0f400c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
@@ -0,0 +1,636 @@
+/* Copyright (c) 2011-2012, 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 FILES FOR MODULE
+
+======================================================================*/
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <loc_api_log.h>
+
+#include <rpc/rpc.h>
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "rpc_inc/loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+#define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/* Logging Improvement */
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/* Uncomment to force ALOGD messages */
+// #define ALOGD ALOGI
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_MAX_CLIENTS 16
+typedef struct
+{
+ uint32 cb_id; /* same as rpc/types.h */
+ loc_event_cb_f_type *cb_func; /* callback func */
+ loc_reset_notif_cb_f_type *rpc_cb; /* callback from RPC */
+ rpc_loc_client_handle_type handle; /* stores handle for client closing */
+ void* user; /* user's own data handle */
+} loc_glue_cb_entry_s_type;
+
+loc_glue_cb_entry_s_type loc_glue_callback_table[LOC_API_CB_MAX_CLIENTS];
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) a ## v ## b
+#define RPC_CALLBACK_FUNC_VERSION(a,v,b) RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { EXIT_LOG_CALLFLOW(%d, RPC_LOC_API_RPC_FAILURE); return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { \
+ LOC_LOGE("%s:%d] failure code %d", __func__, __LINE__, stat); \
+ return (ret_type)((stat == RPC_SUBSYSTEM_RESTART) ? \
+ RPC_LOC_API_RPC_MODEM_RESTART : RPC_LOC_API_RPC_FAILURE); \
+ }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ // The lower word of cd_id is the index
+ int index = argp->cb_id & 0xFFFF;
+
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (index >= LOC_API_CB_MAX_CLIENTS || loc_glue_callback_table[index].cb_func == NULL)
+ {
+ LOC_LOGE("Warning: No callback handler %d.\n", index);
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOC_LOGV("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOC_LOGV("Callback received: %x (cb_id=%p handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ argp->cb_id,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ /* Gives control to synchronous call handler */
+ loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload);
+
+ int32 rc = (loc_glue_callback_table[index].cb_func)(loc_glue_callback_table[index].user,
+ loc_handle, loc_event, loc_event_payload);
+
+ LOC_LOGV("cb_func=%p", loc_glue_callback_table[index].cb_func);
+
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOC_LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+/*===========================================================================
+
+FUNCTION rpc_loc_event_cb_f_type_<version>_svc (MACRO)
+
+DESCRIPTION
+ Callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_event_cb_f_type_, RPC_LOC_EVENT_CB_F_TYPE_VERSION, _svc) (
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ return rpc_loc_event_cb_f_type_svc(argp, ret, req);
+}
+
+/*===========================================================================
+
+FUNCTION loc_apicbprog_<version>_freeresult (MACRO)
+
+DESCRIPTION
+ Free up RPC data structure
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+#define VERSION_CONCAT(MAJOR,MINOR) MAJOR##MINOR
+#define loc_apicb_prog_VER_freeresult(M,N) \
+int RPC_CALLBACK_FUNC_VERSION(loc_apicbprog_, VERSION_CONCAT(M,N), _freeresult) \
+(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) \
+{ \
+ return loc_apicbprog_freeresult(transp, xdr_result, result); \
+}
+
+/* Define all of the possible minors */
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0001);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0002);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0003);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0004);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0005);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+/*===========================================================================
+
+FUNCTION rpc_loc_api_cb_null_<version>_svc (MACRO) [Patch for wrong RPCGEN stubs]
+
+DESCRIPTION
+ Null callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+
+===========================================================================*/
+#define rpc_loc_api_cb_null_VER_svc(M,N) \
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_api_cb_null_, VERSION_CONCAT(M,N), _svc) ( \
+ void *a, int *b, struct svc_req *req) \
+{ \
+ return 1; \
+}
+
+/* Define all of the possible minors */
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0001);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0002);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0003);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0004);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0005);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+static void loc_api_glue_rpc_cb(CLIENT* client, enum rpc_reset_event event)
+{
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) {
+ if (NULL != loc_glue_callback_table[i].rpc_cb) {
+ loc_glue_callback_table[i].rpc_cb(loc_glue_callback_table[i].user, client, event);
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Initialize data */
+ int i;
+ int pid = getpid();
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ loc_glue_callback_table[i].cb_id = i | (pid << 16);
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].user = NULL;
+ }
+
+ /* Print msg */
+ LOC_LOGV("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOC_LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ LOC_LOGE("Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ loc_api_sync_call_init();
+
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOC_LOGD("Loc API RPC client initialized.\n");
+ clnt_register_reset_notification_cb(loc_api_clnt, loc_api_glue_rpc_cb);
+ }
+ else {
+ LOC_LOGE("Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_cb,
+ void* userData
+)
+{
+ int try_num = RPC_TRY_NUM;
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_client_handle_type ret_val;
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+
+ int i, j = LOC_API_CB_MAX_CLIENTS;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].user == userData)
+ {
+ LOC_LOGW("Client already opened service (callback=%p)...\n",
+ event_callback);
+ break;
+ } else if (j == LOC_API_CB_MAX_CLIENTS &&
+ loc_glue_callback_table[i].user == NULL) {
+ j = i;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ i = j;
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGE("Too many clients opened at once...\n");
+ return RPC_LOC_CLIENT_HANDLE_INVALID;
+ }
+
+ loc_glue_callback_table[i].cb_func = event_callback;
+ loc_glue_callback_table[i].rpc_cb = rpc_cb;
+ loc_glue_callback_table[i].user = userData;
+
+ args.event_callback = loc_glue_callback_table[i].cb_id;
+ LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client open");
+
+ /*try more for rpc_loc_open_xx()*/
+
+ do
+ {
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
+ ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
+ try_num--;
+
+ }while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num );
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ /* save the handle in the table */
+ loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
+
+ return ret_val;
+
+}
+
+int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client close");
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt);
+
+ loc_clear(handle);
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ ret_val = (int32) rets.loc_close_result;
+
+ return ret_val;
+}
+
+void loc_clear(rpc_loc_client_handle_type handle) {
+ /* Clean the client's callback function in callback table */
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].handle == handle)
+ {
+ /* Found the client */
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].user = NULL;
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGW("Handle not found (handle=%d)...\n", (int) handle);
+ }
+}
+
+int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc start fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_start_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc stop fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_stop_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ break;
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ break;
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ break;
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ break;
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, loc_get_ioctl_type_name(ioctl_type));
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_ioctl_result;
+
+ return ret_val;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ clnt_unregister_reset_notification_cb(loc_api_clnt);
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl
+
+DESCRIPTION
+ This function calls loc_ioctl and waits for the callback result before
+ returning back to the user.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS;
+
+ ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr);
+
+ LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, returt %s\n",
+ (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type),
+ loc_get_ioctl_status_name(ret_val) );
+
+ return ret_val;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
new file mode 100644
index 0000000..ae629d7
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
@@ -0,0 +1,565 @@
+/* Copyright (c) 2011-2012, 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 <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include "loc_api_sync_call.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_slot_array_s_type loc_sync_data;
+
+pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
+boolean loc_sync_call_inited = 0;
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_init
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_init()
+{
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 1) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 1;
+
+ loc_sync_data.num_of_slots = LOC_SYNC_CALL_SLOTS_MAX;
+
+ int i;
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->not_available = 0;
+ slot->in_use = 0;
+ slot->loc_handle = -1;
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_destroy
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_destroy()
+{
+ int i;
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 0) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 0;
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->not_available = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ pthread_cond_destroy(&slot->loc_cb_arrived_cond);
+ pthread_mutex_destroy(&slot->lock);
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_match_callback
+
+DESCRIPTION
+ Checks if an awaited event has arrived
+
+RETURN VALUE
+ TRUE arrived
+ FALSE not matching
+
+===========================================================================*/
+static boolean loc_match_callback(
+ rpc_loc_event_mask_type wait_mask,
+ rpc_loc_ioctl_e_type wait_ioctl,
+ rpc_loc_event_mask_type event_mask,
+ const rpc_loc_event_payload_u_type *callback_payload
+)
+{
+ if ((event_mask & wait_mask) == 0) return FALSE;
+
+ if (event_mask != RPC_LOC_EVENT_IOCTL_REPORT || wait_ioctl == 0 ||
+ ( (callback_payload != NULL) &&
+ callback_payload->rpc_loc_event_payload_u_type_u.ioctl_report.type == wait_ioctl) )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_callback_process_sync_call
+
+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_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ int i;
+
+ ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->in_use &&
+ slot->signal_sent == 0 &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload))
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+
+ slot->loc_cb_received_event_mask = loc_event;
+
+ ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ slot->signal_sent = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+ break;
+ } else {
+ /* do nothing */
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_a_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_lock_a_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+ if (pthread_mutex_trylock(&slot->lock) == EBUSY)
+ {
+ ALOGV("trylock EBUSY : %d", i);
+ continue;
+ }
+
+ if (!slot->in_use && !slot->not_available)
+ {
+ select_id = i;
+ /* Return from here and leave the mutex locked.
+ * will unlock it in loc_unlock_slot()
+ */
+ break;
+ }
+ /* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_unlock_slot
+
+DESCRIPTION
+ Unlocks a buffer slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_unlock_slot(int select_id)
+{
+ pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_slot
+
+DESCRIPTION
+ Locks a specific slot that was previously locked from loc_lock_a_slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_lock_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_set_slot_in_use
+
+DESCRIPTION
+ Sets the in_use flag of slot to true or false.
+ Should be called only after the slot is locked
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_set_slot_in_use(int select_id, boolean in_use)
+{
+ loc_sync_data.slots[select_id].in_use = in_use;
+ if (in_use == 1)
+ loc_sync_data.slots[select_id].signal_sent = 0;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_save_callback
+
+DESCRIPTION
+ Selects which callback or IOCTL event to wait for.
+
+ The event_mask specifies the event(s). If it is RPC_LOC_EVENT_IOCTL_REPORT,
+ then ioctl_type specifies the IOCTL event.
+
+ If ioctl_type is non-zero, RPC_LOC_EVENT_IOCTL_REPORT is automatically added.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : out of buffer
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_api_save_callback(
+ int select_id, /* Selected slot */
+ rpc_loc_client_handle_type loc_handle, /* Client handle */
+ rpc_loc_event_mask_type event_mask, /* Event mask to wait for */
+ rpc_loc_ioctl_e_type ioctl_type /* IOCTL type to wait for */
+)
+{
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ slot->loc_handle = loc_handle;
+
+ slot->loc_cb_wait_event_mask = event_mask;
+ slot->ioctl_type = ioctl_type;
+ if (ioctl_type) slot->loc_cb_wait_event_mask |= RPC_LOC_EVENT_IOCTL_REPORT;
+
+ return;
+}
+
+/*===========================================================================
+
+FUNCTION loc_save_user_payload
+
+DESCRIPTION
+ Saves received payload into user data structures
+
+RETURN VALUE
+ None
+
+===========================================================================*/
+static void loc_save_user_payload(
+ rpc_loc_event_payload_u_type *user_cb_payload,
+ rpc_loc_ioctl_callback_s_type *user_ioctl_buffer,
+ const rpc_loc_event_payload_u_type *received_cb_payload
+)
+{
+ if (user_cb_payload)
+ {
+ memcpy(user_cb_payload, received_cb_payload,
+ sizeof (rpc_loc_event_payload_u_type));
+ }
+ if (user_ioctl_buffer)
+ {
+ memcpy(user_ioctl_buffer,
+ &received_cb_payload->rpc_loc_event_payload_u_type_u.ioctl_report,
+ sizeof *user_ioctl_buffer);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_wait_callback
+
+DESCRIPTION
+ Waits for a selected callback. The wait expires in timeout_seconds seconds.
+
+ If the function is called before an existing wait has finished, it will
+ immediately return EBUSY.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS if successful (0)
+ RPC_LOC_API_TIMEOUT if timed out
+ RPC_LOC_API_ENGINE_BUSY if already in a wait
+ RPC_LOC_API_INVALID_PARAMETER if callback is not yet selected
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_api_wait_callback(
+ int select_id, /* ID from loc_select_callback() */
+ int timeout_seconds, /* Timeout in this number of seconds */
+ rpc_loc_event_payload_u_type *callback_payload, /* Pointer to callback payload buffer, can be NULL */
+ rpc_loc_ioctl_callback_s_type *ioctl_payload /* Pointer to IOCTL payload, can be NULL */
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc = 0; /* return code from pthread calls */
+
+ struct timespec expire_time;
+
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ clock_gettime(CLOCK_REALTIME, &expire_time);
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Waiting */
+ while (slot->signal_sent == 0 && rc != ETIMEDOUT) {
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+ }
+
+ if (rc == ETIMEDOUT)
+ {
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ ALOGE("TIMEOUT: %d", select_id);
+ }
+ else {
+ /* Obtained the first awaited callback */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_ioctl
+
+DESCRIPTION
+ Synchronous IOCTL call (reentrant version)
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Loc API error code (0 = success)
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int rc = -1;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ select_id = loc_lock_a_slot();
+
+ if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
+ {
+ ALOGE("slot not available ioctl_type = %s",
+ loc_get_ioctl_type_name(ioctl_type));
+ return rc;
+ }
+
+ loc_set_slot_in_use(select_id, 1); // set slot in use to true
+
+ // Select the callback we are waiting for
+ loc_api_save_callback(select_id, handle, 0, ioctl_type);
+
+ loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true
+
+ // we want to avoid keeping the slot locked during the loc_ioctl because the rpc
+ // framework will also lock a different mutex during this call, and typically
+ // locking two different mutexes at the same time can lead to deadlock.
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+
+ loc_lock_slot(select_id);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else {
+ ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
+ select_id, ioctl_type);
+ // Wait for the callback of loc_ioctl
+ if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
+ {
+ // Callback waiting failed
+ ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else
+ {
+ if (cb_data_ptr) memcpy(cb_data_ptr, &callback_data, sizeof *cb_data_ptr);
+ if (callback_data.status != RPC_LOC_API_SUCCESS)
+ {
+ rc = callback_data.status;
+ ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ } else {
+ ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
+ select_id, ioctl_type, rc);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+
+ loc_set_slot_in_use(select_id, 0); // set slot in use to false
+ loc_unlock_slot(select_id);
+
+ return rc;
+}
+
+
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..db5b291
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
@@ -0,0 +1,86 @@
+/* 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.
+ */
+
+#include "rpc/rpc.h"
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+#include "rpc_inc/loc_api_fixup.h"
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+ svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ svrPort = NULL;
+}
+
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
new file mode 100644
index 0000000..c0987e6
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
@@ -0,0 +1,36 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# functions
+LOC_RPCGEN_APIS_PATH := $(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+LOC_RPCGEN_APIS_PATH_FL := ../../../../../$(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+
+LOCAL_MODULE := libloc_api_rpcgen
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_SHARED_LIBRARIES := \
+ librpc \
+ libcommondefs
+
+LOCAL_SRC_FILES += \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+LOCAL_C_INCLUDES += hardware/msm7k/librpc
+LOCAL_C_INCLUDES += $(LOC_RPCGEN_APIS_PATH)/../../SHARED_LIBRARIES/libcommondefs_intermediates/inc
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc
+
+LOCAL_COPY_HEADERS_TO := loc_api/rpcgen/inc
+LOCAL_COPY_HEADERS := inc/loc_api_rpcgen_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_common_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_cb_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_apicb_appinit.h
+
+LOCAL_LDLIBS += -lpthread
+LOCAL_PRELINK_MODULE := false
+include $(BUILD_STATIC_LIBRARY)
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
new file mode 100644
index 0000000..4ac8c8a
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
@@ -0,0 +1,42 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I./inc \
+ $(MSM7K_CFLAGS)
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ inc/loc_api_rpcgen_rpc.h \
+ inc/loc_api_rpcgen_common_rpc.h \
+ inc/loc_api_rpcgen_cb_rpc.h \
+ inc/loc_apicb_appinit.h
+
+c_sources = \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-stub/inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpcgen_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpcgen_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpcgen_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpcgen_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpcgen_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpcgen_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpcgen.la
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
new file mode 100644
index 0000000..87f2c37
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_RPC_H_RPCGEN
+#define _LOC_API_CB_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00050006
+
+#define LOC_APICBPROG 0x3100008C
+#define LOC_APICBVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001();
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc();
+extern int loc_apicbprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002();
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc();
+extern int loc_apicbprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003();
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc();
+extern int loc_apicbprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004();
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc();
+extern int loc_apicbprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005();
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc();
+extern int loc_apicbprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006();
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc();
+extern int loc_apicbprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_RPC_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
new file mode 100644
index 0000000..8107de2
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
@@ -0,0 +1,1261 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_RPC_H_RPCGEN
+#define _LOC_API_COMMON_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040030
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_API_CB_NULL_VERSION 0x00050002
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00050001
+#define RPC_LOC_STOP_FIX_VERSION 0x00050001
+#define RPC_LOC_START_FIX_VERSION 0x00050001
+#define RPC_LOC_IOCTL_VERSION 0x00050001
+#define RPC_LOC_CLOSE_VERSION 0x00050001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001
+#define RPC_LOC_OPEN_VERSION 0x00050001
+#define RPC_LOC_API_NULL_VERSION 0x00050001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0005
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+typedef struct rpc_loc_server_addr_ipv6_type rpc_loc_server_addr_ipv6_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ rpc_loc_server_addr_ipv6_type ipv6;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+typedef struct rpc_loc_pos_inj_request_s_type rpc_loc_pos_inj_request_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET = 0 + 1,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216,
+};
+typedef enum rpc_loc_server_connection_e_type rpc_loc_server_connection_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+typedef struct rpc_loc_server_multi_open_req_s_type rpc_loc_server_multi_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP = 0 + 1,
+ RPC_LOC_SERVER_PDP_IPV6 = 0 + 2,
+ RPC_LOC_SERVER_PDP_IPV4V6 = 0 + 3,
+ RPC_LOC_SERVER_PDP_MAX = 268435456,
+};
+typedef enum rpc_loc_server_pdp_type_e_type rpc_loc_server_pdp_type_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_multi_open_status_s_type rpc_loc_server_multi_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456,
+};
+typedef enum rpc_loc_error_estimate_config_e_type rpc_loc_error_estimate_config_e_type;
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ char apn_name[100];
+};
+typedef struct rpc_loc_apn_profiles_type rpc_loc_apn_profiles_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_boolean data_enable;
+ rpc_uint32 supl_version;
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_uint32 supl_version;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type (XDR *, rpc_loc_server_addr_ipv6_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type (XDR *, rpc_loc_pos_inj_request_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_connection_e_type (XDR *, rpc_loc_server_connection_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (XDR *, rpc_loc_server_multi_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type (XDR *, rpc_loc_server_pdp_type_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (XDR *, rpc_loc_server_multi_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type (XDR *, rpc_loc_error_estimate_config_e_type*);
+extern bool_t xdr_rpc_loc_apn_profiles_type (XDR *, rpc_loc_apn_profiles_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_connection_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type ();
+extern bool_t xdr_rpc_loc_apn_profiles_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_RPC_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
new file mode 100644
index 0000000..6138432
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
@@ -0,0 +1,288 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_RPC_H_RPCGEN
+#define _LOC_API_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00050006
+
+#define LOC_APIPROG 0x3000008C
+#define LOC_APIVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00050001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00050001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00050001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00050001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00050001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001();
+extern bool_t rpc_loc_api_null_0x00050001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001();
+extern bool_t rpc_loc_open_0x00050001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001();
+extern bool_t rpc_loc_close_0x00050001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001();
+extern bool_t rpc_loc_start_fix_0x00050001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001();
+extern bool_t rpc_loc_stop_fix_0x00050001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001();
+extern bool_t rpc_loc_ioctl_0x00050001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001();
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc();
+extern int loc_apiprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050002();
+extern bool_t rpc_loc_api_null_0x00050002_svc();
+extern int loc_apiprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050003(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050003_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050003();
+extern bool_t rpc_loc_api_null_0x00050003_svc();
+extern int loc_apiprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050004(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050004_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050004();
+extern bool_t rpc_loc_api_null_0x00050004_svc();
+extern int loc_apiprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050005(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050005_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050005();
+extern bool_t rpc_loc_api_null_0x00050005_svc();
+extern int loc_apiprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050006(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050006_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050006();
+extern bool_t rpc_loc_api_null_0x00050006_svc();
+extern int loc_apiprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_RPC_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..875c4f0
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* 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.
+ *
+ */
+
+/* Initialization function for callbacks */
+int loc_apicb_app_init();
+
+void loc_apicb_app_deinit();
+
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
new file mode 100644
index 0000000..2ef5852
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
@@ -0,0 +1,327 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00050001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00050001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00050001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00050001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050002(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050002_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050002_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050002_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050003(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050003_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050003_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050003_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050004(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050004_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050004_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050004_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050005(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050005_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050005_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050005_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050006(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050006_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050006_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050006_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
new file mode 100644
index 0000000..ad171dc
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
new file mode 100644
index 0000000..3e39576
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
@@ -0,0 +1,155 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api_rpcgen_rpc.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00050001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00050001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00050001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00050001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050003(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050004(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050005(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050006(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
new file mode 100644
index 0000000..21be8f4
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
@@ -0,0 +1,1775 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_common_rpc.h"
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv6_type (XDR *xdrs, rpc_loc_server_addr_ipv6_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_vector (xdrs, (char *)objp->addr, 8,
+ sizeof (rpc_uint16), (xdrproc_t) xdr_rpc_uint16))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ if (!xdr_rpc_loc_server_addr_ipv6_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv6))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_inj_request_s_type (XDR *xdrs, rpc_loc_pos_inj_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->position_uncertainty))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ if (!xdr_rpc_loc_pos_inj_request_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.pos_injection))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_e_type (XDR *xdrs, rpc_loc_server_connection_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_req_s_type (XDR *xdrs, rpc_loc_server_multi_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ if (!xdr_rpc_loc_server_connection_e_type (xdrs, &objp->connection_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ if (!xdr_rpc_loc_server_multi_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.multi_open_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_pdp_type_e_type (XDR *xdrs, rpc_loc_server_pdp_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_status_s_type (XDR *xdrs, rpc_loc_server_multi_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_rpc_loc_server_pdp_type_e_type (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_error_estimate_config_e_type (XDR *xdrs, rpc_loc_error_estimate_config_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_apn_profiles_type (XDR *xdrs, rpc_loc_apn_profiles_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint32 (xdrs, &objp->srv_system_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ if (!xdr_rpc_loc_error_estimate_config_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.error_estimate_config))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.data_enable))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_multi_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.multi_conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_callback_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
new file mode 100644
index 0000000..a0fdcab
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
@@ -0,0 +1,199 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_rpc.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..b469eb0
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ */
+#include "librpc.h"
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_0x00010001 */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+
+
+
+ if(svc_register(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+void loc_apicb_app_deinit(void)
+{
+
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+
+ svc_unregister(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001);
+}
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
new file mode 100644
index 0000000..82dca56
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
@@ -0,0 +1,261 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00050006 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050002;
+
+version LOC_APIVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050003;
+
+version LOC_APIVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050004;
+
+version LOC_APIVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APIVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050006;
+
+
+} = 0x3000008C;
+
+const LOC_APIVERS = 0x00050006;
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
new file mode 100644
index 0000000..4756c6c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
@@ -0,0 +1,187 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00050006 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APICBVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050002;
+
+version LOC_APICBVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050003;
+
+version LOC_APICBVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050004;
+
+version LOC_APICBVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APICBVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050006;
+
+
+} = 0x3100008C;
+
+const LOC_APICBVERS = 0x00050006;
diff --git a/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
new file mode 100644
index 0000000..e059c66
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
@@ -0,0 +1,1021 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040030;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_API_CB_NULL_VERSION = 0x00050002;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00050001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00050001;
+const RPC_LOC_START_FIX_VERSION = 0x00050001;
+const RPC_LOC_IOCTL_VERSION = 0x00050001;
+const RPC_LOC_CLOSE_VERSION = 0x00050001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001;
+const RPC_LOC_OPEN_VERSION = 0x00050001;
+const RPC_LOC_API_NULL_VERSION = 0x00050001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0005;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[200];
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256];
+};
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ rpc_loc_server_addr_ipv6_type ipv6;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20];
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP,
+ RPC_LOC_SERVER_PDP_IPV6,
+ RPC_LOC_SERVER_PDP_IPV4V6,
+ RPC_LOC_SERVER_PDP_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100];
+};
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456
+};
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ rpc_boolean data_enable;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/msm8084/loc_api/libloc_api-rpc/Android.mk b/msm8084/loc_api/libloc_api-rpc/Android.mk
new file mode 100644
index 0000000..06e4694
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/Android.mk
@@ -0,0 +1,61 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+AMSS_VERSION:=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION)
+RPC_INC:=inc-$(AMSS_VERSION)
+
+generated_files:= \
+ gen-$(AMSS_VERSION)/loc_api_clnt.c \
+ gen-$(AMSS_VERSION)/loc_api_cb_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_common_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_cb_svc.c \
+ gen-$(AMSS_VERSION)/loc_api_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_fixup.c \
+ gen-$(AMSS_VERSION)/loc_api_rpc_glue.c \
+ src/loc_apicb_appinit.c
+
+LOCAL_SRC_FILES:= $(generated_files)
+
+# removed from library build since the client should implement this code.
+# src/loc_api_cb_server.c
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-include $(RPC_INC)/loc_api_common.h
+LOCAL_CFLAGS+=-DDEBUG
+# LOCAL_CFLAGS+=-DDEBUG -DVERBOSE
+
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= librpc
+LOCAL_STATIC_LIBRARIES:= libcommondefs-rpc
+
+
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc/inc
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_cb.h \
+ $(RPC_INC)/loc_api_common.h \
+ $(RPC_INC)/loc_api.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ inc/debug.h \
+ inc/loc_api_rpc_glue.h
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/inc \
+ $(LOCAL_PATH)/$(RPC_INC) \
+ $(TARGET_OUT_HEADERS)/libcommondefs-rpc \
+ $(TARGET_OUT_HEADERS)/librpc
+
+LOCAL_MODULE:= libloc_api-rpc
+LOCAL_MODULE_OWNER := qcom
+
+include $(BUILD_STATIC_LIBRARY)
+
+endif
+endif
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr b/msm8084/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
new file mode 100644
index 0000000..5d9cf6c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
@@ -0,0 +1,29 @@
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
new file mode 100644
index 0000000..a9d60aa
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
@@ -0,0 +1,172 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00040002 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00040001;
+
+
+
+ version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_ni_event_e_type in 0x00040002
+RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00040002;
+
+
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00040002;
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
new file mode 100644
index 0000000..1bd4e15
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
@@ -0,0 +1,85 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00040002 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00040001;
+
+
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00040002;
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c
new file mode 100644
index 0000000..52a0d15
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00040001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00040001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00040001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00040001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00040001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c
new file mode 100644
index 0000000..dca1e8d
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c
@@ -0,0 +1,91 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00040001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00040001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00040001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00040001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00040002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
new file mode 100644
index 0000000..4e01607
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
@@ -0,0 +1,906 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040024;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00040001;
+const RPC_LOC_OPEN_VERSION = 0x00040001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00040001;
+const RPC_LOC_API_NULL_VERSION = 0x00040001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00040001;
+const RPC_LOC_IOCTL_VERSION = 0x00040001;
+const RPC_LOC_START_FIX_VERSION = 0x00040001;
+const RPC_LOC_CLOSE_VERSION = 0x00040001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00040001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0004;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef bool rpc_boolean;
+
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[1200]; /* EVAL:[1200]*/
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256]; /* EVAL:[256]*/
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200]; /* EVAL:[200]*/
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4]; /* EVAL:[4]*/
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200]; /* EVAL:[200]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64]; /* EVAL:[64]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8]; /* EVAL:[8]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20]; /* EVAL:[20]*/
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20]; /* EVAL:[20]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64]; /* EVAL:[64]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+ typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+ typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100]; /* EVAL:[100]*/
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6]; /* EVAL:[6]*/
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50]; /* EVAL:[50]*/
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64]; /* EVAL:[64]*/
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8]; /* EVAL:[8]*/
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c
new file mode 100644
index 0000000..7c860bf
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c
@@ -0,0 +1,1650 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 1200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
new file mode 100644
index 0000000..fe512f5
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
new file mode 100644
index 0000000..fbaca8b
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00040001_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00040001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr b/msm8084/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
new file mode 100644
index 0000000..5d9cf6c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
@@ -0,0 +1,29 @@
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
new file mode 100644
index 0000000..981266b
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
@@ -0,0 +1,164 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00010001 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+ } = 0x00010001;
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00010001;
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
new file mode 100644
index 0000000..3f53504
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
@@ -0,0 +1,90 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00010001 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+ } = 0x00010001;
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00010001;
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c
new file mode 100644
index 0000000..b1aa199
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00010001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00010001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00010001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00010001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00010001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c
new file mode 100644
index 0000000..79814d4
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c
@@ -0,0 +1,82 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00010001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00010001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00010001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00010001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
new file mode 100644
index 0000000..7ef6357
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
@@ -0,0 +1,803 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_OPEN_VERSION = 0x00010001;
+const RPC_LOC_CLOSE_VERSION = 0x00010001;
+const RPC_LOC_START_FIX_VERSION = 0x00010001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00010001;
+const RPC_LOC_IOCTL_VERSION = 0x00010001;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00010001;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0001;
+typedef bool rpc_boolean;
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<RPC_LOC_API_MAX_SV_COUNT>;
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences<RPC_LOC_API_MAX_NMEA_STRING_LENGTH>;
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string<RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ unsigned char maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address<RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS>;
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string<RPC_LOC_NI_CODEWORD_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ string apn_name<>;
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+const RPC_LOC_API_NULL_VERSION = 0x00010001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00010001;
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
new file mode 100644
index 0000000..7b37b9c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
@@ -0,0 +1,1441 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->apn_name, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
new file mode 100644
index 0000000..fe512f5
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
new file mode 100644
index 0000000..8c17122
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00010001_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00010001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api.h b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api.h
new file mode 100644
index 0000000..e02648c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api.h
@@ -0,0 +1,210 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00040002
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00040001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00040001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00040001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00040001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00040001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00040001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00040001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00040001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00040001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00040001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00040001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00040001();
+extern bool_t rpc_loc_api_null_0x00040001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00040001();
+extern bool_t rpc_loc_open_0x00040001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00040001();
+extern bool_t rpc_loc_close_0x00040001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00040001();
+extern bool_t rpc_loc_start_fix_0x00040001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00040001();
+extern bool_t rpc_loc_stop_fix_0x00040001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00040001();
+extern bool_t rpc_loc_ioctl_0x00040001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00040001();
+extern bool_t rpc_loc_api_api_versions_0x00040001_svc();
+extern int loc_apiprog_0x00040001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00040002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00040002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00040002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00040002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00040002();
+extern bool_t rpc_loc_api_null_0x00040002_svc();
+extern int loc_apiprog_0x00040002_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h
new file mode 100644
index 0000000..67ac084
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00040002
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00040001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001();
+extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc();
+extern int loc_apicbprog_0x00040001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h
new file mode 100644
index 0000000..6ff3baf
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h
@@ -0,0 +1,1154 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040024
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00040001
+#define RPC_LOC_OPEN_VERSION 0x00040001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00040001
+#define RPC_LOC_API_NULL_VERSION 0x00040001
+#define RPC_LOC_STOP_FIX_VERSION 0x00040001
+#define RPC_LOC_IOCTL_VERSION 0x00040001
+#define RPC_LOC_START_FIX_VERSION 0x00040001
+#define RPC_LOC_CLOSE_VERSION 0x00040001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00040001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0004
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[1200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
new file mode 100644
index 0000000..e62eb36
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
new file mode 100644
index 0000000..92d4e15
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api.h b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api.h
new file mode 100644
index 0000000..8998aca
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api.h
@@ -0,0 +1,198 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00010001
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00010001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00010001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00010001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00010001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00010001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00010001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00010001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00010001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00010001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00010001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00010001();
+extern bool_t rpc_loc_api_null_0x00010001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00010001();
+extern bool_t rpc_loc_open_0x00010001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00010001();
+extern bool_t rpc_loc_close_0x00010001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00010001();
+extern bool_t rpc_loc_start_fix_0x00010001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00010001();
+extern bool_t rpc_loc_stop_fix_0x00010001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00010001();
+extern bool_t rpc_loc_ioctl_0x00010001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00010001();
+extern bool_t rpc_loc_api_api_versions_0x00010001_svc();
+extern int loc_apiprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h
new file mode 100644
index 0000000..4f2f8f9
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00010001
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001();
+extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc();
+extern int loc_apicbprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
new file mode 100644
index 0000000..04be079
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
@@ -0,0 +1,1031 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_OPEN_VERSION 0x00010001
+#define RPC_LOC_CLOSE_VERSION 0x00010001
+#define RPC_LOC_START_FIX_VERSION 0x00010001
+#define RPC_LOC_STOP_FIX_VERSION 0x00010001
+#define RPC_LOC_IOCTL_VERSION 0x00010001
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00010001
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+#define RPC_LOC_API_API_MAJOR_NUM 0x0001
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ struct {
+ u_int nmea_sentences_len;
+ char *nmea_sentences_val;
+ } nmea_sentences;
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ struct {
+ u_int addr_len;
+ char *addr_val;
+ } addr;
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int requestor_id_string_len;
+ char *requestor_id_string_val;
+ } requestor_id_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int client_name_string_len;
+ char *client_name_string_val;
+ } client_name_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ u_char maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ struct {
+ u_int ext_client_address_len;
+ char *ext_client_address_val;
+ } ext_client_address;
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int lcs_codeword_string_len;
+ char *lcs_codeword_string_val;
+ } lcs_codeword_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ struct {
+ u_int notification_text_len;
+ char *notification_text_val;
+ } notification_text;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char *apn_name;
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+#define RPC_LOC_API_NULL_VERSION 0x00010001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00010001
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
new file mode 100644
index 0000000..e62eb36
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
new file mode 100644
index 0000000..92d4e15
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8084/loc_api/libloc_api-rpc/inc/debug.h b/msm8084/loc_api/libloc_api-rpc/inc/debug.h
new file mode 100644
index 0000000..a71b23a
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc/debug.h
@@ -0,0 +1,57 @@
+/*
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "libgps-rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ LOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ LOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ LOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/msm8084/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h b/msm8084/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..ef972bd
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
@@ -0,0 +1,100 @@
+/******************************************************************************
+ @file: loc_api_rpc_glue.h
+ @brief: Loc API Android glue code header
+
+ DESCRIPTION
+ Loc API Android glue code header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/17/09 dx Initial version
+
+$Id: //source/qcom/qct/modem/gps/cgps/dev/locationmiddleware/locapi/app-linux/source/test/loc_api_test/loc_api_cb_log.h#4 $
+======================================================================*/
+
+#ifndef LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#include "loc_api_common.h"
+#include "loc_api.h"
+#include "loc_api_cb.h"
+#include "loc_api_fixup.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/msm8084/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c b/msm8084/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..7fcfd6c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
@@ -0,0 +1,61 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 "rpc/rpc.h"
+#include "loc_api_common.h"
+#include "loc_api.h"
+#include "loc_api_cb.h"
+#include "loc_api_fixup.h"
+
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ svrPort = NULL;
+}
diff --git a/msm8084/loc_api/libloc_api_50001/Android.mk b/msm8084/loc_api/libloc_api_50001/Android.mk
new file mode 100644
index 0000000..e38befa
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/Android.mk
@@ -0,0 +1,105 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_eng
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_nmea.cpp \
+ LocEngAdapter.cpp
+
+LOCAL_SRC_FILES += \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_COPY_HEADERS_TO:= libloc_eng/
+LOCAL_COPY_HEADERS:= \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+## Libs
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_eng \
+ libloc_core \
+ libgps.utils \
+ libdl
+
+LOCAL_SRC_FILES += \
+ loc.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+ifeq ($(TARGET_USES_QCOM_BSP), true)
+LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
+endif
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+ifneq ($(filter msm8084,$(TARGET_BOARD_PLATFORM)),)
+ LOCAL_CFLAGS += -DPLATFORM_MSM8084
+endif
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/msm8084/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msm8084/loc_api/libloc_api_50001/LocEngAdapter.cpp
new file mode 100644
index 0000000..16a150d
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -0,0 +1,380 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_EngAdapter"
+
+#include <LocEngAdapter.h>
+#include "loc_eng_msg.h"
+#include "loc_log.h"
+
+using namespace loc_core;
+
+LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
+ LocAdapterBase(adapter->getMsgTask()),
+ mLocEngAdapter(adapter)
+{
+}
+void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
+ sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
+}
+void LocInternalAdapter::startFixInt() {
+ sendMsg(new LocEngStartFix(mLocEngAdapter));
+}
+void LocInternalAdapter::stopFixInt() {
+ sendMsg(new LocEngStopFix(mLocEngAdapter));
+}
+void LocInternalAdapter::getZppInt() {
+ sendMsg(new LocEngGetZpp(mLocEngAdapter));
+}
+
+void LocInternalAdapter::shutdown() {
+ sendMsg(new LocEngShutdown(mLocEngAdapter));
+}
+
+LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ MsgTask::tCreate tCreator) :
+ LocAdapterBase(mask,
+ //Get the AFW context if VzW context has not already been intialized in
+ //loc_ext
+ context == NULL?
+ LocDualContext::getLocFgContext(tCreator,
+ LocDualContext::mLocationHalName)
+ :context),
+ mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
+ mUlp(new UlpProxyBase()), mNavigating(false),
+ mSupportsAgpsRequests(false),
+ mSupportsPositionInjection(false), mPowerVote(0)
+{
+ memset(&mFixCriteria, 0, sizeof(mFixCriteria));
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ LOC_LOGD("LocEngAdapter created");
+}
+
+inline
+LocEngAdapter::~LocEngAdapter()
+{
+ delete mInternalAdapter;
+ LOC_LOGV("LocEngAdapter deleted");
+}
+
+void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
+ struct LocSetUlpProxy : public LocMsg {
+ LocAdapterBase* mAdapter;
+ UlpProxyBase* mUlp;
+ inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
+ LocMsg(), mAdapter(adapter), mUlp(ulp) {
+ }
+ virtual void proc() const {
+ LOC_LOGV("%s] ulp %p adapter %p", __func__,
+ mUlp, mAdapter);
+ mAdapter->setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
+}
+
+void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ if (ulp == mUlp) {
+ //This takes care of the case when double initalization happens
+ //and we get the same object back for UlpProxyBase . Do nothing
+ return;
+ }
+
+ LOC_LOGV("%s] %p", __func__, ulp);
+ if (NULL == ulp) {
+ LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__);
+ ulp = new UlpProxyBase();
+ }
+
+ if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) {
+ // need to send this mode and start msg to ULP
+ ulp->sendFixMode(mUlp->mPosMode);
+ }
+
+ if(mUlp->mFixSet) {
+ ulp->sendStartFix();
+ }
+
+ delete mUlp;
+ mUlp = ulp;
+}
+
+int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask)
+{
+ struct LocEngAdapterGpsLock : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LOC_GPS_LOCK_MASK mLockMask;
+ inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) :
+ LocMsg(), mAdapter(adapter), mLockMask(lockMask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setGpsLock(mLockMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+ };
+ sendMsg(new LocEngAdapterGpsLock(this, lockMask));
+ return 0;
+}
+
+void LocEngAdapter::requestPowerVote()
+{
+ if (getPowerVoteRight()) {
+ /* Power voting without engine lock:
+ * 101: vote down, 102-104 - vote up
+ * These codes are used not to confuse with actual engine lock
+ * functionality, that can't be used in SSR scenario, as it
+ * conflicts with initialization sequence.
+ */
+ bool powerUp = getPowerVote();
+ LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp);
+ setGpsLock(powerUp ? 103 : 101);
+ }
+}
+
+void LocInternalAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ sendMsg(new LocEngReportPosition(mLocEngAdapter,
+ location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask));
+}
+
+
+void LocEngAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ if (! mUlp->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask )) {
+ mInternalAdapter->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask);
+ }
+}
+
+void LocInternalAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt){
+ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
+ locationExtended, svExt));
+}
+
+void LocEngAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+
+ // We want to send SV info to ULP to help it in determining GNSS
+ // signal strength ULP will forward the SV reports to HAL without
+ // any modifications
+ if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
+ mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
+ }
+}
+
+void LocEngAdapter::setInSession(bool inSession)
+{
+ mNavigating = inSession;
+ mLocApi->setInSession(inSession);
+ if (!mNavigating) {
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ }
+}
+
+void LocInternalAdapter::reportStatus(GpsStatusValue status)
+{
+ sendMsg(new LocEngReportStatus(mLocEngAdapter, status));
+}
+
+void LocEngAdapter::reportStatus(GpsStatusValue status)
+{
+ if (!mUlp->reportStatus(status)) {
+ mInternalAdapter->reportStatus(status);
+ }
+}
+
+inline
+void LocEngAdapter::reportNmea(const char* nmea, int length)
+{
+ sendMsg(new LocEngReportNmea(mOwner, nmea, length));
+}
+
+inline
+bool LocEngAdapter::reportXtraServer(const char* url1,
+ const char* url2,
+ const char* url3,
+ const int maxlength)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReportXtraServer(mOwner, url1,
+ url2, url3, maxlength));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestATL(mOwner,
+ connHandle, agps_type));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::releaseATL(int connHandle)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReleaseATL(mOwner, connHandle));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestXtraData()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestXtra(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestTime()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestTime(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data)
+{
+ if (mSupportsAgpsRequests) {
+ notif.size = sizeof(notif);
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ sendMsg(new LocEngRequestNi(mOwner, notif, data));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestSuplES(int connHandle)
+{
+ if (mSupportsAgpsRequests)
+ sendMsg(new LocEngRequestSuplEs(mOwner, connHandle));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallOpened()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsOpened(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallClosed()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsClosed(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+void LocEngAdapter::handleEngineDownEvent()
+{
+ sendMsg(new LocEngDown(mOwner));
+}
+
+inline
+void LocEngAdapter::handleEngineUpEvent()
+{
+ sendMsg(new LocEngUp(mOwner));
+}
+
+void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+{
+ sendMsg(new LocEngReportGpsMeasurement(mOwner,
+ gpsMeasurementData));
+}
+
+/*
+ Update Registration Mask
+ */
+void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+{
+ LOC_LOGD("entering %s", __func__);
+ int result = LOC_API_ADAPTER_ERR_FAILURE;
+ result = mLocApi->updateRegistrationMask(event, isEnabled);
+ if (result == LOC_API_ADAPTER_ERR_SUCCESS) {
+ LOC_LOGD("%s] update registration mask succeed.", __func__);
+ } else {
+ LOC_LOGE("%s] update registration mask failed.", __func__);
+ }
+}
+
+/*
+ Set Gnss Constellation Config
+ */
+bool LocEngAdapter::gnssConstellationConfig()
+{
+ LOC_LOGD("entering %s", __func__);
+ bool result = false;
+ result = mLocApi->gnssConstellationConfig();
+ return result;
+}
diff --git a/msm8084/loc_api/libloc_api_50001/LocEngAdapter.h b/msm8084/loc_api/libloc_api_50001/LocEngAdapter.h
new file mode 100644
index 0000000..fe5df3c
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -0,0 +1,352 @@
+/* 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 LOC_API_ENG_ADAPTER_H
+#define LOC_API_ENG_ADAPTER_H
+
+#include <ctype.h>
+#include <hardware/gps.h>
+#include <loc.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <platform_lib_includes.h>
+
+#define MAX_URL_LEN 256
+
+using namespace loc_core;
+
+class LocEngAdapter;
+
+class LocInternalAdapter : public LocAdapterBase {
+ LocEngAdapter* mLocEngAdapter;
+public:
+ LocInternalAdapter(LocEngAdapter* adapter);
+
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void setPositionModeInt(LocPosMode& posMode);
+ virtual void startFixInt();
+ virtual void stopFixInt();
+ virtual void getZppInt();
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ virtual void shutdown();
+};
+
+typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
+
+class LocEngAdapter : public LocAdapterBase {
+ void* mOwner;
+ LocInternalAdapter* mInternalAdapter;
+ UlpProxyBase* mUlp;
+ LocPosMode mFixCriteria;
+ bool mNavigating;
+ // mPowerVote is encoded as
+ // mPowerVote & 0x20 -- powerVoteRight
+ // mPowerVote & 0x10 -- power On / Off
+ unsigned int mPowerVote;
+ static const unsigned int POWER_VOTE_RIGHT = 0x20;
+ static const unsigned int POWER_VOTE_VALUE = 0x10;
+
+public:
+ bool mSupportsAgpsRequests;
+ bool mSupportsPositionInjection;
+
+ LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ MsgTask::tCreate tCreator);
+ virtual ~LocEngAdapter();
+
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ inline void requestUlp(unsigned long capabilities) {
+ mContext->requestUlp(mInternalAdapter, capabilities);
+ }
+ inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
+ inline UlpProxyBase* getUlpProxy() { return mUlp; }
+ inline void* getOwner() { return mOwner; }
+ inline bool hasAgpsExtendedCapabilities() {
+ return mContext->hasAgpsExtendedCapabilities();
+ }
+ inline bool hasCPIExtendedCapabilities() {
+ return mContext->hasCPIExtendedCapabilities();
+ }
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+
+ inline enum loc_api_adapter_err
+ startFix()
+ {
+ return mLocApi->startFix(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ stopFix()
+ {
+ return mLocApi->stopFix();
+ }
+ inline enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f)
+ {
+ return mLocApi->deleteAidingData(f);
+ }
+ inline enum loc_api_adapter_err
+ enableData(int enable)
+ {
+ return mLocApi->enableData(enable);
+ }
+ inline enum loc_api_adapter_err
+ setAPN(char* apn, int len)
+ {
+ return mLocApi->setAPN(apn, len);
+ }
+ inline enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy)
+ {
+ return mLocApi->injectPosition(latitude, longitude, accuracy);
+ }
+ inline enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+ {
+ return mLocApi->setTime(time, timeReference, uncertainty);
+ }
+ inline enum loc_api_adapter_err
+ setXtraData(char* data, int length)
+ {
+ return mLocApi->setXtraData(data, length);
+ }
+ inline enum loc_api_adapter_err
+ requestXtraServer()
+ {
+ return mLocApi->requestXtraServer();
+ }
+ inline enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+ {
+ return mLocApi->atlOpenStatus(handle, is_succ, apn, bearer, agpsType);
+ }
+ inline enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ)
+ {
+ return mLocApi->atlCloseStatus(handle, is_succ);
+ }
+ inline enum loc_api_adapter_err
+ setPositionMode(const LocPosMode *posMode)
+ {
+ if (NULL != posMode) {
+ mFixCriteria = *posMode;
+ }
+ return mLocApi->setPositionMode(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ setServer(const char* url, int len)
+ {
+ return mLocApi->setServer(url, len);
+ }
+ inline enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+ {
+ return mLocApi->setServer(ip, port, type);
+ }
+ inline enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData)
+ {
+ return mLocApi->informNiResponse(userResponse, passThroughData);
+ }
+ inline enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version)
+ {
+ return mLocApi->setSUPLVersion(version);
+ }
+ inline enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile)
+ {
+ return mLocApi->setLPPConfig(profile);
+ }
+ inline enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider)
+ {
+ return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider);
+ }
+ inline enum loc_api_adapter_err
+ setSensorProperties(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)
+ {
+ return mLocApi->setSensorProperties(gyroBiasVarianceRandomWalk_valid, gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid, angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid, rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid, velocityBiasVarianceRandomWalk);
+ }
+ inline virtual enum loc_api_adapter_err
+ setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
+ {
+ return mLocApi->setSensorPerfControlConfig(controlMode, accelSamplesPerBatch, accelBatchesPerSec,
+ gyroSamplesPerBatch, gyroBatchesPerSec,
+ accelSamplesPerBatchHigh, accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
+ algorithmConfig);
+ }
+ inline virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging)
+ {
+ return mLocApi->setExtPowerConfig(isBatteryCharging);
+ }
+ inline virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+ {
+ return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
+ }
+ inline virtual int initDataServiceClient()
+ {
+ return mLocApi->initDataServiceClient();
+ }
+ inline virtual int openAndStartDataCall()
+ {
+ return mLocApi->openAndStartDataCall();
+ }
+ inline virtual void stopDataCall()
+ {
+ mLocApi->stopDataCall();
+ }
+ inline virtual void closeDataCall()
+ {
+ mLocApi->closeDataCall();
+ }
+ inline enum loc_api_adapter_err
+ getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
+ {
+ return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
+ }
+
+ inline virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+ {
+ mLocApi->installAGpsCert(pData, length, slotBitMask);
+ }
+
+ virtual void handleEngineDownEvent();
+ virtual void handleEngineUpEvent();
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+
+ inline const LocPosMode& getPositionMode() const
+ {return mFixCriteria;}
+ inline virtual bool isInSession()
+ { return mNavigating; }
+ void setInSession(bool inSession);
+
+ // Permit/prohibit power voting
+ inline void setPowerVoteRight(bool powerVoteRight) {
+ mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) :
+ (mPowerVote & ~POWER_VOTE_RIGHT);
+ }
+ inline bool getPowerVoteRight() const {
+ return (mPowerVote & POWER_VOTE_RIGHT) != 0 ;
+ }
+ // Set the power voting up/down and do actual operation if permitted
+ inline void setPowerVote(bool powerOn) {
+ mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) :
+ (mPowerVote & ~POWER_VOTE_VALUE);
+ requestPowerVote();
+ }
+ inline bool getPowerVote() const {
+ return (mPowerVote & POWER_VOTE_VALUE) != 0 ;
+ }
+ // Do power voting according to last settings if permitted
+ void requestPowerVote();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ inline int setGpsLock(LOC_GPS_LOCK_MASK lock)
+ {
+ return mLocApi->setGpsLock(lock);
+ }
+
+ int setGpsLockMsg(LOC_GPS_LOCK_MASK lock);
+
+ /*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+ */
+ inline int getGpsLock()
+ {
+ return mLocApi->getGpsLock();
+ }
+
+ /*
+ Update Registration Mask
+ */
+ void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+
+ /*
+ Set Gnss Constellation Config
+ */
+ bool gnssConstellationConfig();
+};
+
+#endif //LOC_API_ENG_ADAPTER_H
diff --git a/msm8084/loc_api/libloc_api_50001/Makefile.am b/msm8084/loc_api/libloc_api_50001/Makefile.am
new file mode 100644
index 0000000..2374357
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/Makefile.am
@@ -0,0 +1,76 @@
+AM_CFLAGS = \
+ -I../../utils \
+ -I../../platform_lib_abstractions \
+ -fno-short-enums \
+ -DFEATURE_GNSS_BIT_API
+
+libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp
+
+if USE_GLIB
+libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la
+
+
+libloc_eng_so_la_SOURCES = \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+
+if USE_GLIB
+libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_eng_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la
+
+
+libgps_default_so_la_SOURCES = \
+ loc.cpp \
+ gps.c
+
+if USE_GLIB
+libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_default_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la
+
+library_include_HEADERS = \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+library_includedir = $(pkgincludedir)/libloc_api_50001
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la
diff --git a/msm8084/loc_api/libloc_api_50001/gps.c b/msm8084/loc_api/libloc_api_50001/gps.c
new file mode 100644
index 0000000..46596aa
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/gps.c
@@ -0,0 +1,73 @@
+/* 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.
+ *
+ */
+
+#include <hardware/gps.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
+
+ if(dev == NULL)
+ return -1;
+
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = 1,
+ .hal_api_version = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/msm8084/loc_api/libloc_api_50001/loc.cpp b/msm8084/loc_api/libloc_api_50001/loc.cpp
new file mode 100644
index 0000000..6eaf9f9
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc.cpp
@@ -0,0 +1,1180 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_afw"
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_eng.h>
+#include <loc_target.h>
+#include <loc_log.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <LocDualContext.h>
+#include <cutils/properties.h>
+
+using namespace loc_core;
+
+//Globals defns
+static gps_location_callback gps_loc_cb = NULL;
+static gps_sv_status_callback gps_sv_cb = NULL;
+static agps_status_callback agps_status_cb = NULL;
+
+static void local_loc_cb(UlpLocation* location, void* locExt);
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
+static void loc_agps_status_cb(AGpsStatus* status);
+
+static const GpsGeofencingInterface* get_geofence_interface(void);
+
+// Function declarations for sLocEngInterface
+static int loc_init(GpsCallbacks* callbacks);
+static int loc_start();
+static int loc_stop();
+static void loc_cleanup();
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_inject_location(double latitude, double longitude, float accuracy);
+static void loc_delete_aiding_data(GpsAidingData f);
+static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy,
+ uint32_t preferred_time);
+static const void* loc_get_extension(const char* name);
+static void loc_close_mdm_node();
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_init,
+ loc_start,
+ loc_stop,
+ loc_cleanup,
+ loc_inject_time,
+ loc_inject_location,
+ loc_delete_aiding_data,
+ loc_set_position_mode,
+ loc_get_extension
+};
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_agps_init(AGpsCallbacks* callbacks);
+static int loc_agps_open(const char* apn);
+static int loc_agps_closed();
+static int loc_agps_open_failed();
+static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType);
+
+static const AGpsInterface sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface),
+ loc_agps_init,
+ loc_agps_open,
+ loc_agps_closed,
+ loc_agps_open_failed,
+ loc_agps_set_server,
+ loc_agps_open_with_apniptype
+};
+
+static int loc_xtra_init(GpsXtraCallbacks* callbacks);
+static int loc_xtra_inject_data(char* data, int length);
+
+static const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ loc_xtra_init,
+ loc_xtra_inject_data
+};
+
+static void loc_ni_init(GpsNiCallbacks *callbacks);
+static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+static const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_ni_init,
+ loc_ni_respond,
+};
+
+// For shutting down MDM in fusion devices
+static int mdm_fd = -1;
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks);
+static void loc_gps_measurement_close();
+
+static const GpsMeasurementInterface sLocEngGpsMeasurementInterface =
+{
+ sizeof(GpsMeasurementInterface),
+ loc_gps_measurement_init,
+ loc_gps_measurement_close
+};
+
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
+static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
+
+static const AGpsRilInterface sLocEngAGpsRilInterface =
+{
+ sizeof(AGpsRilInterface),
+ loc_agps_ril_init,
+ loc_agps_ril_set_ref_location,
+ loc_agps_ril_set_set_id,
+ loc_agps_ril_ni_message,
+ loc_agps_ril_update_network_state,
+ loc_agps_ril_update_network_availability
+};
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length);
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length);
+
+static const SuplCertificateInterface sLocEngAGpsCertInterface =
+{
+ sizeof(SuplCertificateInterface),
+ loc_agps_install_certificates,
+ loc_agps_revoke_certificates
+};
+
+static void loc_configuration_update(const char* config_data, int32_t length);
+
+static const GnssConfigurationInterface sLocEngConfigInterface =
+{
+ sizeof(GnssConfigurationInterface),
+ loc_configuration_update
+};
+
+static loc_eng_data_s_type loc_afw_data;
+static int gss_fd = -1;
+
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ ENTRY_LOG_CALLFLOW();
+ const GpsInterface* ret_val;
+
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ loc_eng_read_config();
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ ret_val = NULL;
+ } else {
+ ret_val = &sLocEngInterface;
+ }
+
+ loc_eng_read_config();
+
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ unsigned int target = TARGET_DEFAULT;
+ loc_eng_read_config();
+
+ target = loc_get_target();
+ LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
+
+ int gnssType = getTargetGnssType(target);
+ switch (gnssType)
+ {
+ case GNSS_GSS:
+ //APQ8064
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ gss_fd = open("/dev/gss", O_RDONLY);
+ if (gss_fd < 0) {
+ LOC_LOGE("GSS open failed: %s\n", strerror(errno));
+ }
+ else {
+ LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
+ gps_conf.CAPABILITIES);
+ }
+ break;
+ case GNSS_NONE:
+ //MPQ8064
+ LOC_LOGE("No GPS HW on this target. Not returning interface.");
+ return NULL;
+ case GNSS_QCA1530:
+ // qca1530 chip is present
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ LOC_LOGD("qca1530 present: CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
+ break;
+ }
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/Ax
+
+===========================================================================*/
+static int loc_init(GpsCallbacks* callbacks)
+{
+ int retVal = -1;
+ int i = 0;
+ ENTRY_LOG();
+ LOC_API_ADAPTER_EVENT_MASK_T event;
+
+ if (NULL == callbacks) {
+ LOC_LOGE("loc_init failed. cb = NULL\n");
+ EXIT_LOG(%d, retVal);
+ return retVal;
+ }
+
+ event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
+ callbacks->status_cb, /* status_cb */
+ local_sv_cb, /* sv_status_cb */
+ callbacks->nmea_cb, /* nmea_cb */
+ callbacks->set_capabilities_cb, /* set_capabilities_cb */
+ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
+ callbacks->release_wakelock_cb, /* release_wakelock_cb */
+ callbacks->create_thread_cb, /* create_thread_cb */
+ NULL, /* location_ext_parser */
+ NULL, /* sv_ext_parser */
+ callbacks->request_utc_time_cb, /* request_utc_time_cb */
+ loc_close_mdm_node /*loc_shutdown_cb*/};
+
+ gps_loc_cb = callbacks->location_cb;
+ gps_sv_cb = callbacks->sv_status_cb;
+
+ retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
+ loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->setGpsLockMsg(0);
+ loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES);
+
+ if(retVal) {
+ LOC_LOGE("loc_eng_init() fail!");
+ goto err;
+ }
+
+ loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530);
+ loc_afw_data.adapter->setPowerVote(true);
+
+ LOC_LOGD("loc_eng_init() success!");
+
+#ifdef PLATFORM_MSM8084
+ if (mdm_fd < 0) {
+ int (*open_first_external_modem)(void);
+ const char *name = "libdetectmodem.so";
+ const char *func = "open_first_external_modem";
+ const char *error;
+
+ void *lib = ::dlopen(name, RTLD_NOW);
+ error = ::dlerror();
+ if (!lib) {
+ LOC_LOGE("%s: could not find %s: %s", __func__, name, error);
+ goto err;
+ }
+
+ open_first_external_modem = NULL;
+ *(void **)(&open_first_external_modem) = ::dlsym(lib, func);
+ error = ::dlerror();
+
+ if (!open_first_external_modem) {
+ LOC_LOGE("%s: could not find symbol %s in %s: %s",
+ __func__, func, name, error);
+ }
+ else {
+ errno = 0;
+ mdm_fd = open_first_external_modem();
+ if (mdm_fd < 0) {
+ LOC_LOGE("%s: %s failed: %s\n", __func__, func, strerror(errno));
+ }
+ else {
+ LOC_LOGD("%s: external power up modem opened successfully\n", __func__);
+ }
+ }
+ dlclose(lib);
+ } else {
+ LOC_LOGD("powerup_node has been opened before");
+ }
+#endif //PLATFORM_MSM8084
+err:
+ EXIT_LOG(%d, retVal);
+ return retVal;
+}
+
+/*===========================================================================
+FUNCTION loc_close_mdm_node
+
+DESCRIPTION
+ closes mdm_fd which is the modem powerup node obtained in loc_init
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_close_mdm_node()
+{
+ ENTRY_LOG();
+ if (mdm_fd >= 0) {
+ LOC_LOGD("closing the powerup node");
+ close(mdm_fd);
+ mdm_fd = -1;
+ LOC_LOGD("finished closing the powerup node");
+ } else {
+ LOC_LOGD("powerup node has not been opened yet.");
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_cleanup()
+{
+ ENTRY_LOG();
+
+ loc_afw_data.adapter->setPowerVote(false);
+ loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK);
+
+ loc_eng_cleanup(loc_afw_data);
+ loc_close_mdm_node();
+ gps_loc_cb = NULL;
+ gps_sv_cb = NULL;
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_start()
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_start(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_stop()
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ ret_val = loc_eng_stop(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_set_position_mode(GpsPositionMode mode,
+ GpsPositionRecurrence recurrence,
+ uint32_t min_interval,
+ uint32_t preferred_accuracy,
+ uint32_t preferred_time)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ LocPositionMode locMode;
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ locMode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ locMode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ locMode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+
+ LocPosMode params(locMode, recurrence, min_interval,
+ preferred_accuracy, preferred_time, NULL, NULL);
+ ret_val = loc_eng_set_position_mode(loc_afw_data, params);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG();
+ int ret_val = 0;
+
+ ret_val = loc_eng_inject_time(loc_afw_data, time,
+ timeReference, uncertainty);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_inject_location(double latitude, double longitude, float accuracy)
+{
+ static bool initialized = false;
+ static bool enable_cpi = true;
+ ENTRY_LOG();
+
+ if (accuracy < 1000)
+ {
+ accuracy = 1000;
+ }
+
+ int ret_val = 0;
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+
+ if(!initialized)
+ {
+ char value[PROPERTY_VALUE_MAX];
+ memset(value, 0, sizeof(value));
+ (void)property_get("persist.gps.qc_nlp_in_use", value, "0");
+ if(0 == strcmp(value, "1"))
+ {
+ enable_cpi = false;
+ LOC_LOGI("GPS HAL coarse position injection disabled");
+ }
+ else
+ {
+ LOC_LOGI("GPS HAL coarse position injection enabled");
+ }
+ initialized = true;
+ }
+
+ if(enable_cpi)
+ {
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+ }
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_delete_aiding_data(GpsAidingData f)
+{
+ ENTRY_LOG();
+ loc_eng_delete_aiding_data(loc_afw_data, f);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+const GpsGeofencingInterface* get_geofence_interface(void)
+{
+ ENTRY_LOG();
+ void *handle;
+ const char *error;
+ typedef const GpsGeofencingInterface* (*get_gps_geofence_interface_function) (void);
+ get_gps_geofence_interface_function get_gps_geofence_interface;
+ static const GpsGeofencingInterface* geofence_interface = NULL;
+
+ dlerror(); /* Clear any existing error */
+
+ handle = dlopen ("libgeofence.so", RTLD_NOW);
+
+ if (!handle)
+ {
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlopen for libgeofence.so failed, error = %s\n", __func__, error);
+ }
+ goto exit;
+ }
+ dlerror(); /* Clear any existing error */
+ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
+ goto exit;
+ }
+
+ geofence_interface = get_gps_geofence_interface();
+
+exit:
+ EXIT_LOG(%d, geofence_interface == NULL);
+ return geofence_interface;
+}
+/*===========================================================================
+FUNCTION loc_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* loc_get_extension(const char* name)
+{
+ ENTRY_LOG();
+ const void* ret_val = NULL;
+
+ LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsInterface;
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngNiInterface;
+ }
+ else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
+ {
+ char baseband[PROPERTY_VALUE_MAX];
+ property_get("ro.baseband", baseband, "msm");
+ if (strcmp(baseband, "csfb") == 0)
+ {
+ ret_val = &sLocEngAGpsRilInterface;
+ }
+ }
+ else if (strcmp(name, GPS_GEOFENCING_INTERFACE) == 0)
+ {
+ if ((gps_conf.CAPABILITIES | GPS_CAPABILITY_GEOFENCING) == gps_conf.CAPABILITIES ){
+ ret_val = get_geofence_interface();
+ }
+ }
+ else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsCertInterface;
+ }
+ else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngConfigInterface;
+ }
+ else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngGpsMeasurementInterface;
+ }
+ else
+ {
+ LOC_LOGE ("get_extension: Invalid interface passed in\n");
+ }
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_init(AGpsCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ if (agps_status_cb == NULL) {
+ agps_status_cb = callbacks->status_cb;
+ callbacks->status_cb = loc_agps_status_cb;
+ }
+ loc_eng_agps_init(loc_afw_data, (AGpsExtCallbacks*)callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open(const char* apn)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType = AGPS_APN_BEARER_IPV4;
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_with_apniptype
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType;
+
+ switch (apnIpType) {
+ case APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_closed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_agps_open_failed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_set_server
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ LocServerType serverType;
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ break;
+ case AGPS_TYPE_C2K:
+ serverType = LOC_AGPS_CDMA_PDE_SERVER;
+ break;
+ default:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ }
+ int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTIONf571
+ loc_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_xtra_init(loc_afw_data, (GpsXtraExtCallbacks*)callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_xtra_inject_data
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_inject_data(char* data, int length)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE))
+ ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
+ else
+ LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d",
+ __func__, data, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_init
+
+DESCRIPTION
+ This function initializes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_gps_measurement_init(loc_afw_data,
+ callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_close
+
+DESCRIPTION
+ This function closes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_gps_measurement_close()
+{
+ ENTRY_LOG();
+ loc_eng_gps_measurement_close(loc_afw_data);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_init(GpsNiCallbacks *callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG();
+ loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+// Below stub functions are members of sLocEngAGpsRilInterface
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {}
+
+/*===========================================================================
+FUNCTION loc_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_ril_update_network_availability(int available, const char* apn)
+{
+ ENTRY_LOG();
+ loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length)
+{
+ ENTRY_LOG();
+ LOC_LOGE("agps_revoke_certificates not supported");
+ int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static void loc_configuration_update(const char* config_data, int32_t length)
+{
+ ENTRY_LOG();
+ loc_eng_configuration_update(loc_afw_data, config_data, length);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_loc_cb(UlpLocation* location, void* locExt)
+{
+ ENTRY_LOG();
+ if (NULL != location) {
+ CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
+
+ if (NULL != gps_loc_cb) {
+ gps_loc_cb(&location->gpsLocation);
+ }
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
+{
+ ENTRY_LOG();
+ if (NULL != gps_sv_cb) {
+ CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
+ gps_sv_cb(sv_status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void loc_agps_status_cb(AGpsStatus* status)
+{
+ ENTRY_LOG();
+
+ if (NULL != agps_status_cb) {
+ size_t realSize = sizeof(AGpsStatus);
+ LOC_LOGD("agps_status size=%d real-size=%d", status->size, realSize);
+ status->size = realSize;
+ agps_status_cb(status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc.h b/msm8084/loc_api/libloc_api_50001/loc.h
new file mode 100644
index 0000000..22fcbe0
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_H__
+#define __LOC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/
+
+typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
+typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
+typedef void* (*loc_ext_parser)(void* data);
+typedef void (*loc_shutdown_cb) (void);
+
+typedef struct {
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ gps_request_utc_time request_utc_time_cb;
+ loc_shutdown_cb shutdown_cb;
+} LocCallbacks;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_H__
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng.cpp
new file mode 100644
index 0000000..3c687e8
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng.cpp
@@ -0,0 +1,3023 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <time.h>
+#include <new>
+#include <LocEngAdapter.h>
+
+#include <cutils/sched_policy.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+#include <glib.h>
+#include <sys/syscall.h>
+#endif /* USE_GLIB */
+
+#include <string.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_dmn_conn.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_msg.h>
+#include <loc_eng_nmea.h>
+#include <msg_q.h>
+#include <loc.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_core_log.h"
+#include "loc_eng_log.h"
+
+#define SUCCESS TRUE
+#define FAILURE FALSE
+
+#ifndef GPS_CONF_FILE
+#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
+#endif
+
+#ifndef SAP_CONF_FILE
+#define SAP_CONF_FILE "/etc/sap.conf"
+#endif
+
+#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net"
+
+using namespace loc_core;
+
+boolean configAlreadyRead = false;
+unsigned int agpsStatus = 0;
+loc_gps_cfg_s_type gps_conf;
+loc_sap_cfg_s_type sap_conf;
+
+/* Parameter spec table */
+static loc_param_s_type gps_conf_table[] =
+{
+ {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'},
+ {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
+ {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+ {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
+};
+
+static loc_param_s_type sap_conf_table[] =
+{
+ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'},
+ {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'},
+ {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'},
+ {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'}
+};
+
+static void loc_default_parameters(void)
+{
+ /* defaults */
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.NMEA_PROVIDER = 0;
+ gps_conf.GPS_LOCK = 0;
+ gps_conf.SUPL_VER = 0x10000;
+ gps_conf.CAPABILITIES = 0x7;
+
+ sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ sap_conf.SENSOR_USAGE = 0; /* Enabled */
+ sap_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 */
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+
+ /* LTE Positioning Profile configuration is disable by default*/
+ gps_conf.LPP_PROFILE = 0;
+
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+
+ /* default provider is SSC */
+ sap_conf.SENSOR_PROVIDER = 1;
+
+ /* None of the 10 slots for agps certificates are writable by default */
+ gps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+}
+
+// 2nd half of init(), singled out for
+// modem restart to use.
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
+
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+// Internal functions
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_report_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_process_conn_request(loc_eng_data_s_type &loc_eng_data,
+ int connHandle, AGpsType agps_type);
+static void loc_eng_agps_close_status(loc_eng_data_s_type &loc_eng_data, int is_succ);
+static void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data) ;
+static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_handle_shutdown(loc_eng_data_s_type &loc_eng_data);
+static void deleteAidingData(loc_eng_data_s_type &logEng);
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
+static int dataCallCb(void *cb_data);
+static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ loc_eng_data.adapter->deleteAidingData(loc_eng_data.aiding_data_for_deletion);
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+}
+
+static void* noProc(void* data)
+{
+ return NULL;
+}
+
+
+/*********************************************************************
+ * definitions of the static messages used in the file
+ *********************************************************************/
+// case LOC_ENG_MSG_REQUEST_NI:
+LocEngRequestNi::LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data) :
+ LocMsg(), mLocEng(locEng), mNotify(notif), mPayload(data) {
+ locallog();
+}
+void LocEngRequestNi::proc() const {
+ loc_eng_ni_request_handler(*((loc_eng_data_s_type*)mLocEng),
+ &mNotify, mPayload);
+}
+void LocEngRequestNi::locallog() const
+{
+ LOC_LOGV("id: %d\n type: %s\n flags: %d\n time out: %d\n "
+ "default response: %s\n requestor id encoding: %s\n"
+ " text encoding: %s\n passThroughData: %p",
+ mNotify.notification_id,
+ loc_get_ni_type_name(mNotify.ni_type),
+ mNotify.notify_flags,
+ mNotify.timeout,
+ loc_get_ni_response_name(mNotify.default_response),
+ loc_get_ni_encoding_name(mNotify.requestor_id_encoding),
+ loc_get_ni_encoding_name(mNotify.text_encoding),
+ mPayload);
+}
+inline void LocEngRequestNi::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_INFORM_NI_RESPONSE:
+// in loc_eng_ni.cpp
+
+// case LOC_ENG_MSG_START_FIX:
+LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStartFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_start_handler(*locEng);
+}
+inline void LocEngStartFix::locallog() const
+{
+ LOC_LOGV("LocEngStartFix");
+}
+inline void LocEngStartFix::log() const
+{
+ locallog();
+}
+void LocEngStartFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_STOP_FIX:
+LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStopFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_stop_handler(*locEng);
+}
+inline void LocEngStopFix::locallog() const
+{
+ LOC_LOGV("LocEngStopFix");
+}
+inline void LocEngStopFix::log() const
+{
+ locallog();
+}
+void LocEngStopFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_POSITION_MODE:
+LocEngPositionMode::LocEngPositionMode(LocEngAdapter* adapter,
+ LocPosMode &mode) :
+ LocMsg(), mAdapter(adapter), mPosMode(mode)
+{
+ mPosMode.logv();
+}
+inline void LocEngPositionMode::proc() const {
+ mAdapter->setPositionMode(&mPosMode);
+}
+inline void LocEngPositionMode::log() const {
+ mPosMode.logv();
+}
+void LocEngPositionMode::send() const {
+ mAdapter->sendMsg(this);
+}
+
+LocEngGetZpp::LocEngGetZpp(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngGetZpp::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_get_zpp_handler(*locEng);
+}
+inline void LocEngGetZpp::locallog() const
+{
+ LOC_LOGV("LocEngGetZpp");
+}
+inline void LocEngGetZpp::log() const
+{
+ locallog();
+}
+void LocEngGetZpp::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+LocEngShutdown::LocEngShutdown(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngShutdown::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ LOC_LOGD("%s:%d]: Calling loc_eng_handle_shutdown", __func__, __LINE__);
+ loc_eng_handle_shutdown(*locEng);
+}
+inline void LocEngShutdown::locallog() const
+{
+ LOC_LOGV("LocEngShutdown");
+}
+inline void LocEngShutdown::log() const
+{
+ locallog();
+}
+
+// case LOC_ENG_MSG_SET_TIME:
+struct LocEngSetTime : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUtcTime mTime;
+ const int64_t mTimeReference;
+ const int mUncertainty;
+ inline LocEngSetTime(LocEngAdapter* adapter,
+ GpsUtcTime t, int64_t tf, int unc) :
+ LocMsg(), mAdapter(adapter),
+ mTime(t), mTimeReference(tf), mUncertainty(unc)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setTime(mTime, mTimeReference, mUncertainty);
+ }
+ inline void locallog() const {
+ LOC_LOGV("time: %lld\n timeReference: %lld\n uncertainty: %d",
+ mTime, mTimeReference, mUncertainty);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+ // case LOC_ENG_MSG_INJECT_LOCATION:
+struct LocEngInjectLocation : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const double mLatitude;
+ const double mLongitude;
+ const float mAccuracy;
+ inline LocEngInjectLocation(LocEngAdapter* adapter,
+ double lat, double lon, float accur) :
+ LocMsg(), mAdapter(adapter),
+ mLatitude(lat), mLongitude(lon), mAccuracy(accur)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ inline void locallog() const {
+ LOC_LOGV("latitude: %f\n longitude: %f\n accuracy: %f",
+ mLatitude, mLongitude, mAccuracy);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_IPV4:
+struct LocEngSetServerIpv4 : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned int mNlAddr;
+ const int mPort;
+ const LocServerType mServerType;
+ inline LocEngSetServerIpv4(LocEngAdapter* adapter,
+ unsigned int ip,
+ int port,
+ LocServerType type) :
+ LocMsg(), mAdapter(adapter),
+ mNlAddr(ip), mPort(port), mServerType(type)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mNlAddr, mPort, mServerType);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s",
+ mNlAddr, mPort, loc_get_server_type_name(mServerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_URL:
+struct LocEngSetServerUrl : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLen;
+ char* mUrl;
+ inline LocEngSetServerUrl(LocEngAdapter* adapter,
+ char* urlString,
+ int url_len) :
+ LocMsg(), mAdapter(adapter),
+ mLen(url_len), mUrl(new char[mLen+1])
+ {
+ memcpy((void*)mUrl, (void*)urlString, url_len);
+ mUrl[mLen] = 0;
+ locallog();
+ }
+ inline ~LocEngSetServerUrl()
+ {
+ delete[] mUrl;
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mUrl, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
+struct LocEngAGlonassProtocol : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned long mAGlonassProtocl;
+ inline LocEngAGlonassProtocol(LocEngAdapter* adapter,
+ unsigned long protocol) :
+ LocMsg(), mAdapter(adapter), mAGlonassProtocl(protocol)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setAGLONASSProtocol(mAGlonassProtocl);
+ }
+ inline void locallog() const {
+ LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SUPL_VERSION:
+struct LocEngSuplVer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSuplVer;
+ inline LocEngSuplVer(LocEngAdapter* adapter,
+ int suplVer) :
+ LocMsg(), mAdapter(adapter), mSuplVer(suplVer)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSUPLVersion(mSuplVer);
+ }
+ inline void locallog() const {
+ LOC_LOGV("SUPL Version: %d", mSuplVer);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LPP_CONFIG:
+struct LocEngLppConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLppConfig;
+ inline LocEngLppConfig(LocEngAdapter* adapter,
+ int lppConfig) :
+ LocMsg(), mAdapter(adapter), mLppConfig(lppConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setLPPConfig(mLppConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG:
+struct LocEngSensorControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSensorsDisabled;
+ const int mSensorProvider;
+ inline LocEngSensorControlConfig(LocEngAdapter* adapter,
+ int sensorsDisabled, int sensorProvider) :
+ LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled),
+ mSensorProvider(sensorProvider)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d",
+ mSensorsDisabled, mSensorProvider);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PROPERTIES:
+struct LocEngSensorProperties : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const bool mGyroBiasVarianceRandomWalkValid;
+ const float mGyroBiasVarianceRandomWalk;
+ const bool mAccelRandomWalkValid;
+ const float mAccelRandomWalk;
+ const bool mAngleRandomWalkValid;
+ const float mAngleRandomWalk;
+ const bool mRateRandomWalkValid;
+ const float mRateRandomWalk;
+ const bool mVelocityRandomWalkValid;
+ const float mVelocityRandomWalk;
+ inline LocEngSensorProperties(LocEngAdapter* adapter,
+ bool gyroBiasRandomWalk_valid,
+ float gyroBiasRandomWalk,
+ bool accelRandomWalk_valid,
+ float accelRandomWalk,
+ bool angleRandomWalk_valid,
+ float angleRandomWalk,
+ bool rateRandomWalk_valid,
+ float rateRandomWalk,
+ bool velocityRandomWalk_valid,
+ float velocityRandomWalk) :
+ LocMsg(), mAdapter(adapter),
+ mGyroBiasVarianceRandomWalkValid(gyroBiasRandomWalk_valid),
+ mGyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
+ mAccelRandomWalkValid(accelRandomWalk_valid),
+ mAccelRandomWalk(accelRandomWalk),
+ mAngleRandomWalkValid(angleRandomWalk_valid),
+ mAngleRandomWalk(angleRandomWalk),
+ mRateRandomWalkValid(rateRandomWalk_valid),
+ mRateRandomWalk(rateRandomWalk),
+ mVelocityRandomWalkValid(velocityRandomWalk_valid),
+ mVelocityRandomWalk(velocityRandomWalk)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorProperties(mGyroBiasVarianceRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalkValid,
+ mAccelRandomWalk,
+ mAngleRandomWalkValid,
+ mAngleRandomWalk,
+ mRateRandomWalkValid,
+ mRateRandomWalk,
+ mVelocityRandomWalkValid,
+ mVelocityRandomWalk);
+ }
+ inline void locallog() const {
+ LOC_LOGV("Sensor properties validity, Gyro Random walk: %d "
+ "Accel Random Walk: %d "
+ "Angle Random Walk: %d Rate Random Walk: %d "
+ "Velocity Random Walk: %d\n"
+ "Sensor properties, Gyro Random walk: %f "
+ "Accel Random Walk: %f "
+ "Angle Random Walk: %f Rate Random Walk: %f "
+ "Velocity Random Walk: %f",
+ mGyroBiasVarianceRandomWalkValid,
+ mAccelRandomWalkValid,
+ mAngleRandomWalkValid,
+ mRateRandomWalkValid,
+ mVelocityRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalk,
+ mAngleRandomWalk,
+ mRateRandomWalk,
+ mVelocityRandomWalk
+ );
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG:
+struct LocEngSensorPerfControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mControlMode;
+ const int mAccelSamplesPerBatch;
+ const int mAccelBatchesPerSec;
+ const int mGyroSamplesPerBatch;
+ const int mGyroBatchesPerSec;
+ const int mAccelSamplesPerBatchHigh;
+ const int mAccelBatchesPerSecHigh;
+ const int mGyroSamplesPerBatchHigh;
+ const int mGyroBatchesPerSecHigh;
+ const int mAlgorithmConfig;
+ inline LocEngSensorPerfControlConfig(LocEngAdapter* adapter,
+ int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig) :
+ LocMsg(), mAdapter(adapter),
+ mControlMode(controlMode),
+ mAccelSamplesPerBatch(accelSamplesPerBatch),
+ mAccelBatchesPerSec(accelBatchesPerSec),
+ mGyroSamplesPerBatch(gyroSamplesPerBatch),
+ mGyroBatchesPerSec(gyroBatchesPerSec),
+ mAccelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
+ mAccelBatchesPerSecHigh(accelBatchesPerSecHigh),
+ mGyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
+ mGyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
+ mAlgorithmConfig(algorithmConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorPerfControlConfig(mControlMode,
+ mAccelSamplesPerBatch,
+ mAccelBatchesPerSec,
+ mGyroSamplesPerBatch,
+ mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh,
+ mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh,
+ mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("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",
+ mControlMode,
+ mAccelSamplesPerBatch, mAccelBatchesPerSec,
+ mGyroSamplesPerBatch, mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh, mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh, mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_EXT_POWER_CONFIG:
+struct LocEngExtPowerConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mIsBatteryCharging;
+ inline LocEngExtPowerConfig(LocEngAdapter* adapter,
+ int isBatteryCharging) :
+ LocMsg(), mAdapter(adapter),
+ mIsBatteryCharging(isBatteryCharging)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setExtPowerConfig(mIsBatteryCharging);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
+ mIsBatteryCharging);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_POSITION:
+LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology) :
+ LocMsg(), mAdapter(adapter), mLocation(loc),
+ mLocationExtended(locExtended),
+ mLocationExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->location_ext_parser(locExt)),
+ mStatus(st), mTechMask(technology)
+{
+ locallog();
+}
+void LocEngReportPosition::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
+ bool reported = false;
+ if (locEng->location_cb != NULL) {
+ if (LOC_SESS_FAILURE == mStatus) {
+ // in case we want to handle the failure case
+ locEng->location_cb(NULL, NULL);
+ reported = true;
+ }
+ // what's in the else if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ else if ((LOC_SESS_SUCCESS == mStatus &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID) &
+ mTechMask)) ||
+ (LOC_SESS_INTERMEDIATE == locEng->intermediateFix &&
+ !((mLocation.gpsLocation.flags &
+ GPS_LOCATION_HAS_ACCURACY) &&
+ (gps_conf.ACCURACY_THRES != 0) &&
+ (mLocation.gpsLocation.accuracy >
+ gps_conf.ACCURACY_THRES)))) {
+ locEng->location_cb((UlpLocation*)&(mLocation),
+ (void*)mLocationExt);
+ reported = true;
+ }
+ }
+
+ // if we have reported this fix
+ if (reported &&
+ // and if this is a singleshot
+ GPS_POSITION_RECURRENCE_SINGLE ==
+ locEng->adapter->getPositionMode().recurrence) {
+ if (LOC_SESS_INTERMEDIATE == mStatus) {
+ // modem could be still working for a final fix,
+ // although we no longer need it. So stopFix().
+ locEng->adapter->stopFix();
+ }
+ // turn off the session flag.
+ locEng->adapter->setInSession(false);
+ }
+
+ if (locEng->generateNmea &&
+ mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS &&
+ mTechMask & (LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID))
+ {
+ unsigned char generate_nmea = reported &&
+ (mStatus != LOC_SESS_FAILURE);
+ loc_eng_nmea_generate_pos(locEng, mLocation, mLocationExtended,
+ generate_nmea);
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(mLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+ }
+}
+void LocEngReportPosition::locallog() const {
+ LOC_LOGV("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: %lld\n rawDataSize: %d\n rawData: %p\n Session"
+ " status: %d\n Technology mask: %u",
+ mLocation.gpsLocation.flags, mLocation.position_source,
+ mLocation.gpsLocation.latitude, mLocation.gpsLocation.longitude,
+ mLocation.gpsLocation.altitude, mLocation.gpsLocation.speed,
+ mLocation.gpsLocation.bearing, mLocation.gpsLocation.accuracy,
+ mLocation.gpsLocation.timestamp, mLocation.rawDataSize,
+ mLocation.rawData, mStatus, mTechMask);
+}
+void LocEngReportPosition::log() const {
+ locallog();
+}
+void LocEngReportPosition::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+// case LOC_ENG_MSG_REPORT_SV:
+LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExt) :
+ LocMsg(), mAdapter(adapter), mSvStatus(sv),
+ mLocationExtended(locExtended),
+ mSvExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->sv_ext_parser(svExt))
+{
+ locallog();
+}
+void LocEngReportSv::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->sv_status_cb != NULL) {
+ locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
+ (void*)mSvExt);
+ }
+
+ if (locEng->generateNmea)
+ {
+ loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
+ }
+ }
+}
+void LocEngReportSv::locallog() const {
+ LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n "
+ "used in fix mask: %x\n sv: prn snr "
+ "elevation azimuth",
+ mSvStatus.num_svs, mSvStatus.ephemeris_mask,
+ mSvStatus.almanac_mask, mSvStatus.used_in_fix_mask);
+ for (int i = 0; i < mSvStatus.num_svs && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" %d: %d %f %f %f\n ",
+ i,
+ mSvStatus.sv_list[i].prn,
+ mSvStatus.sv_list[i].snr,
+ mSvStatus.sv_list[i].elevation,
+ mSvStatus.sv_list[i].azimuth);
+ }
+}
+inline void LocEngReportSv::log() const {
+ locallog();
+}
+void LocEngReportSv::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REPORT_STATUS:
+LocEngReportStatus::LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus) :
+ LocMsg(), mAdapter(adapter), mStatus(engineStatus)
+{
+ locallog();
+}
+inline void LocEngReportStatus::proc() const
+{
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ loc_eng_report_status(*locEng, mStatus);
+ update_aiding_data_for_deletion(*locEng);
+}
+inline void LocEngReportStatus::locallog() const {
+ LOC_LOGV("LocEngReportStatus");
+}
+inline void LocEngReportStatus::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_NMEA:
+LocEngReportNmea::LocEngReportNmea(void* locEng,
+ const char* data, int len) :
+ LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
+{
+ memcpy((void*)mNmea, (void*)data, len);
+ locallog();
+}
+void LocEngReportNmea::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+
+ if (locEng->nmea_cb != NULL)
+ locEng->nmea_cb(now, mNmea, mLen);
+}
+inline void LocEngReportNmea::locallog() const {
+ LOC_LOGV("LocEngReportNmea");
+}
+inline void LocEngReportNmea::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_XTRA_SERVER:
+LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
+ const char *url1,
+ const char *url2,
+ const char *url3,
+ const int maxlength) :
+ LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
+ mServers(new char[3*(mMaxLen+1)])
+{
+ char * cptr = mServers;
+ memset(mServers, 0, 3*(mMaxLen+1));
+
+ // Override modem URLs with uncommented gps.conf urls
+ if( gps_conf.XTRA_SERVER_1[0] != '\0' ) {
+ url1 = &gps_conf.XTRA_SERVER_1[0];
+ }
+ if( gps_conf.XTRA_SERVER_2[0] != '\0' ) {
+ url2 = &gps_conf.XTRA_SERVER_2[0];
+ }
+ if( gps_conf.XTRA_SERVER_3[0] != '\0' ) {
+ url3 = &gps_conf.XTRA_SERVER_3[0];
+ }
+ // copy non xtra1.gpsonextra.net URLs into the forwarding buffer.
+ if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url1, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url2, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url3, mMaxLen + 1);
+ }
+ locallog();
+}
+void LocEngReportXtraServer::proc() const {
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->report_xtra_server_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("report_xtra_server_cb", %s, mServers);
+ locEngXtra->report_xtra_server_cb(mServers,
+ &(mServers[mMaxLen+1]),
+ &(mServers[(mMaxLen+1)<<1]));
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngReportXtraServer::locallog() const {
+ LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n"
+ " server3: %s\n",
+ mServers, &mServers[mMaxLen+1], &mServers[(mMaxLen+1)<<1]);
+}
+inline void LocEngReportXtraServer::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_BIT:
+// case LOC_ENG_MSG_RELEASE_BIT:
+LocEngReqRelBIT::LocEngReqRelBIT(void* locEng, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mIPv4Addr(ipv4),
+ mIPv6Addr(ipv6 ? new char[16] : NULL), mIsReq(isReq) {
+ if (NULL != ipv6)
+ memcpy(mIPv6Addr, ipv6, 16);
+ locallog();
+}
+inline LocEngReqRelBIT::~LocEngReqRelBIT() {
+ if (mIPv6Addr) {
+ delete[] mIPv6Addr;
+ }
+}
+void LocEngReqRelBIT::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ BITSubscriber s(getAgpsStateMachine(*locEng, mType),
+ mIPv4Addr, mIPv6Addr);
+ AgpsStateMachine* sm = (AgpsStateMachine*)s.mStateMachine;
+
+ if (mIsReq) {
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ sm->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelBIT::locallog() const {
+ LOC_LOGV("LocEngRequestBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)mIPv4Addr,
+ (unsigned char)(mIPv4Addr>>8),
+ (unsigned char)(mIPv4Addr>>16),
+ (unsigned char)(mIPv4Addr>>24),
+ NULL != mIPv6Addr ? mIPv6Addr : "");
+}
+inline void LocEngReqRelBIT::log() const {
+ locallog();
+}
+void LocEngReqRelBIT::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_RELEASE_BIT:
+struct LocEngReleaseBIT : public LocMsg {
+ const BITSubscriber mSubscriber;
+ inline LocEngReleaseBIT(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ LocMsg(),
+ mSubscriber(stateMachine, ipv4, ipv6)
+ {
+ locallog();
+ }
+ inline virtual void proc() const
+ {
+ AgpsStateMachine* sm = (AgpsStateMachine*)mSubscriber.mStateMachine;
+ sm->unsubscribeRsrc((Subscriber*)&mSubscriber);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngReleaseBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mSubscriber.ID>>24),
+ (unsigned char)(mSubscriber.ID>>16),
+ (unsigned char)(mSubscriber.ID>>8),
+ (unsigned char)mSubscriber.ID,
+ NULL != mSubscriber.mIPv6Addr ? mSubscriber.mIPv6Addr : "");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// LocEngSuplEsOpened
+LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsOpened::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_GRANTED);
+ }
+}
+void LocEngSuplEsOpened::locallog() const {
+ LOC_LOGV("LocEngSuplEsOpened");
+}
+void LocEngSuplEsOpened::log() const {
+ locallog();
+}
+
+// LocEngSuplEsClosed
+LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsClosed::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_RELEASED);
+ }
+}
+void LocEngSuplEsClosed::locallog() const {
+ LOC_LOGV("LocEngSuplEsClosed");
+}
+void LocEngSuplEsClosed::log() const {
+ locallog();
+}
+
+
+// case LOC_ENG_MSG_REQUEST_SUPL_ES:
+LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngRequestSuplEs::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ DSSubscriber s(sm, mID);
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1);
+ }
+}
+inline void LocEngRequestSuplEs::locallog() const {
+ LOC_LOGV("LocEngRequestSuplEs");
+}
+inline void LocEngRequestSuplEs::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_ATL:
+LocEngRequestATL::LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type) :
+ LocMsg(), mLocEng(locEng), mID(id), mType(agps_type) {
+ locallog();
+}
+void LocEngRequestATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = (AgpsStateMachine*)
+ getAgpsStateMachine(*locEng, mType);
+ if (sm) {
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ AGPS_TYPE_INVALID == mType);
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngRequestATL::locallog() const {
+ LOC_LOGV("LocEngRequestATL");
+}
+inline void LocEngRequestATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_RELEASE_ATL:
+LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngReleaseATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+
+ if (locEng->agnss_nif) {
+ ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false);
+ if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->internet_nif) {
+ ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false);
+ if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from internet_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->ds_nif) {
+ DSSubscriber s3(locEng->ds_nif, mID);
+ if (locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from ds_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ LOC_LOGW("%s:%d]: Could not release ATL. "
+ "No subscribers found\n",
+ __func__, __LINE__);
+ locEng->adapter->atlCloseStatus(mID, 0);
+}
+inline void LocEngReleaseATL::locallog() const {
+ LOC_LOGV("LocEngReleaseATL");
+}
+inline void LocEngReleaseATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_WIFI:
+// case LOC_ENG_MSG_RELEASE_WIFI:
+LocEngReqRelWifi::LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mSenderId(sender_id),
+ mSSID(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == p ? NULL : new char[SSID_BUF_SIZE]),
+ mIsReq(isReq) {
+ if (NULL != s)
+ strlcpy(mSSID, s, SSID_BUF_SIZE);
+ if (NULL != p)
+ strlcpy(mPassword, p, SSID_BUF_SIZE);
+ locallog();
+}
+LocEngReqRelWifi::~LocEngReqRelWifi() {
+ if (NULL != mSSID) {
+ delete[] mSSID;
+ }
+ if (NULL != mPassword) {
+ delete[] mPassword;
+ }
+}
+void LocEngReqRelWifi::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->wifi_nif) {
+ WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
+ if (mIsReq) {
+ locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
+ }
+ } else {
+ locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngReqRelWifi::locallog() const {
+ LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
+ mIsReq ? "LocEngRequestWifi" : "LocEngReleaseWifi",
+ mSenderId,
+ NULL != mSSID ? mSSID : "",
+ NULL != mPassword ? mPassword : "");
+}
+inline void LocEngReqRelWifi::log() const {
+ locallog();
+}
+void LocEngReqRelWifi::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REQUEST_XTRA_DATA:
+LocEngRequestXtra::LocEngRequestXtra(void* locEng) :
+ mLocEng(locEng) {
+ locallog();
+}
+void LocEngRequestXtra::proc() const
+{
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->download_request_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("download_request_cb", %p, mLocEng);
+ locEngXtra->download_request_cb();
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngRequestXtra::locallog() const {
+ LOC_LOGV("LocEngReqXtra");
+}
+inline void LocEngRequestXtra::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_TIME:
+LocEngRequestTime::LocEngRequestTime(void* locEng) :
+ LocMsg(), mLocEng(locEng)
+{
+ locallog();
+}
+void LocEngRequestTime::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (gps_conf.CAPABILITIES & GPS_CAPABILITY_ON_DEMAND_TIME) {
+ if (locEng->request_utc_time_cb != NULL) {
+ locEng->request_utc_time_cb();
+ } else {
+ LOC_LOGE("Callback function for request time is NULL");
+ }
+ }
+}
+inline void LocEngRequestTime::locallog() const {
+ LOC_LOGV("LocEngReqTime");
+}
+inline void LocEngRequestTime::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_DELETE_AIDING_DATA:
+struct LocEngDelAidData : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ const GpsAidingData mType;
+ inline LocEngDelAidData(loc_eng_data_s_type* locEng,
+ GpsAidingData f) :
+ LocMsg(), mLocEng(locEng), mType(f)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocEng->aiding_data_for_deletion = mType;
+ update_aiding_data_for_deletion(*mLocEng);
+ }
+ inline void locallog() const {
+ LOC_LOGV("aiding data msak %d", mType);
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENABLE_DATA:
+struct LocEngEnableData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mEnable;
+ char* mAPN;
+ const int mLen;
+ inline LocEngEnableData(LocEngAdapter* adapter,
+ const char* name, int len, int enable) :
+ LocMsg(), mAdapter(adapter),
+ mEnable(enable), mAPN(NULL), mLen(len)
+ {
+ if (NULL != name) {
+ mAPN = new char[len+1];
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ }
+ locallog();
+ }
+ inline ~LocEngEnableData() {
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter->enableData(mEnable);
+ if (NULL != mAPN) {
+ mAdapter->setAPN(mAPN, mLen);
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("apn: %s\n enable: %d",
+ (NULL == mAPN) ? "NULL" : mAPN, mEnable);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_INJECT_XTRA_DATA:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_SET_CAPABILITIES:
+struct LocEngSetCapabilities : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_capabilities_cb) {
+ LOC_LOGV("calling set_capabilities_cb 0x%x",
+ gps_conf.CAPABILITIES);
+ mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES);
+ } else {
+ LOC_LOGV("set_capabilities_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetCapabilities");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LOC_INIT:
+struct LocEngInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_reinit(*mLocEng);
+ // set the capabilities
+ mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInit");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REQUEST_XTRA_SERVER:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
+struct LocEngAtlOpenSuccess : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ const int mLen;
+ char* mAPN;
+ const AGpsBearerType mBearerType;
+ inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
+ const char* name,
+ int len,
+ AGpsBearerType btype) :
+ LocMsg(),
+ mStateMachine(statemachine), mLen(len),
+ mAPN(new char[len+1]), mBearerType(btype)
+ {
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ locallog();
+ }
+ inline ~LocEngAtlOpenSuccess()
+ {
+ delete[] mAPN;
+ }
+ inline virtual void proc() const {
+ mStateMachine->setBearer(mBearerType);
+ mStateMachine->setAPN(mAPN, mLen);
+ mStateMachine->onRsrcEvent(RSRC_GRANTED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n"
+ " bearer type: %s",
+ loc_get_agps_type_name(mStateMachine->getType()),
+ mAPN,
+ loc_get_agps_bear_name(mBearerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_CLOSED:
+struct LocEngAtlClosed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_RELEASED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_OPEN_FAILED:
+struct LocEngAtlOpenFailed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_DENIED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenFailed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENGINE_DOWN:
+LocEngDown::LocEngDown(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngDown::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_down(*locEng);
+}
+inline void LocEngDown::locallog() const {
+ LOC_LOGV("LocEngDown");
+}
+inline void LocEngDown::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_ENGINE_UP:
+LocEngUp::LocEngUp(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngUp::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_up(*locEng);
+}
+inline void LocEngUp::locallog() const {
+ LOC_LOGV("LocEngUp");
+}
+inline void LocEngUp::log() const {
+ locallog();
+}
+
+struct LocEngDataClientInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngDataClientInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+ }
+ virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ if(!locEng->adapter->initDataServiceClient()) {
+ locEng->ds_nif = new DSStateMachine(servicerTypeExt,
+ (void *)dataCallCb,
+ locEng->adapter);
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngDataClientInit\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInstallAGpsCert : public LocMsg {
+ LocEngAdapter* mpAdapter;
+ const size_t mNumberOfCerts;
+ const uint32_t mSlotBitMask;
+ DerEncodedCertificate* mpData;
+ inline LocEngInstallAGpsCert(LocEngAdapter* adapter,
+ const DerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask) :
+ LocMsg(), mpAdapter(adapter),
+ mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask),
+ mpData(new DerEncodedCertificate[mNumberOfCerts])
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ mpData[i].data = new u_char[pData[i].length];
+ if (mpData[i].data) {
+ memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length);
+ mpData[i].length = pData[i].length;
+ } else {
+ LOC_LOGE("malloc failed for cert#%d", i);
+ break;
+ }
+ }
+ locallog();
+ }
+ inline ~LocEngInstallAGpsCert()
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ if (mpData[i].data) {
+ delete[] mpData[i].data;
+ }
+ }
+ delete[] mpData;
+ }
+ inline virtual void proc() const {
+ mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u",
+ mNumberOfCerts, mSlotBitMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngUpdateRegistrationMask : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ loc_registration_mask_status mIsEnabled;
+ inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng,
+ LOC_API_ADAPTER_EVENT_MASK_T mask,
+ loc_registration_mask_status isEnabled) :
+ LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ locEng->adapter->updateRegistrationMask(mMask,
+ mIsEnabled);
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngUpdateRegistrationMask\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngGnssConstellationConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (mAdapter->gnssConstellationConfig()) {
+ LOC_LOGV("Modem supports GNSS measurements\n");
+ gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
+ } else {
+ LOC_LOGV("Modem does not support GNSS measurements\n");
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngGnssConstellationConfig\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
+LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng,
+ GpsData &gpsData) :
+ LocMsg(), mLocEng(locEng), mGpsData(gpsData)
+{
+ locallog();
+}
+void LocEngReportGpsMeasurement::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gps_measurement_cb != NULL) {
+ locEng->gps_measurement_cb((GpsData*)&(mGpsData));
+ }
+ }
+}
+void LocEngReportGpsMeasurement::locallog() const {
+ IF_LOC_LOGV {
+ LOC_LOGV("%s:%d]: Received in GPS HAL."
+ "GNSS Measurements count: %d \n",
+ __func__, __LINE__, mGpsData.measurement_count);
+ for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
+ " GPS_HAL => Measurement ID | prn | time_offset_ns | state |"
+ " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |"
+ " pseudorange_rate_uncertainty_mps |"
+ " accumulated_delta_range_state | flags \n"
+ " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n",
+ i,
+ mGpsData.measurements[i].prn,
+ mGpsData.measurements[i].time_offset_ns,
+ mGpsData.measurements[i].state,
+ mGpsData.measurements[i].received_gps_tow_ns,
+ mGpsData.measurements[i].c_n0_dbhz,
+ mGpsData.measurements[i].pseudorange_rate_mps,
+ mGpsData.measurements[i].pseudorange_rate_uncertainty_mps,
+ mGpsData.measurements[i].accumulated_delta_range_state,
+ mGpsData.measurements[i].flags);
+ }
+ LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n"
+ " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type,
+ mGpsData.clock.time_ns);
+ }
+}
+inline void LocEngReportGpsMeasurement::log() const {
+ locallog();
+}
+
+/*********************************************************************
+* Initialization checking macros
+ *********************************************************************/
+#define STATE_CHECK(ctx, x, ret) \
+ if (!(ctx)) \
+ { \
+ /* Not intialized, abort */\
+ LOC_LOGE("%s: log_eng state error: %s", __func__, x); \
+ EXIT_LOG(%s, x); \
+ ret; \
+ }
+#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event, ContextBase* context)
+
+{
+ int ret_val = 0;
+
+ ENTRY_LOG_CALLFLOW();
+ if (NULL == callbacks || 0 == event) {
+ LOC_LOGE("loc_eng_init: bad parameters cb %p eMask %d", callbacks, event);
+ ret_val = -1;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+ }
+
+ STATE_CHECK((NULL == loc_eng_data.adapter),
+ "instance already initialized", return 0);
+
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data));
+
+ // Save callbacks
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+ loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+ loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
+ callbacks->location_ext_parser : noProc;
+ loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
+ callbacks->sv_ext_parser : noProc;
+ loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
+ loc_eng_data.shutdown_cb = callbacks->shutdown_cb;
+ // initial states taken care of by the memset above
+ // loc_eng_data.engine_status -- GPS_STATUS_NONE;
+ // loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
+ // loc_eng_data.mute_session_state -- LOC_MUTE_SESS_NONE;
+
+ if ((event & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) && (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_AP))
+ {
+ event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
+ loc_eng_data.generateNmea = true;
+ }
+ else
+ {
+ loc_eng_data.generateNmea = false;
+ }
+
+ loc_eng_data.adapter =
+ new LocEngAdapter(event, &loc_eng_data, context,
+ (MsgTask::tCreate)callbacks->create_thread_cb);
+
+ LOC_LOGD("loc_eng_init created client, id = %p\n",
+ loc_eng_data.adapter);
+ loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS == ret_val) {
+ LOC_LOGD("loc_eng_reinit reinit() successful");
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngGnssConstellationConfig(adapter));
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE,
+ sap_conf.SENSOR_PROVIDER));
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+
+ /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
+ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID )
+ {
+ adapter->sendMsg(new LocEngSensorProperties(adapter,
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sap_conf.GYRO_BIAS_RANDOM_WALK,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY));
+ }
+
+ adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter,
+ sap_conf.SENSOR_CONTROL_MODE,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK));
+
+ adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0)));
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // XTRA has no state, so we are fine with it.
+
+ // we need to check and clear NI
+#if 0
+ // we need to check and clear ATL
+ if (NULL != loc_eng_data.agnss_nif) {
+ delete loc_eng_data.agnss_nif;
+ loc_eng_data.agnss_nif = NULL;
+ }
+ if (NULL != loc_eng_data.internet_nif) {
+ delete loc_eng_data.internet_nif;
+ loc_eng_data.internet_nif = NULL;
+ }
+#endif
+ if (loc_eng_data.adapter->isInSession())
+ {
+ LOC_LOGD("loc_eng_cleanup: fix not stopped. stop it now.");
+ loc_eng_stop(loc_eng_data);
+ }
+
+#if 0 // can't afford to actually clean up, for many reason.
+
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ delete loc_eng_data.adapter;
+ loc_eng_data.adapter = NULL;
+
+ loc_eng_dmn_conn_loc_api_server_unblock();
+ loc_eng_dmn_conn_loc_api_server_join();
+
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (!loc_eng_data.adapter->isInSession()) {
+ ret_val = loc_eng_data.adapter->startFix();
+
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS ||
+ ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN)
+ {
+ loc_eng_data.adapter->setInSession(TRUE);
+ loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_BEGIN);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_stop_wrapper
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (loc_eng_data.adapter->isInSession()) {
+
+ ret_val = loc_eng_data.adapter->stopFix();
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS)
+ {
+ loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END);
+ }
+
+ loc_eng_data.adapter->setInSession(FALSE);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
+
+DESCRIPTION
+ Mutes one session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: Success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ int gnssType = getTargetGnssType(loc_get_target());
+
+ // The position mode for GSS/QCA1530 can only be standalone
+ bool is1530 = gnssType == GNSS_QCA1530;
+ bool isAPQ = gnssType == GNSS_GSS;
+ if ((isAPQ || is1530) && params.mode != LOC_POSITION_MODE_STANDALONE) {
+ params.mode = LOC_POSITION_MODE_STANDALONE;
+ LOC_LOGD("Position mode changed to standalone for target with GSS/qca1530.");
+ }
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
+ {
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngPositionMode(adapter, params));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
+ int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
+ uncertainty));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
+ double longitude, float accuracy)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ if(adapter->mSupportsPositionInjection)
+ {
+ adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
+ accuracy));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData f)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+
+ if (loc_eng_data.status_cb)
+ {
+ GpsStatus gs = { sizeof(gs),status };
+ CALLBACK_LOG_CALLFLOW("status_cb", %s,
+ loc_get_gps_status_name(gs.status));
+ loc_eng_data.status_cb(&gs);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ UlpLocation location;
+ LocPosTechMask tech_mask = LOC_POS_TECH_MASK_DEFAULT;
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+ memset(&location, 0, sizeof location);
+
+ ret_val = loc_eng_data.adapter->getZpp(location.gpsLocation, tech_mask);
+ //Mark the location source as from ZPP
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_ZPP;
+
+ loc_eng_data.adapter->getUlpProxy()->reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_SUCCESS,
+ tech_mask);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*
+ Callback function passed to Data Services State Machine
+ This becomes part of the state machine's servicer and
+ is used to send requests to the data services client
+*/
+static int dataCallCb(void *cb_data)
+{
+ LOC_LOGD("Enter dataCallCb\n");
+ int ret=0;
+ if(cb_data != NULL) {
+ dsCbData *cbData = (dsCbData *)cb_data;
+ LocEngAdapter *locAdapter = (LocEngAdapter *)cbData->mAdapter;
+ if(cbData->action == GPS_REQUEST_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_REQUEST_AGPS_DATA_CONN\n");
+ ret = locAdapter->openAndStartDataCall();
+ }
+ else if(cbData->action == GPS_RELEASE_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_RELEASE_AGPS_DATA_CONN\n");
+ locAdapter->stopDataCall();
+ }
+ }
+ else {
+ LOC_LOGE("NULL argument received. Failing.\n");
+ ret = -1;
+ goto err;
+ }
+
+err:
+ LOC_LOGD("Exit dataCallCb ret = %d\n", ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_reinit
+
+DESCRIPTION
+ 2nd half of loc_eng_agps_init(), singled out for modem restart to use.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+
+ // Set server addresses which came before init
+ if (loc_eng_data.supl_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_SUPL_SERVER,
+ loc_eng_data.supl_host_buf,
+ loc_eng_data.supl_port_buf);
+ }
+
+ if (loc_eng_data.c2k_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_CDMA_PDE_SERVER,
+ loc_eng_data.c2k_host_buf,
+ loc_eng_data.c2k_port_buf);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+ STATE_CHECK((NULL == loc_eng_data.agps_status_cb),
+ "agps instance already initialized",
+ return);
+ if (callbacks == NULL) {
+ LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks);
+ EXIT_LOG(%s, VOID_RET);
+ return;
+ }
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WWAN_ANY,
+ false);
+ loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WIFI,
+ true);
+
+ int gnssType = getTargetGnssType(loc_get_target());
+ bool isAPQ = (gnssType == GNSS_GSS);
+ bool is1530 = (gnssType == GNSS_QCA1530);
+ if (!isAPQ && !is1530) {
+ loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_SUPL,
+ false);
+
+ if (adapter->mSupportsAgpsRequests) {
+ loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data));
+
+ loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
+ NULL, NULL, &loc_eng_data);
+ }
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void deleteAidingData(loc_eng_data_s_type &logEng) {
+ if (logEng.engine_status != GPS_STATUS_ENGINE_ON &&
+ logEng.aiding_data_for_deletion != 0) {
+ logEng.adapter->deleteAidingData(logEng.aiding_data_for_deletion);
+ logEng.aiding_data_for_deletion = 0;
+ }
+}
+
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
+ AgpsStateMachine* stateMachine;
+ switch (agpsType) {
+ case AGPS_TYPE_WIFI: {
+ stateMachine = locEng.wifi_nif;
+ break;
+ }
+ case AGPS_TYPE_INVALID:
+ case AGPS_TYPE_SUPL: {
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ case AGPS_TYPE_SUPL_ES: {
+ stateMachine = locEng.ds_nif;
+ break;
+ }
+ default:
+ stateMachine = locEng.internet_nif;
+ }
+ return stateMachine;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ if (apn == NULL)
+ {
+ LOC_LOGE("APN Name NULL\n");
+ return 0;
+ }
+
+ LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
+
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+
+ loc_eng_data.adapter->sendMsg(
+ new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform engine about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION resolve_in_addr
+
+DESCRIPTION
+ Translates a hostname to in_addr struct
+
+DEPENDENCIES
+ n/a
+
+RETURN VALUE
+ TRUE if successful
+
+SIDE EFFECTS
+ n/a
+
+===========================================================================*/
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
+{
+ ENTRY_LOG();
+ boolean ret_val = TRUE;
+
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ ret_val = FALSE;
+ }
+ }
+
+ EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server
+
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ int ret = 0;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ char url[MAX_URL_LEN];
+ unsigned int len = 0;
+ const char nohost[] = "NONE";
+ if (hostname == NULL ||
+ strncasecmp(nohost, hostname, sizeof(nohost)) == 0) {
+ url[0] = NULL;
+ } else {
+ len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port);
+ }
+
+ if (sizeof(url) > len) {
+ adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len));
+ }
+ } else if (LOC_AGPS_CDMA_PDE_SERVER == type ||
+ LOC_AGPS_CUSTOM_PDE_SERVER == type ||
+ LOC_AGPS_MPC_SERVER == type) {
+ struct in_addr addr;
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ ret = -2;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ adapter->sendMsg(new LocEngSetServerIpv4(adapter, ip, port, type));
+ }
+ } else {
+ LOC_LOGE("loc_eng_set_server, type %d cannot be resolved.\n", type);
+ }
+
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server_proxy
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type,
+ const char* hostname, int port)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = 0;
+
+ LOC_LOGV("save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case LOC_AGPS_SUPL_SERVER:
+ strlcpy(loc_eng_data.supl_host_buf, hostname,
+ sizeof(loc_eng_data.supl_host_buf));
+ loc_eng_data.supl_port_buf = port;
+ loc_eng_data.supl_host_set = 1;
+ break;
+ case LOC_AGPS_CDMA_PDE_SERVER:
+ strlcpy(loc_eng_data.c2k_host_buf, hostname,
+ sizeof(loc_eng_data.c2k_host_buf));
+ loc_eng_data.c2k_port_buf = port;
+ loc_eng_data.c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+
+ if (NULL != loc_eng_data.adapter)
+ {
+ ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int available, const char* apn)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ //This is to store the status of data availability over the network.
+ //If GPS is not enabled, the INIT_CHECK will fail and the modem will
+ //not be updated with the network's availability. Since the data status
+ //can change before GPS is enabled the, storing the status will enable
+ //us to inform the modem after GPS is enabled
+ agpsStatus = available;
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+ if (apn != NULL)
+ {
+ LOC_LOGD("loc_eng_agps_ril_update_network_availability: APN Name = [%s]\n", apn);
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngEnableData(adapter, apn, apn_len, available));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t numberOfCerts)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+
+ uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK;
+ uint32_t slotCount = 0;
+ for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) {
+ slotBitMaskCounter &= slotBitMaskCounter - 1;
+ }
+ LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u",
+ slotBitMask, slotCount, numberOfCerts);
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (numberOfCerts == 0) {
+ LOC_LOGE("No certs to install, since numberOfCerts is zero");
+ ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+ } else if (!adapter) {
+ LOC_LOGE("adapter is null!");
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ } else if (slotCount < numberOfCerts) {
+ LOC_LOGE("Not enough cert slots (%u) to install %u certs!",
+ slotCount, numberOfCerts);
+ ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES;
+ } else {
+ for (int i=0; i < numberOfCerts; ++i)
+ {
+ if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) {
+ LOC_LOGE("cert#(%u) length of %u is too big! greater than %u",
+ certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH);
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ break;
+ }
+ }
+
+ if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) {
+ adapter->sendMsg(new LocEngInstallAGpsCert(adapter,
+ certificates,
+ numberOfCerts,
+ slotBitMask));
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if (config_data && length > 0) {
+ loc_gps_cfg_s_type gps_conf_tmp = gps_conf;
+ UTIL_UPDATE_CONF(config_data, length, gps_conf_table);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ // it is possible that HAL is not init'ed at this time
+ if (adapter) {
+ if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) {
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ }
+ if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) {
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ }
+ if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) {
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter,
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+ }
+ }
+
+ gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER;
+ gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE;
+ gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT;
+ gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK;
+ gps_conf = gps_conf_tmp;
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+ // Switch from WAIT to MUTE, for "engine on" or "session begin" event
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+
+ // Switch off MUTE session
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION &&
+ (status == GPS_STATUS_SESSION_END || status == GPS_STATUS_ENGINE_OFF))
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+
+ // Session End is not reported during Android navigating state
+ boolean navigating = loc_eng_data.adapter->isInSession();
+ if (status != GPS_STATUS_NONE &&
+ !(status == GPS_STATUS_SESSION_END && navigating) &&
+ !(status == GPS_STATUS_SESSION_BEGIN && !navigating))
+ {
+ if (loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ // Inform GpsLocationProvider about mNavigating status
+ loc_inform_gps_status(loc_eng_data, status);
+ }
+ else {
+ LOC_LOGD("loc_eng_report_status: muting the status report.");
+ }
+ }
+
+ // Only keeps ENGINE ON/OFF in engine_status
+ if (status == GPS_STATUS_ENGINE_ON || status == GPS_STATUS_ENGINE_OFF)
+ {
+ loc_eng_data.engine_status = status;
+ }
+
+ // Only keeps SESSION BEGIN/END in fix_session_status
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = status;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_engine_down
+ loc_eng_handle_engine_up
+
+DESCRIPTION
+ Calls this function when it is detected that modem restart is happening.
+ Either we detected the modem is down or received modem up event.
+ This must be called from the deferred thread to avoid race condition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_reset_on_engine_restart(loc_eng_data);
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_OFF);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_reinit(loc_eng_data);
+
+ loc_eng_data.adapter->requestPowerVote();
+
+ if (loc_eng_data.agps_status_cb != NULL) {
+ if (loc_eng_data.agnss_nif)
+ loc_eng_data.agnss_nif->dropAllSubscribers();
+ if (loc_eng_data.internet_nif)
+ loc_eng_data.internet_nif->dropAllSubscribers();
+
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_ON);
+
+ // modem is back up. If we crashed in the middle of navigating, we restart.
+ if (loc_eng_data.adapter->isInSession()) {
+ // This sets the copy in adapter to modem
+ loc_eng_data.adapter->setPositionMode(NULL);
+ loc_eng_data.adapter->setInSession(false);
+ loc_eng_start_handler(loc_eng_data);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+#ifdef USE_GLIB
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+#endif /* USE_GLIB */
+
+/*===========================================================================
+FUNCTION loc_eng_read_config
+
+DESCRIPTION
+ Initiates the reading of the gps config file stored in /etc dir
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_read_config(void)
+{
+ ENTRY_LOG_CALLFLOW();
+ if(configAlreadyRead == false)
+ {
+ // Initialize our defaults before reading of configuration file overwrites them.
+ loc_default_parameters();
+ // We only want to parse the conf file once. This is a good place to ensure that.
+ // In fact one day the conf file should go into context.
+ UTIL_READ_CONF(GPS_CONF_FILE, gps_conf_table);
+ UTIL_READ_CONF(SAP_CONF_FILE, sap_conf_table);
+ configAlreadyRead = true;
+ } else {
+ LOC_LOGV("GPS Config file has already been read\n");
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_shutdown
+
+DESCRIPTION
+ Calls the shutdown callback function in the loc interface to close
+ the modem node
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_shutdown(loc_eng_data_s_type &locEng)
+{
+ ENTRY_LOG();
+ locEng.shutdown_cb();
+ EXIT_LOG(%d, 0);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_init
+
+DESCRIPTION
+ Initialize gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb),
+ "gps measurement already initialized",
+ return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
+ STATE_CHECK((callbacks != NULL),
+ "callbacks can not be NULL",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+ STATE_CHECK(loc_eng_data.adapter,
+ "GpsInterface must be initialized first",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_ENABLED));
+ // set up the callback
+ loc_eng_data.gps_measurement_cb = callbacks->measurement_callback;
+ LOC_LOGD ("%s, event masks updated successfully", __func__);
+
+ return GPS_MEASUREMENT_OPERATION_SUCCESS;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_close
+
+DESCRIPTION
+ Close gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_DISABLED));
+ // set up the callback
+ loc_eng_data.gps_measurement_cb = NULL;
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng.h b/msm8084/loc_api/libloc_api_50001/loc_eng.h
new file mode 100644
index 0000000..e954953
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng.h
@@ -0,0 +1,272 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_H
+#define LOC_ENG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+#define MAX_NUM_ATL_CONNECTIONS 2
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc.h>
+#include <loc_eng_xtra.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_agps.h>
+#include <loc_cfg.h>
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_eng_agps.h>
+#include <LocEngAdapter.h>
+
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+#define SUCCESS TRUE
+#define FAILURE FALSE
+#define INVALID_ATL_CONNECTION_HANDLE -1
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+enum loc_nmea_provider_e_type {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+};
+
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE = 0,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
+// Module data
+typedef struct loc_eng_data_s
+{
+ LocEngAdapter *adapter;
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ agps_status_extended agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_request_utc_time request_utc_time_cb;
+ gps_measurement_callback gps_measurement_cb;
+ boolean intermediateFix;
+ AGpsStatusValue agps_status;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ loc_eng_ni_data_s_type loc_eng_ni_data;
+
+ // AGPS state machines
+ AgpsStateMachine* agnss_nif;
+ AgpsStateMachine* internet_nif;
+ AgpsStateMachine* wifi_nif;
+ //State machine for Data Services
+ AgpsStateMachine* ds_nif;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // For muting session broadcast
+ loc_mute_session_e_type mute_session_state;
+
+ // For nmea generation
+ boolean generateNmea;
+ uint32_t sv_used_mask;
+ float hdop;
+ float pdop;
+ float vdop;
+
+ // Address buffers, for addressing setting before init
+ int supl_host_set;
+ char supl_host_buf[101];
+ int supl_port_buf;
+ int c2k_host_set;
+ char c2k_host_buf[101];
+ int c2k_port_buf;
+ int mpc_host_set;
+ char mpc_host_buf[101];
+ int mpc_port_buf;
+
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ loc_shutdown_cb shutdown_cb;
+} loc_eng_data_s_type;
+
+/* 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 CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t NMEA_PROVIDER;
+ uint32_t GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+ char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} loc_sap_cfg_s_type;
+
+extern loc_gps_cfg_s_type gps_conf;
+extern loc_sap_cfg_s_type sap_conf;
+
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
+ LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event,
+ ContextBase* context);
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data,
+ GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
+ double latitude, double longitude,
+ float accuracy);
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
+ GpsAidingData f);
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms);
+const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
+ const char* name);
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
+ AGpsExtCallbacks* callbacks);
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType);
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+
+
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int avaiable, const char* apn);
+
+
+bool loc_eng_inject_raw_command(loc_eng_data_s_type &loc_eng_data,
+ char* command, int length);
+
+
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data);
+
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks);
+
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length);
+
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data);
+
+extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data,
+ GpsNiExtCallbacks *callbacks);
+extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response);
+extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough);
+extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
+
+int loc_eng_read_config(void);
+
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t length);
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length);
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks);
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // LOC_ENG_H
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_agps.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_agps.cpp
new file mode 100644
index 0000000..d90d5d3
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -0,0 +1,971 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng_agps.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <platform_lib_includes.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_dmn_conn.h>
+#include <sys/time.h>
+
+//======================================================================
+// C callbacks
+//======================================================================
+
+// This is given to linked_list_add as the dealloc callback
+// data -- an instance of Subscriber
+static void deleteObj(void* data)
+{
+ delete (Subscriber*)data;
+}
+
+// This is given to linked_list_search() as the comparison callback
+// when the state manchine needs to process for particular subscriber
+// fromCaller -- caller provides this obj
+// fromList -- linked_list_search() function take this one from list
+static bool hasSubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ return s1->forMe(*notification);
+}
+
+// This is gvien to linked_list_search() to notify subscriber objs
+// when the state machine needs to inform all subscribers of resource
+// status changes, e.g. when resource is GRANTED.
+// fromCaller -- caller provides this ptr to a Notification obj.
+// fromList -- linked_list_search() function take this one from list
+static bool notifySubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ // we notify every subscriber indiscriminatively
+ // each subscriber decides if this notification is interesting.
+ return s1->notifyRsrcStatus(*notification) &&
+ // if we do not want to delete the subscriber from the
+ // the list, we must set this to false so this function
+ // returns false
+ notification->postNotifyDelete;
+}
+
+//======================================================================
+// Notification
+//======================================================================
+const int Notification::BROADCAST_ALL = 0x80000000;
+const int Notification::BROADCAST_ACTIVE = 0x80000001;
+const int Notification::BROADCAST_INACTIVE = 0x80000002;
+const unsigned char DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const unsigned int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+//======================================================================
+// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
+//======================================================================
+bool Subscriber::forMe(Notification ¬ification)
+{
+ if (NULL != notification.rcver) {
+ return equals(notification.rcver);
+ } else {
+ return Notification::BROADCAST_ALL == notification.groupID ||
+ (Notification::BROADCAST_ACTIVE == notification.groupID &&
+ !isInactive()) ||
+ (Notification::BROADCAST_INACTIVE == notification.groupID &&
+ isInactive());
+ }
+}
+bool BITSubscriber::equals(const Subscriber *s) const
+{
+ BITSubscriber* bitS = (BITSubscriber*)s;
+
+ return (ID == bitS->ID &&
+ (INADDR_NONE != (unsigned int)ID ||
+ 0 == strncmp(mIPv6Addr, bitS->mIPv6Addr, sizeof(mIPv6Addr))));
+}
+
+bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ ((LocEngAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_DENIED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ case RSRC_GRANTED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ break;
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+bool DSSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+ LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
+ if(notify) {
+ switch(notification.rsrcStatus) {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ case RSRC_GRANTED:
+ ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
+ break;
+ default:
+ notify = false;
+ }
+ }
+ return notify;
+}
+void DSSubscriber :: setInactive()
+{
+ mIsInactive = true;
+ ((DSStateMachine *)mStateMachine)->informStatus(RSRC_UNSUBSCRIBE, ID);
+}
+//======================================================================
+// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
+//======================================================================
+
+// AgpsReleasedState
+class AgpsReleasedState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasedState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasedState = this; }
+
+ inline ~AgpsReleasedState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasedState";}
+};
+
+AgpsState* AgpsReleasedState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ LOC_LOGD("AgpsReleasedState::onRsrcEvent; event:%d\n", (int)event);
+ if (mStateMachine->hasSubscribers()) {
+ LOC_LOGE("Error: %s subscriber list not empty!!!", whoami());
+ // I don't know how to recover from it. I am adding this rather
+ // for debugging purpose.
+ }
+
+ AgpsState* nextState = this;
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // no notification until we get RSRC_GRANTED
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // request from connecivity service for NIF
+ //The if condition is added so that if the data call setup fails
+ //for DS State Machine, we want to retry in released state.
+ //for AGps State Machine, sendRsrcRequest() will always return success
+ if(!mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN)) {
+ // move the state to PENDING
+ nextState = mPendingState;
+ }
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ // the list should really be empty, nothing to remove.
+ // but we might as well just tell the client it is
+ // unsubscribed. False tolerance, right?
+ Subscriber* subscriber = (Subscriber*) data;
+ Notification notification(subscriber, event, false);
+ subscriber->notifyRsrcStatus(notification);
+ }
+ // break;
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ default:
+ LOC_LOGW("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ break;
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsPendingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsPendingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mPendingState = this; }
+
+ inline ~AgpsPendingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsPendingState";}
+};
+
+AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsPendingState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_ACTIVE, event, false);
+ // notify all subscribers NIF resource GRANTED
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_RELEASED:
+ // no state change.
+ // we are expecting either GRANTED or DENIED. Handling RELEASED
+ // may like break our state machine in race conditions.
+ break;
+
+ case RSRC_DENIED:
+ {
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // notify all subscribers NIF resource RELEASED or DENIED
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+
+class AgpsAcquiredState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsAcquiredState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mAcquiredState = this; }
+
+ inline ~AgpsAcquiredState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() { return (char*)"AgpsAcquiredState"; }
+};
+
+
+AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;
+ LOC_LOGD("AgpsAcquiredState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // we already have the NIF resource, simply notify subscriber
+ Subscriber* subscriber = (Subscriber*) data;
+ // we have rsrc in hand, so grant it right away
+ Notification notification(subscriber, RSRC_GRANTED, false);
+ subscriber->notifyRsrcStatus(notification);
+ // add subscriber to the list
+ mStateMachine->addSubscriber(subscriber);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ LOC_LOGW("%s: %d, RSRC_GRANTED already received", whoami(), event);
+ // no state change.
+ break;
+
+ case RSRC_RELEASED:
+ {
+ LOC_LOGW("%s: %d, a force rsrc release", whoami(), event);
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_DENIED:
+ // no state change.
+ // we are expecting RELEASED. Handling DENIED
+ // may like break our state machine in race conditions.
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsReleasingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasingState = this; }
+
+ inline ~AgpsReleasingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasingState";}
+};
+
+AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsReleasingState::onRsrcEvent; event:%d\n", (int)event);
+
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_DENIED:
+ // A race condition subscriber unsubscribes before AFW denies resource.
+ case RSRC_RELEASED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_INACTIVE, event, true);
+ // notify all subscribers that are active NIF resource RELEASE
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+
+ if (mStateMachine->hasActiveSubscribers()) {
+ nextState = mPendingState;
+ // request from connecivity service for NIF
+ mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN);
+ } else {
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+//======================================================================
+//Servicer
+//======================================================================
+Servicer* Servicer :: getServicer(servicerType type, void *cb_func)
+{
+ LOC_LOGD(" Enter getServicer type:%d\n", (int)type);
+ switch(type) {
+ case servicerTypeNoCbParam:
+ return (new Servicer(cb_func));
+ case servicerTypeExt:
+ return (new ExtServicer(cb_func));
+ case servicerTypeAgps:
+ return (new AGpsServicer(cb_func));
+ default:
+ return NULL;
+ }
+}
+
+int Servicer :: requestRsrc(void *cb_data)
+{
+ callback();
+ return 0;
+}
+
+int ExtServicer :: requestRsrc(void *cb_data)
+{
+ int ret=-1;
+ LOC_LOGD("Enter ExtServicer :: requestRsrc\n");
+ ret = callbackExt(cb_data);
+ LOC_LOGD("Exit ExtServicer :: requestRsrc\n");
+ return(ret);
+}
+
+int AGpsServicer :: requestRsrc(void *cb_data)
+{
+ callbackAGps((AGpsStatus *)cb_data);
+ return 0;
+}
+
+//======================================================================
+// AgpsStateMachine
+//======================================================================
+
+AgpsStateMachine::AgpsStateMachine(servicerType servType,
+ void *cb_func,
+ AGpsExtType type,
+ bool enforceSingleSubscriber) :
+ mStatePtr(new AgpsReleasedState(this)),mType(type),
+ mAPN(NULL),
+ mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID),
+ mEnforceSingleSubscriber(enforceSingleSubscriber),
+ mServicer(Servicer :: getServicer(servType, (void *)cb_func))
+{
+ linked_list_init(&mSubscribers);
+
+ // setting up mReleasedState
+ mStatePtr->mPendingState = new AgpsPendingState(this);
+ mStatePtr->mAcquiredState = new AgpsAcquiredState(this);
+ mStatePtr->mReleasingState = new AgpsReleasingState(this);
+
+ // setting up mAcquiredState
+ mStatePtr->mAcquiredState->mReleasedState = mStatePtr;
+ mStatePtr->mAcquiredState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mAcquiredState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mPendingState
+ mStatePtr->mPendingState->mAcquiredState = mStatePtr->mAcquiredState;
+ mStatePtr->mPendingState->mReleasedState = mStatePtr;
+ mStatePtr->mPendingState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mReleasingState
+ mStatePtr->mReleasingState->mReleasedState = mStatePtr;
+ mStatePtr->mReleasingState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mReleasingState->mAcquiredState = mStatePtr->mAcquiredState;
+}
+
+AgpsStateMachine::~AgpsStateMachine()
+{
+ dropAllSubscribers();
+
+ // free the 3 states. We must read out all 3 pointers first.
+ // Otherwise we run the risk of getting pointers from already
+ // freed memory.
+ AgpsState* acquiredState = mStatePtr->mAcquiredState;
+ AgpsState* releasedState = mStatePtr->mReleasedState;
+ AgpsState* pendindState = mStatePtr->mPendingState;
+ AgpsState* releasingState = mStatePtr->mReleasingState;
+
+ delete acquiredState;
+ delete releasedState;
+ delete pendindState;
+ delete releasingState;
+ delete mServicer;
+ linked_list_destroy(&mSubscribers);
+
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ mAPN = NULL;
+ }
+}
+
+void AgpsStateMachine::setAPN(const char* apn, unsigned int len)
+{
+ if (NULL != mAPN) {
+ delete mAPN;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ memcpy(mAPN, apn, len);
+ mAPN[len] = NULL;
+
+ mAPNLen = len;
+ } else {
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+}
+
+void AgpsStateMachine::onRsrcEvent(AgpsRsrcStatus event)
+{
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+}
+
+void AgpsStateMachine::notifySubscribers(Notification& notification) const
+{
+ if (notification.postNotifyDelete) {
+ // just any non NULL value to get started
+ Subscriber* s = (Subscriber*)~0;
+ while (NULL != s) {
+ s = NULL;
+ // if the last param sets to true, _search will delete
+ // the node from the list for us. But the problem is
+ // once that is done, _search returns, leaving the
+ // rest of the list unprocessed. So we need a loop.
+ linked_list_search(mSubscribers, (void**)&s, notifySubscriber,
+ (void*)¬ification, true);
+ delete s;
+ }
+ } else {
+ // no loop needed if it the last param sets to false, which
+ // mean nothing gets deleted from the list.
+ linked_list_search(mSubscribers, NULL, notifySubscriber,
+ (void*)¬ification, false);
+ }
+}
+
+void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL == s) {
+ linked_list_add(mSubscribers, subscriber->clone(), deleteObj);
+ }
+}
+
+int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+
+ if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) {
+ AGpsExtStatus nifRequest;
+ nifRequest.size = sizeof(nifRequest);
+ nifRequest.type = mType;
+ nifRequest.status = action;
+
+ if (s == NULL) {
+ nifRequest.ipv4_addr = INADDR_NONE;
+ memset(&nifRequest.addr, 0, sizeof(nifRequest.addr));
+ nifRequest.addr.ss_family = AF_INET6;
+ nifRequest.ssid[0] = '\0';
+ nifRequest.password[0] = '\0';
+ } else {
+ s->setIPAddresses(nifRequest.addr);
+ s->setWifiInfo(nifRequest.ssid, nifRequest.password);
+ }
+
+ CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
+ mServicer->requestRsrc((void *)&nifRequest);
+ }
+ return 0;
+}
+
+void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
+{
+ if (mEnforceSingleSubscriber && hasSubscribers()) {
+ Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
+ notifySubscriber(¬ification, subscriber);
+ } else {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
+ }
+}
+
+bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL != s) {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_UNSUBSCRIBE, (void*)s);
+ return true;
+ }
+ return false;
+}
+
+bool AgpsStateMachine::hasActiveSubscribers() const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+ return NULL != s;
+}
+
+//======================================================================
+// DSStateMachine
+//======================================================================
+void delay_callback(void *callbackData, int result)
+{
+ if(callbackData) {
+ DSStateMachine *DSSMInstance = (DSStateMachine *)callbackData;
+ DSSMInstance->retryCallback();
+ }
+ else {
+ LOC_LOGE(" NULL argument received. Failing.\n");
+ goto err;
+ }
+err:
+ return;
+}
+
+DSStateMachine :: DSStateMachine(servicerType type, void *cb_func,
+ LocEngAdapter* adapterHandle):
+ AgpsStateMachine(type, cb_func, AGPS_TYPE_INVALID,false),
+ mLocAdapter(adapterHandle)
+{
+ LOC_LOGD("%s:%d]: New DSStateMachine\n", __func__, __LINE__);
+ mRetries = 0;
+}
+
+void DSStateMachine :: retryCallback(void)
+{
+ DSSubscriber *subscriber = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&subscriber, hasSubscriber,
+ (void*)¬ification, false);
+ if(subscriber)
+ mLocAdapter->requestSuplES(subscriber->ID);
+ else
+ LOC_LOGE("DSStateMachine :: retryCallback: No subscriber found." \
+ "Cannot retry data call\n");
+ return;
+}
+
+int DSStateMachine :: sendRsrcRequest(AGpsStatusValue action) const
+{
+ DSSubscriber* s = NULL;
+ dsCbData cbData;
+ int ret=-1;
+ int connHandle=-1;
+ LOC_LOGD("Enter DSStateMachine :: sendRsrcRequest\n");
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+ if(s) {
+ connHandle = s->ID;
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - subscriber found\n");
+ }
+ else
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - No subscriber found\n");
+
+ cbData.action = action;
+ cbData.mAdapter = mLocAdapter;
+ ret = mServicer->requestRsrc((void *)&cbData);
+ //Only the request to start data call returns a success/failure
+ //The request to stop data call will always succeed
+ //Hence, the below block will only be executed when the
+ //request to start the data call fails
+ switch(ret) {
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - Failure returned: %d\n",ret);
+ ((DSStateMachine *)this)->incRetries();
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+ LOC_LOGE(" Failed to start Data call. Fallback to normal ATL SUPL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ }
+ else {
+ if(loc_timer_start(DATA_CALL_RETRY_DELAY_MSEC, delay_callback, (void *)this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ ret = -1;
+ goto err;
+ }
+ }
+ break;
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No profile found for emergency call. Fallback to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("%s:%d]: Request to start data call sent\n", __func__, __LINE__);
+ break;
+ case -1:
+ //One of the ways this case can be encountered is if the callback function
+ //receives a null argument, it just exits with -1 error
+ LOC_LOGE("Error: Something went wrong somewhere. Falling back to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Unrecognized return value\n", __func__, __LINE__);
+ }
+err:
+ LOC_LOGD("EXIT DSStateMachine :: sendRsrcRequest; ret = %d\n", ret);
+ return ret;
+}
+
+void DSStateMachine :: onRsrcEvent(AgpsRsrcStatus event)
+{
+ void* currState = (void *)mStatePtr;
+ LOC_LOGD("Enter DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_GRANTED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ case RSRC_RELEASED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_RELEASED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ //To handle the case where we get a RSRC_RELEASED in
+ //pending state, we translate that to a RSRC_DENIED state
+ //since the callback from DSI is either RSRC_GRANTED or RSRC_RELEASED
+ //for when the call is connected or disconnected respectively.
+ if((void *)mStatePtr != currState)
+ break;
+ else {
+ event = RSRC_DENIED;
+ LOC_LOGE(" Switching event to RSRC_DENIED\n");
+ }
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+ LOC_LOGD("Exit DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+}
+
+void DSStateMachine :: informStatus(AgpsRsrcStatus status, int ID) const
+{
+ LOC_LOGD("DSStateMachine :: informStatus. Status=%d\n",(int)status);
+ switch(status) {
+ case RSRC_UNSUBSCRIBE:
+ mLocAdapter->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_RELEASED:
+ mLocAdapter->closeDataCall();
+ break;
+ case RSRC_DENIED:
+ ((DSStateMachine *)this)->mRetries = 0;
+ mLocAdapter->requestATL(ID, AGPS_TYPE_SUPL);
+ break;
+ case RSRC_GRANTED:
+ mLocAdapter->atlOpenStatus(ID, 1,
+ NULL,
+ AGPS_APN_BEARER_INVALID,
+ AGPS_TYPE_INVALID);
+ break;
+ default:
+ LOC_LOGW("DSStateMachine :: informStatus - unknown status");
+ }
+ return;
+}
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_agps.h b/msm8084/loc_api/libloc_api_50001/loc_eng_agps.h
new file mode 100644
index 0000000..d558644
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -0,0 +1,432 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_ENG_AGPS_H__
+#define __LOC_ENG_AGPS_H__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_core_log.h>
+#include <linked_list.h>
+#include <loc_timer.h>
+#include <LocEngAdapter.h>
+
+// forward declaration
+class AgpsStateMachine;
+class Subscriber;
+
+// NIF resource events
+typedef enum {
+ RSRC_SUBSCRIBE,
+ RSRC_UNSUBSCRIBE,
+ RSRC_GRANTED,
+ RSRC_RELEASED,
+ RSRC_DENIED,
+ RSRC_STATUS_MAX
+} AgpsRsrcStatus;
+
+typedef enum {
+ servicerTypeNoCbParam,
+ servicerTypeAgps,
+ servicerTypeExt
+}servicerType;
+
+//DS Callback struct
+typedef struct {
+ LocEngAdapter *mAdapter;
+ AGpsStatusValue action;
+}dsCbData;
+
+// information bundle for subscribers
+struct Notification {
+ // goes to every subscriber
+ static const int BROADCAST_ALL;
+ // goes to every ACTIVE subscriber
+ static const int BROADCAST_ACTIVE;
+ // goes to every INACTIVE subscriber
+ static const int BROADCAST_INACTIVE;
+
+ // go to a specific subscriber
+ const Subscriber* rcver;
+ // broadcast
+ const int groupID;
+ // the new resource status event
+ const AgpsRsrcStatus rsrcStatus;
+ // should the subscriber be deleted after the notification
+ const bool postNotifyDelete;
+
+ // convenient constructor
+ inline Notification(const int broadcast,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(subscriber), groupID(-1), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const int broadcast) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber) :
+ rcver(subscriber), groupID(-1), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+};
+
+class AgpsState {
+ // allows AgpsStateMachine to access private data
+ // no class members are public. We don't want
+ // anyone but state machine to use state.
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+ // state transitions are done here.
+ // Each state implements its own transitions (of course).
+ inline virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data) = 0;
+
+protected:
+ // handle back to state machine
+ const AgpsStateMachine* mStateMachine;
+ // each state has pointers to all 3 states
+ // one of which is to itself.
+ AgpsState* mReleasedState;
+ AgpsState* mAcquiredState;
+ AgpsState* mPendingState;
+ AgpsState* mReleasingState;
+
+ inline AgpsState(const AgpsStateMachine *stateMachine) :
+ mStateMachine(stateMachine),
+ mReleasedState(NULL),
+ mAcquiredState(NULL),
+ mPendingState(NULL),
+ mReleasingState(NULL) {}
+ virtual ~AgpsState() {}
+
+public:
+ // for logging purpose
+ inline virtual char* whoami() = 0;
+};
+
+class Servicer {
+ void (*callback)(void);
+public:
+ static Servicer* getServicer(servicerType type, void *cb_func);
+ virtual int requestRsrc(void *cb_data);
+ Servicer() {}
+ Servicer(void *cb_func)
+ { callback = (void(*)(void))(cb_func); }
+ virtual ~Servicer(){}
+ inline virtual char *whoami() {return (char*)"Servicer";}
+};
+
+class ExtServicer : public Servicer {
+ int (*callbackExt)(void *cb_data);
+public:
+ int requestRsrc(void *cb_data);
+ ExtServicer() {}
+ ExtServicer(void *cb_func)
+ { callbackExt = (int(*)(void *))(cb_func); }
+ virtual ~ExtServicer(){}
+ inline virtual char *whoami() {return (char*)"ExtServicer";}
+};
+
+class AGpsServicer : public Servicer {
+ void (*callbackAGps)(AGpsStatus* status);
+public:
+ int requestRsrc(void *cb_data);
+ AGpsServicer() {}
+ AGpsServicer(void *cb_func)
+ { callbackAGps = (void(*)(AGpsStatus *))(cb_func); }
+ virtual ~AGpsServicer(){}
+ inline virtual char *whoami() {return (char*)"AGpsServicer";}
+};
+
+class AgpsStateMachine {
+protected:
+ // a linked list of subscribers.
+ void* mSubscribers;
+ //handle to whoever provides the service
+ Servicer *mServicer;
+ // allows AgpsState to access private data
+ // each state is really internal data to the
+ // state machine, so it should be able to
+ // access anything within the state machine.
+ friend class AgpsState;
+ // pointer to the current state.
+ AgpsState* mStatePtr;
+private:
+ // NIF type: AGNSS or INTERNET.
+ const AGpsExtType mType;
+ // apn to the NIF. Each state machine tracks
+ // resource state of a particular NIF. For each
+ // NIF, there is also an active APN.
+ char* mAPN;
+ // for convenience, we don't do strlen each time.
+ unsigned int mAPNLen;
+ // bear
+ AGpsBearerType mBearer;
+ // ipv4 address for routing
+ bool mEnforceSingleSubscriber;
+
+public:
+ AgpsStateMachine(servicerType servType, void *cb_func,
+ AGpsExtType type, bool enforceSingleSubscriber);
+ virtual ~AgpsStateMachine();
+
+ // self explanatory methods below
+ void setAPN(const char* apn, unsigned int len);
+ inline const char* getAPN() const { return (const char*)mAPN; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return (AGpsExtType)mType; }
+
+ // someone, a ATL client or BIT, is asking for NIF
+ void subscribeRsrc(Subscriber *subscriber);
+
+ // someone, a ATL client or BIT, is done with NIF
+ bool unsubscribeRsrc(Subscriber *subscriber);
+
+ // add a subscriber in the linked list, if not already there.
+ void addSubscriber(Subscriber* subscriber) const;
+
+ virtual void onRsrcEvent(AgpsRsrcStatus event);
+
+ // put the data together and send the FW
+ virtual int sendRsrcRequest(AGpsStatusValue action) const;
+
+ //if list is empty, linked_list_empty returns 1
+ //else if list is not empty, returns 0
+ //so hasSubscribers() returns 1 if list is not empty
+ //and returns 0 if list is empty
+ inline bool hasSubscribers() const
+ { return !linked_list_empty(mSubscribers); }
+
+ bool hasActiveSubscribers() const;
+
+ inline void dropAllSubscribers() const
+ { linked_list_flush(mSubscribers); }
+
+ // private. Only a state gets to call this.
+ void notifySubscribers(Notification& notification) const;
+
+};
+
+class DSStateMachine : public AgpsStateMachine {
+ static const unsigned char MAX_START_DATA_CALL_RETRIES;
+ static const unsigned int DATA_CALL_RETRY_DELAY_MSEC;
+ LocEngAdapter* mLocAdapter;
+ unsigned char mRetries;
+public:
+ DSStateMachine(servicerType type,
+ void *cb_func,
+ LocEngAdapter* adapterHandle);
+ int sendRsrcRequest(AGpsStatusValue action) const;
+ void onRsrcEvent(AgpsRsrcStatus event);
+ void retryCallback();
+ void informStatus(AgpsRsrcStatus status, int ID) const;
+ inline void incRetries() {mRetries++;}
+ inline virtual char *whoami() {return (char*)"DSStateMachine";}
+};
+
+// each subscriber is a AGPS client. In the case of ATL, there could be
+// multiple clients from modem. In the case of BIT, there is only one
+// cilent from BIT daemon.
+struct Subscriber {
+ const uint32_t ID;
+ const AgpsStateMachine* mStateMachine;
+ inline Subscriber(const int id,
+ const AgpsStateMachine* stateMachine) :
+ ID(id), mStateMachine(stateMachine) {}
+ inline virtual ~Subscriber() {}
+
+ virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ virtual void setIPAddresses(struct sockaddr_storage& addr) = 0;
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ { ssid[0] = 0; password[0] = 0; }
+
+ inline virtual bool equals(const Subscriber *s) const
+ { return ID == s->ID; }
+
+ // notifies a subscriber a new NIF resource status, usually
+ // either GRANTE, DENIED, or RELEASED
+ virtual bool notifyRsrcStatus(Notification ¬ification) = 0;
+
+ virtual bool waitForCloseComplete() { return false; }
+ virtual void setInactive() {}
+ virtual bool isInactive() { return false; }
+
+ virtual Subscriber* clone() = 0;
+ // checks if this notification is for me, i.e.
+ // either has my id, or has a broadcast id.
+ bool forMe(Notification ¬ification);
+};
+
+// BITSubscriber, created with requests from BIT daemon
+struct BITSubscriber : public Subscriber {
+ char mIPv6Addr[16];
+
+ inline BITSubscriber(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ Subscriber(ipv4, stateMachine)
+ {
+ if (NULL == ipv6) {
+ mIPv6Addr[0] = 0;
+ } else {
+ memcpy(mIPv6Addr, ipv6, sizeof(mIPv6Addr));
+ }
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ }
+
+ virtual Subscriber* clone()
+ {
+ return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
+ }
+
+ virtual bool equals(const Subscriber *s) const;
+ inline virtual ~BITSubscriber(){}
+};
+
+// ATLSubscriber, created with requests from ATL
+struct ATLSubscriber : public Subscriber {
+ const LocEngAdapter* mLocAdapter;
+ const bool mBackwardCompatibleMode;
+ inline ATLSubscriber(const int id,
+ const AgpsStateMachine* stateMachine,
+ const LocEngAdapter* adapter,
+ const bool compatibleMode) :
+ Subscriber(id, stateMachine), mLocAdapter(adapter),
+ mBackwardCompatibleMode(compatibleMode){}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = INADDR_NONE; v6[0] = 0; }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { memset(&addr, 0, sizeof(addr));
+ addr.ss_family = AF_INET6; }
+
+ inline virtual Subscriber* clone()
+ {
+ return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
+ mBackwardCompatibleMode);
+ }
+ inline virtual ~ATLSubscriber(){}
+};
+
+// WIFISubscriber, created with requests from MSAPM or QuIPC
+struct WIFISubscriber : public Subscriber {
+ char * mSSID;
+ char * mPassword;
+ loc_if_req_sender_id_e_type senderId;
+ bool mIsInactive;
+ inline WIFISubscriber(const AgpsStateMachine* stateMachine,
+ char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
+ Subscriber(sender_id, stateMachine),
+ mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
+ senderId(sender_id)
+ {
+ if (NULL != mSSID)
+ strlcpy(mSSID, ssid, SSID_BUF_SIZE);
+ if (NULL != mPassword)
+ strlcpy(mPassword, password, SSID_BUF_SIZE);
+ mIsInactive = false;
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ {
+ if (NULL != mSSID)
+ strlcpy(ssid, mSSID, SSID_BUF_SIZE);
+ else
+ ssid[0] = '\0';
+ if (NULL != mPassword)
+ strlcpy(password, mPassword, SSID_BUF_SIZE);
+ else
+ password[0] = '\0';
+ }
+
+ inline virtual bool waitForCloseComplete() { return true; }
+
+ inline virtual void setInactive() { mIsInactive = true; }
+ inline virtual bool isInactive() { return mIsInactive; }
+
+ virtual Subscriber* clone()
+ {
+ return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
+ }
+ inline virtual ~WIFISubscriber(){}
+};
+
+struct DSSubscriber : public Subscriber {
+ bool mIsInactive;
+ inline DSSubscriber(const AgpsStateMachine *stateMachine,
+ const int id) :
+ Subscriber(id, stateMachine)
+ {
+ mIsInactive = false;
+ }
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+ virtual Subscriber* clone()
+ {return new DSSubscriber(mStateMachine, ID);}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+ inline virtual bool waitForCloseComplete() { return true; }
+ virtual void setInactive();
+ inline virtual bool isInactive()
+ { return mIsInactive; }
+ inline virtual ~DSSubscriber(){}
+ inline virtual char *whoami() {return (char*)"DSSubscriber";}
+};
+
+#endif //__LOC_ENG_AGPS_H__
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
new file mode 100644
index 0000000..c257dff
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2011-2012, 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 <linux/stat.h>
+#include <fcntl.h>
+#include <linux/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <grp.h>
+#include <sys/stat.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_msg.h"
+
+static int loc_api_server_msgqid;
+static int loc_api_resp_msgqid;
+static int quipc_msgqid;
+static int msapm_msgqid;
+static int msapu_msgqid;
+
+static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
+static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
+static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
+static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
+static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
+
+static int loc_api_server_proc_init(void *context)
+{
+ loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
+ //change mode/group for the global_loc_api_q_path pipe
+ int result = chmod (global_loc_api_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
+ }
+
+ struct group * gps_group = getgrnam("gps");
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_q_path, gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+ else
+ {
+ LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
+ }
+
+ loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
+
+ //change mode/group for the global_loc_api_resp_q_path pipe
+ result = chmod (global_loc_api_resp_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
+ }
+
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_resp_q_path,
+ gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+
+ quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
+ msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
+ msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
+
+ LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
+ return 0;
+}
+
+static int loc_api_server_proc_pre(void *context)
+{
+ return 0;
+}
+
+static int loc_api_server_proc(void *context)
+{
+ int length, sz;
+ int result = 0;
+ static int cnt = 0;
+ struct ctrl_msgbuf * p_cmsgbuf;
+ struct ctrl_msgbuf cmsg_resp;
+
+ sz = sizeof(struct ctrl_msgbuf) + 256;
+ p_cmsgbuf = (struct ctrl_msgbuf *) malloc(sz);
+
+ if (!p_cmsgbuf) {
+ LOC_LOGE("%s:%d] Out of memory\n", __func__, __LINE__);
+ return -1;
+ }
+
+ cnt ++;
+ LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
+ length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
+ if (length <= 0) {
+ free(p_cmsgbuf);
+ LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
+ usleep(1000);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ switch(p_cmsgbuf->ctrl_type) {
+ case GPSONE_LOC_API_IF_REQUEST:
+ result = loc_eng_dmn_conn_loc_api_server_if_request_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_LOC_API_IF_RELEASE:
+ result = loc_eng_dmn_conn_loc_api_server_if_release_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_UNBLOCK:
+ LOC_LOGD("%s:%d] GPSONE_UNBLOCK\n", __func__, __LINE__);
+ break;
+
+ default:
+ LOC_LOGE("%s:%d] unsupported ctrl_type = %d\n",
+ __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ break;
+ }
+
+ free(p_cmsgbuf);
+ return 0;
+}
+
+static int loc_api_server_proc_post(void *context)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
+ return 0;
+}
+
+static int loc_eng_dmn_conn_unblock_proc(void)
+{
+ struct ctrl_msgbuf cmsgbuf;
+ cmsgbuf.ctrl_type = GPSONE_UNBLOCK;
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgsnd(loc_api_server_msgqid, & cmsgbuf, sizeof(cmsgbuf));
+ return 0;
+}
+
+static struct loc_eng_dmn_conn_thelper thelper;
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * resp_q_path, void *agps_handle)
+{
+ int result;
+
+ loc_api_handle = agps_handle;
+
+ if (loc_api_q_path) global_loc_api_q_path = loc_api_q_path;
+ if (resp_q_path) global_loc_api_resp_q_path = resp_q_path;
+
+ result = loc_eng_dmn_conn_launch_thelper( &thelper,
+ loc_api_server_proc_init,
+ loc_api_server_proc_pre,
+ loc_api_server_proc,
+ loc_api_server_proc_post,
+ create_thread_cb,
+ (char *) global_loc_api_q_path);
+ if (result != 0) {
+ LOC_LOGE("%s:%d]\n", __func__, __LINE__);
+ return -1;
+ }
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_unblock(void)
+{
+ loc_eng_dmn_conn_unblock_thelper(&thelper);
+ loc_eng_dmn_conn_unblock_proc();
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_join(void)
+{
+ loc_eng_dmn_conn_join_thelper(&thelper);
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
+ struct ctrl_msgbuf cmsgbuf;
+ LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
+ cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
+ cmsgbuf.cmsg.cmsg_response.result = status;
+ switch (sender_id) {
+ case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapu_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ default: {
+ LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
+ }
+ }
+ return 0;
+}
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
new file mode 100644
index 0000000..1d8c142
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
@@ -0,0 +1,59 @@
+/* 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_ENG_DATA_SERVER_H
+#define LOC_ENG_DATA_SERVER_H
+
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+#ifdef _ANDROID_
+
+#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q"
+
+#else
+
+#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
+
+#endif
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
+int loc_eng_dmn_conn_loc_api_server_unblock(void);
+int loc_eng_dmn_conn_loc_api_server_join(void);
+int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
+
+#endif /* LOC_ENG_DATA_SERVER_H */
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
new file mode 100644
index 0000000..a1076ff
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -0,0 +1,223 @@
+/* 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.
+ *
+ */
+#include <linux/stat.h>
+#include <fcntl.h>
+
+#include <linux/types.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgget
+
+DESCRIPTION
+ This function get a message queue
+
+ q_path - name path of the message queue
+ mode -
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ message queue id
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode)
+{
+ int msgqid;
+ msgqid = loc_eng_dmn_conn_glue_pipeget(q_path, mode);
+ return msgqid;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgremove
+
+DESCRIPTION
+ remove a message queue
+
+ q_path - name path of the message queue
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid)
+{
+ int result;
+ result = loc_eng_dmn_conn_glue_piperemove(q_path, msgqid);
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgsnd
+
+DESCRIPTION
+ Send a message
+
+ msgqid - message queue id
+ msgp - pointer to the message to be sent
+ msgsz - size of the message
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes sent out or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+ pmsg->msgsz = msgsz;
+
+ result = loc_eng_dmn_conn_glue_pipewrite(msgqid, msgp, msgsz);
+ if (result != (int) msgsz) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) msgsz);
+ return -1;
+ }
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgrcv
+
+DESCRIPTION
+ receive a message
+
+ msgqid - message queue id
+ msgp - pointer to the buffer to hold the message
+ msgsz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes received or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgbufsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, &(pmsg->msgsz), sizeof(pmsg->msgsz));
+ if (result != sizeof(pmsg->msgsz)) {
+ LOC_LOGE("%s:%d] pipe broken %d\n", __func__, __LINE__, result);
+ return -1;
+ }
+
+ if (msgbufsz < pmsg->msgsz) {
+ LOC_LOGE("%s:%d] msgbuf is too small %d < %d\n", __func__, __LINE__, (int) msgbufsz, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, (uint8_t *) msgp + sizeof(pmsg->msgsz), pmsg->msgsz - sizeof(pmsg->msgsz));
+ if (result != (int) (pmsg->msgsz - sizeof(pmsg->msgsz))) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ return pmsg->msgsz;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgunblock
+
+DESCRIPTION
+ unblock a message queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid)
+{
+ return loc_eng_dmn_conn_glue_pipeunblock(msgqid);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgflush
+
+DESCRIPTION
+ flush out the message in a queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes that are flushed out.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgflush(int msgqid)
+{
+ int length;
+ char buf[128];
+
+ do {
+ length = loc_eng_dmn_conn_glue_piperead(msgqid, buf, 128);
+ LOC_LOGD("%s:%d] %s\n", __func__, __LINE__, buf);
+ } while(length);
+ return length;
+}
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
new file mode 100644
index 0000000..d685c87
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
@@ -0,0 +1,51 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_MSG_H
+#define LOC_ENG_DMN_CONN_GLUE_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#include <linux/types.h>
+#include "loc_eng_dmn_conn_glue_pipe.h"
+
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode);
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid);
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgflush(int msgqid);
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
new file mode 100644
index 0000000..dffcad0
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -0,0 +1,214 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+// #include <linux/stat.h>
+#include <fcntl.h>
+// #include <linux/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "loc_eng_dmn_conn_glue_pipe.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeget
+
+DESCRIPTION
+ create a named pipe.
+
+ pipe_name - pipe name path
+ mode - mode
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
+{
+ int fd;
+ int result;
+
+ LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
+ result = mkfifo(pipe_name, 0660);
+
+ if ((result == -1) && (errno != EEXIST)) {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ return result;
+ }
+
+ // The mode in mkfifo is not honoured and does not provide the
+ // group permissions. Doing chmod to add group permissions.
+ result = chmod (pipe_name, 0660);
+ if (result != 0){
+ LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
+ pipe_name, strerror(errno));
+ }
+
+ fd = open(pipe_name, mode);
+ if (fd <= 0)
+ {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ }
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return fd;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperemove
+
+DESCRIPTION
+ remove a pipe
+
+ pipe_name - pipe name path
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd)
+{
+ close(fd);
+ if (pipe_name) unlink(pipe_name);
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipewrite
+
+DESCRIPTION
+ write to a pipe
+
+ fd - fd of a pipe
+ buf - buffer for the data to write
+ sz - size of the data in buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes written or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz)
+{
+ int result;
+
+ result = write(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, result = %d\n", fd, (long) buf, (int) sz, (int) result); */
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperead
+
+DESCRIPTION
+ read from a pipe
+
+ fd - fd for the pipe
+ buf - buffer to hold the data read from pipe
+ sz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes read from pipe or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz)
+{
+ int len;
+
+ len = read(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, len = %d\n", fd, (long) buf, (int) sz, len); */
+ return len;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeunblock
+
+DESCRIPTION
+ unblock a pipe
+
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 for success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeunblock(int fd)
+{
+ int result;
+ struct flock flock_v;
+ LOC_LOGD("\n");
+// result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY);
+ flock_v.l_type = F_UNLCK;
+ flock_v.l_len = 32;
+ result = fcntl(fd, F_SETLK, &flock_v);
+ if (result < 0) {
+ LOC_LOGE("fcntl failure, %s\n", strerror(errno));
+ }
+
+ return result;
+}
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
new file mode 100644
index 0000000..b2fa3a0
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
@@ -0,0 +1,50 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_PIPE_H
+#define LOC_ENG_DMN_CONN_GLUE_PIPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <linux/types.h>
+
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode);
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd);
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz);
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz);
+
+int loc_eng_dmn_conn_glue_pipeflush(int fd);
+int loc_eng_dmn_conn_glue_pipeunblock(int fd);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
new file mode 100644
index 0000000..edd53f2
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-2012, 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 <string.h>
+#include <unistd.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_msg.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+void* loc_api_handle = NULL;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ if (NULL == loc_api_handle) {
+ LOC_LOGE("%s:%d] NO agps data handle\n", __func__, __LINE__);
+ return 1;
+ }
+
+ if (NULL != loc_api_handle) {
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ true);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+ }
+
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+#endif
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ false);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+#endif
+ return 0;
+}
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
new file mode 100644
index 0000000..1c0edd5
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_HANDLER
+#define LOC_ENG_DATA_SERVER_HANDLER
+
+#include <linux/types.h>
+#include <arpa/inet.h>
+
+//for SSID_BUF_SIZE
+#include <hardware/gps.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+
+enum {
+ /* 0x0 - 0xEF is reserved for daemon internal */
+ GPSONE_LOC_API_IF_REQUEST = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE,
+ GPSONE_LOC_API_RESPONSE,
+ GPSONE_UNBLOCK,
+};
+
+enum {
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS,
+ GPSONE_LOC_API_IF_FAILURE,
+};
+
+
+struct ctrl_msg_response {
+ int result;
+};
+
+struct ctrl_msg_unblock {
+ int reserved;
+};
+
+typedef enum {
+ IF_REQUEST_TYPE_SUPL = 0,
+ IF_REQUEST_TYPE_WIFI,
+ IF_REQUEST_TYPE_ANY
+} ctrl_if_req_type_e_type;
+
+typedef enum {
+ IF_REQUEST_SENDER_ID_QUIPC = 0,
+ IF_REQUEST_SENDER_ID_MSAPM,
+ IF_REQUEST_SENDER_ID_MSAPU,
+ IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ IF_REQUEST_SENDER_ID_MODEM
+} ctrl_if_req_sender_id_e_type;
+
+struct ctrl_msg_if_request {
+ ctrl_if_req_type_e_type type;
+ ctrl_if_req_sender_id_e_type sender_id;
+ unsigned long ipv4_addr;
+ unsigned char ipv6_addr[16];
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+};
+
+/* do not change this structure */
+struct ctrl_msgbuf {
+ size_t msgsz;
+ uint16_t reserved1;
+ uint32_t reserved2;
+ uint8_t ctrl_type;
+ union {
+ struct ctrl_msg_response cmsg_response;
+ struct ctrl_msg_unblock cmsg_unblock;
+ struct ctrl_msg_if_request cmsg_if_request;
+ } cmsg;
+};
+
+extern void* loc_api_handle;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
+
+#endif /* LOC_ENG_DATA_SERVER_HANDLER */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
new file mode 100644
index 0000000..9fed9d4
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -0,0 +1,399 @@
+/* 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.
+ *
+ */
+#include <stdio.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+/*===========================================================================
+FUNCTION thelper_signal_init
+
+DESCRIPTION
+ This function will initialize the conditional variable resources.
+
+ thelper - thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+ thelper->thread_exit = 0;
+ thelper->thread_ready = 0;
+ result = pthread_cond_init( &thelper->thread_cond, NULL);
+ if (result) {
+ return result;
+ }
+
+ result = pthread_mutex_init(&thelper->thread_mutex, NULL);
+ if (result) {
+ pthread_cond_destroy(&thelper->thread_cond);
+ }
+ return result;
+}
+
+/*===========================================================================
+FUNCTION
+
+DESCRIPTION
+ This function will destroy the conditional variable resources
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result, ret_result = 0;
+ result = pthread_cond_destroy( &thelper->thread_cond);
+ if (result) {
+ ret_result = result;
+ }
+
+ result = pthread_mutex_destroy(&thelper->thread_mutex);
+ if (result) {
+ ret_result = result;
+ }
+
+ return ret_result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_wait
+
+DESCRIPTION
+ This function will be blocked on the conditional variable until thelper_signal_ready
+ is called
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = 0;
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ if (!thelper->thread_ready && !thelper->thread_exit) {
+ result = pthread_cond_wait(&thelper->thread_cond, &thelper->thread_mutex);
+ }
+
+ if (thelper->thread_exit) {
+ result = -1;
+ }
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_ready
+
+DESCRIPTION
+ This function will wake up the conditional variable
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 1;
+ result = pthread_cond_signal(&thelper->thread_cond);
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_block
+
+DESCRIPTION
+ This function will set the thread ready to 0 to block the thelper_signal_wait
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ if thread_ready is set
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = thelper->thread_ready;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 0;
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_main
+
+DESCRIPTION
+ This function is the main thread. It will be launched as a child thread
+
+ data - pointer to the instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ NULL
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void * thelper_main(void *data)
+{
+ int result = 0;
+ struct loc_eng_dmn_conn_thelper * thelper = (struct loc_eng_dmn_conn_thelper *) data;
+
+ if (thelper->thread_proc_init) {
+ result = thelper->thread_proc_init(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ thelper_signal_ready(thelper);
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ thelper_signal_ready(thelper);
+
+ if (thelper->thread_proc_pre) {
+ result = thelper->thread_proc_pre(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ do {
+ if (thelper->thread_proc) {
+ result = thelper->thread_proc(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ }
+ } while (thelper->thread_exit == 0);
+
+ if (thelper->thread_proc_post) {
+ result = thelper->thread_proc_post(thelper->thread_context);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ return NULL;
+}
+
+static void thelper_main_2(void *data)
+{
+ thelper_main(data);
+ return;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_launch_thelper
+
+DESCRIPTION
+ This function will initialize the thread context and launch the thelper_main
+
+ thelper - pointer to thelper instance
+ thread_proc_init - The initialization function pointer
+ thread_proc_pre - The function to call before task loop and after initialization
+ thread_proc - The task loop
+ thread_proc_post - The function to call after the task loop
+ context - the context for the above four functions
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context)
+{
+ int result;
+
+ thelper_signal_init(thelper);
+
+ if (context) {
+ thelper->thread_context = context;
+ }
+
+ thelper->thread_proc_init = thread_proc_init;
+ thelper->thread_proc_pre = thread_proc_pre;
+ thelper->thread_proc = thread_proc;
+ thelper->thread_proc_post = thread_proc_post;
+
+ LOC_LOGD("%s:%d] 0x%lx call pthread_create\n", __func__, __LINE__, (long) thelper);
+ if (create_thread_cb) {
+ result = 0;
+ thelper->thread_id = create_thread_cb("loc_eng_dmn_conn",
+ thelper_main_2, (void *)thelper);
+ } else {
+ result = pthread_create(&thelper->thread_id, NULL,
+ thelper_main, (void *)thelper);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] 0x%lx pthread_create done\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_wait(thelper);
+
+ LOC_LOGD("%s:%d] 0x%lx pthread ready\n", __func__, __LINE__, (long) thelper);
+ return thelper->thread_exit;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_unblock_thelper
+
+DESCRIPTION
+ This function unblocks thelper_main to release the thread
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ thelper->thread_exit = 1;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_join_thelper
+
+ thelper - pointer to thelper instance
+
+DESCRIPTION
+ This function will wait for the thread of thelper_main to finish
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ result = pthread_join(thelper->thread_id, NULL);
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_destroy(thelper);
+
+ return result;
+}
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
new file mode 100644
index 0000000..89e598b
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+#define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+
+struct loc_eng_dmn_conn_thelper {
+ unsigned char thread_exit;
+ unsigned char thread_ready;
+ pthread_cond_t thread_cond;
+ pthread_mutex_t thread_mutex;
+ pthread_t thread_id;
+ void * thread_context;
+ int (*thread_proc_init) (void * context);
+ int (*thread_proc_pre) (void * context);
+ int (*thread_proc) (void * context);
+ int (*thread_proc_post) (void * context);
+};
+
+typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg);
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context);
+
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+
+/* if only need to use signal */
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_log.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_log.cpp
new file mode 100644
index 0000000..3a34167
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_log.cpp
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include "loc_log.h"
+#include "loc_eng_log.h"
+
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_log.h b/msm8084/loc_api/libloc_api_50001/loc_eng_log.h
new file mode 100644
index 0000000..a68bd84
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_log.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_msg.h b/msm8084/loc_api/libloc_api_50001/loc_eng_msg.h
new file mode 100644
index 0000000..e3c48fb
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -0,0 +1,313 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_ENG_MSG_H
+#define LOC_ENG_MSG_H
+
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <stdlib.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_eng_log.h>
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include <LocEngAdapter.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+#ifdef USE_GLIB
+
+#include <glib.h>
+
+#endif /* USE_GLIB */
+#include "platform_lib_includes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+using namespace loc_core;
+
+struct LocEngPositionMode : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const LocPosMode mPosMode;
+ LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
+ virtual void proc() const;
+ virtual void log() const;
+ void send() const;
+};
+
+
+struct LocEngStartFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStartFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngStopFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStopFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportPosition : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const UlpLocation mLocation;
+ const GpsLocationExtended mLocationExtended;
+ const void* mLocationExt;
+ const enum loc_sess_status mStatus;
+ const LocPosTechMask mTechMask;
+ LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportSv : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsSvStatus mSvStatus;
+ const GpsLocationExtended mLocationExtended;
+ const void* mSvExt;
+ LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExtended);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportStatus : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsStatusValue mStatus;
+ LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportNmea : public LocMsg {
+ void* mLocEng;
+ char* const mNmea;
+ const int mLen;
+ LocEngReportNmea(void* locEng,
+ const char* data, int len);
+ inline virtual ~LocEngReportNmea()
+ {
+ delete[] mNmea;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportXtraServer : public LocMsg {
+ void* mLocEng;
+ int mMaxLen;
+ char *mServers;
+ LocEngReportXtraServer(void* locEng,
+ const char *url1, const char *url2,
+ const char *url3, const int maxlength);
+ inline virtual ~LocEngReportXtraServer()
+ {
+ delete[] mServers;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsOpened : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsOpened(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsClosed : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsClosed(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestSuplEs : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngRequestSuplEs(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ const AGpsExtType mType;
+ LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReleaseATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngReleaseATL(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReqRelBIT : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const int mIPv4Addr;
+ char* const mIPv6Addr;
+ const bool mIsReq;
+ LocEngReqRelBIT(void* instance, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq);
+ virtual ~LocEngReqRelBIT();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReqRelWifi : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const loc_if_req_sender_id_e_type mSenderId;
+ char* const mSSID;
+ char* const mPassword;
+ const bool mIsReq;
+ LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq);
+ virtual ~LocEngReqRelWifi();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngRequestXtra : public LocMsg {
+ void* mLocEng;
+ LocEngRequestXtra(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestTime : public LocMsg {
+ void* mLocEng;
+ LocEngRequestTime(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestNi : public LocMsg {
+ void* mLocEng;
+ const GpsNiNotification mNotify;
+ const void *mPayload;
+ LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngDown : public LocMsg {
+ void* mLocEng;
+ LocEngDown(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngUp : public LocMsg {
+ void* mLocEng;
+ LocEngUp(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngGetZpp : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngGetZpp(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportGpsMeasurement : public LocMsg {
+ void* mLocEng;
+ const GpsData mGpsData;
+ LocEngReportGpsMeasurement(void* locEng,
+ GpsData &gpsData);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngShutdown : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngShutdown(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_MSG_H */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_ni.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_ni.cpp
new file mode 100644
index 0000000..4597b98
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -0,0 +1,414 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <MsgTask.h>
+
+#include <loc_eng.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+static void* ni_thread_proc(void *args);
+
+struct LocEngInformNiResponse : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUserResponseType mResponse;
+ const void *mPayload;
+ inline LocEngInformNiResponse(LocEngAdapter* adapter,
+ GpsUserResponseType resp,
+ const void* data) :
+ LocMsg(), mAdapter(adapter),
+ mResponse(resp), mPayload(data)
+ {
+ locallog();
+ }
+ inline ~LocEngInformNiResponse()
+ {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const
+ {
+ mAdapter->informNiResponse(mResponse, mPayload);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInformNiResponse - "
+ "response: %s\n mPayload: %p",
+ loc_get_ni_response_name(mResponse),
+ mPayload);
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough)
+{
+ ENTRY_LOG();
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) {
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ }
+ } else {
+ if (NULL != loc_eng_ni_data_p->session.rawRequest ||
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+ }
+
+
+ if (pSession) {
+ /* Save request */
+ pSession->rawRequest = (void*)passThrough;
+ pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter;
+ pSession->adapter = loc_eng_data.adapter;
+
+ /* Fill in notification */
+ ((GpsNiNotification*)notif)->notification_id = pSession->reqID;
+
+ if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session(loc_eng_data);
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif->ni_type, notif->timeout, notif->default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif->requestor_id, notif->requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif->text, notif->text_encoding);
+ if (notif->extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif->extras);
+ }
+
+ /* 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 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft);
+
+ int rc = 0;
+ rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(pSession->thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+
+ CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
+ loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION ni_thread_proc
+
+===========================================================================*/
+static void* ni_thread_proc(void *args)
+{
+ ENTRY_LOG();
+
+ loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n",
+ (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 = GPS_NI_RESPONSE_NORESP;
+ LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/
+
+ LOC_LOGD("pSession->resp is %d\n",pSession->resp);
+
+ // 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()
+ LocEngAdapter* adapter = pSession->adapter;
+ LocEngInformNiResponse *msg = NULL;
+
+ if (NULL != pSession->rawRequest) {
+ if (pSession->resp != GPS_NI_RESPONSE_IGNORE) {
+ LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n");
+ msg = new LocEngInformNiResponse(adapter,
+ pSession->resp,
+ pSession->rawRequest);
+ } else {
+ LOC_LOGD("this is the ignore reply for SUPL ES\n");
+ free(pSession->rawRequest);
+ }
+ pSession->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&pSession->tLock);
+
+ pSession->respTimeLeft = 0;
+ pSession->reqID = 0;
+
+ if (NULL != msg) {
+ LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n");
+ adapter->sendMsg(msg);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+ return NULL;
+}
+
+void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ // only if modem has requested but then died.
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ free(loc_eng_ni_data_p->sessionEs.rawRequest);
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->sessionEs.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock);
+ }
+
+ if (NULL != loc_eng_ni_data_p->session.rawRequest) {
+ free(loc_eng_ni_data_p->session.rawRequest);
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if(callbacks == NULL)
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
+ else if (NULL == callbacks->notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
+ } else if (NULL != loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
+ } else {
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_data_p->sessionEs.respTimeLeft = 0;
+ loc_eng_ni_data_p->sessionEs.respRecvd = FALSE;
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+ loc_eng_ni_data_p->sessionEs.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL);
+
+ loc_eng_ni_data_p->session.respTimeLeft = 0;
+ loc_eng_ni_data_p->session.respRecvd = FALSE;
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+ loc_eng_ni_data_p->session.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL);
+
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ EXIT_LOG(%s, VOID_RET);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function receives user response from upper layer framework
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG_CALLFLOW();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif_id == loc_eng_ni_data_p->sessionEs.reqID &&
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (user_response == GPS_NI_RESPONSE_ACCEPT &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE;
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+ } else if (notif_id == loc_eng_ni_data_p->session.reqID &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+
+ if (pSession) {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ pthread_mutex_lock(&pSession->tLock);
+ pSession->resp = user_response;
+ pSession->respRecvd = TRUE;
+ pthread_cond_signal(&pSession->tCond);
+ pthread_mutex_unlock(&pSession->tLock);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_ni.h b/msm8084/loc_api/libloc_api_50001/loc_eng_ni.h
new file mode 100644
index 0000000..068f5cd
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_ni.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009,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 LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <stdbool.h>
+#include <LocEngAdapter.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+#define GPS_NI_RESPONSE_IGNORE 4
+
+typedef struct {
+ pthread_t thread; /* NI thread */
+ int respTimeLeft; /* examine time for NI response */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ int reqID; /* ID to check against response */
+ GpsUserResponseType resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+ LocEngAdapter* adapter;
+} loc_eng_ni_session_s_type;
+
+typedef struct {
+ loc_eng_ni_session_s_type session; /* SUPL NI Session */
+ loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */
+ int reqIDCounter;
+} loc_eng_ni_data_s_type;
+
+
+#endif /* LOC_ENG_NI_H */
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_nmea.cpp
new file mode 100644
index 0000000..978f7a9
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -0,0 +1,832 @@
+/* Copyright (c) 2012, 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng_nmea"
+#define GPS_PRN_START 1
+#define GPS_PRN_END 32
+#define GLONASS_PRN_START 65
+#define GLONASS_PRN_END 96
+#include <loc_eng.h>
+#include <loc_eng_nmea.h>
+#include <math.h>
+#include "log_util.h"
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_send
+
+DESCRIPTION
+ send out NMEA sentence
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
+{
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ if (loc_eng_data_p->nmea_cb != NULL)
+ loc_eng_data_p->nmea_cb(now, pNmea, length);
+ LOC_LOGD("NMEA <%s", pNmea);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_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
+
+===========================================================================*/
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 0;
+
+ pNmea++; //skip the $
+ while (*pNmea != '\0')
+ {
+ checksum ^= *pNmea++;
+ length++;
+ }
+
+ int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
+ return (length + checksumLength);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ unsigned char generate_nmea)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ 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;
+
+ if (generate_nmea) {
+ // ------------------
+ // ------$GPGSA------
+ // ------------------
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+ uint32_t mask = loc_eng_data_p->sv_used_mask;
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i;
+ mask = mask >> 1;
+ }
+ // clear the cache so they can't be used again
+ loc_eng_data_p->sv_used_mask = 0;
+
+ char fixType;
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ {
+ 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;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPVTG------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & 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, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPRMC------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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 & 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 & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPGGA------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ gpsQuality = '1'; // 1 means GPS fix
+ else
+ gpsQuality = '2'; // 2 means DGPS fix
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, loc_eng_data_p->hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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 & GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ // clear the dop cache so they can't be used again
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
+ const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int svCount = svStatus.num_svs;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+ int gpsCount = 0;
+ int glnCount = 0;
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+
+ for(svNumber=1; svNumber <= svCount; svNumber++) {
+ if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&&
+ (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+ {
+ gpsCount++;
+ }
+ else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )
+ {
+ glnCount++;
+ }
+ }
+
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ if (gpsCount <= 0)
+ {
+ // no svs in view, so just send a blank $GPGSV sentence
+ strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = gpsCount/4 + (gpsCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, gpsCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ } //if
+
+ // ------------------
+ // ------$GLGSV------
+ // ------------------
+
+ if (glnCount <= 0)
+ {
+ // no svs in view, so just send a blank $GLGSV sentence
+ strlcpy(sentence, "$GLGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = glnCount/4 + (glnCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GLGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, glnCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) {
+
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ }//if
+
+ if (svStatus.used_in_fix_mask == 0)
+ { // No sv used, so there will be no position report, so send
+ // blank NMEA sentences
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ { // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask;
+
+ // For RPC, the DOP are sent during sv report, so cache them
+ // now to be sent during position report.
+ // For QMI, the DOP will be in position report.
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ loc_eng_data_p->pdop = locationExtended.pdop;
+ loc_eng_data_p->hdop = locationExtended.hdop;
+ loc_eng_data_p->vdop = locationExtended.vdop;
+ }
+ else
+ {
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+ }
+
+ }
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_nmea.h b/msm8084/loc_api/libloc_api_50001/loc_eng_nmea.h
new file mode 100644
index 0000000..40c6dbb
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2012, 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 <hardware/gps.h>
+
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
+
+#endif // LOC_ENG_NMEA_H
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/msm8084/loc_api/libloc_api_50001/loc_eng_xtra.cpp
new file mode 100644
index 0000000..4582286
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -0,0 +1,167 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+struct LocEngRequestXtraServer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngRequestXtraServer(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->requestXtraServer();
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngRequestXtraServer");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInjectXtraData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ char* mData;
+ const int mLen;
+ inline LocEngInjectXtraData(LocEngAdapter* adapter,
+ char* data, int len):
+ LocMsg(), mAdapter(adapter),
+ mData(new char[len]), mLen(len)
+ {
+ memcpy((void*)mData, (void*)data, len);
+ locallog();
+ }
+ inline ~LocEngInjectXtraData()
+ {
+ delete[] mData;
+ }
+ inline virtual void proc() const {
+ mAdapter->setXtraData(mData, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("length: %d\n data: %p", mLen, mData);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks)
+{
+ int ret_val = -1;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
+ } else {
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr->report_xtra_server_cb = callbacks->report_xtra_server_cb;
+
+ ret_val = 0;
+ }
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_inject_data
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+ >0: failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length)
+{
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length));
+
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_request_server
+
+DESCRIPTION
+ Request the Xtra server url from the modem
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ length of server string
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data)
+{
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngRequestXtraServer(adapter));
+
+ return 0;
+
+}
diff --git a/msm8084/loc_api/libloc_api_50001/loc_eng_xtra.h b/msm8084/loc_api/libloc_api_50001/loc_eng_xtra.h
new file mode 100644
index 0000000..175f497
--- /dev/null
+++ b/msm8084/loc_api/libloc_api_50001/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2009,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 LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ report_xtra_server report_xtra_server_cb;
+
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H
diff --git a/msm8084/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/msm8084/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/msm8084/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/msm8084/platform_lib_abstractions/platform_lib_includes.h b/msm8084/platform_lib_abstractions/platform_lib_includes.h
new file mode 100644
index 0000000..5858674
--- /dev/null
+++ b/msm8084/platform_lib_abstractions/platform_lib_includes.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_INCLUDES_H_
+#define _PLATFORM_LIB_INCLUDES_H_
+
+#include "platform_lib_time.h"
+#include "platform_lib_macros.h"
+
+#endif
diff --git a/msm8084/platform_lib_abstractions/platform_lib_macros.h b/msm8084/platform_lib_abstractions/platform_lib_macros.h
new file mode 100644
index 0000000..bc48dd9
--- /dev/null
+++ b/msm8084/platform_lib_abstractions/platform_lib_macros.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#include <sys/time.h>
+
+#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); \
+}
+
+
+#ifdef USE_GLIB
+
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+
+#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)
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
+
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
+
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+pid_t gettid(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
+
+#endif
+
+#endif
diff --git a/msm8084/platform_lib_abstractions/platform_lib_time.h b/msm8084/platform_lib_abstractions/platform_lib_time.h
new file mode 100644
index 0000000..ce013af
--- /dev/null
+++ b/msm8084/platform_lib_abstractions/platform_lib_time.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_TIME_H_
+#define _PLATFORM_LIB_TIME_H_
+
+int64_t systemTime(int clock);
+int64_t elapsedMillisSinceBoot();
+
+#endif
diff --git a/msm8084/utils/Android.mk b/msm8084/utils/Android.mk
new file mode 100644
index 0000000..f34e101
--- /dev/null
+++ b/msm8084/utils/Android.mk
@@ -0,0 +1,61 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ loc_timer.c \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ loc_misc_utils.cpp
+
+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_C_INCLUDES:= \
+ $(LOCAL_PATH)/../platform_lib_abstractions
+
+LOCAL_COPY_HEADERS_TO:= gps.utils/
+LOCAL_COPY_HEADERS:= \
+ loc_log.h \
+ loc_cfg.h \
+ log_util.h \
+ linked_list.h \
+ msg_q.h \
+ loc_target.h \
+ loc_timer.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h \
+ loc_misc_utils.h
+
+LOCAL_MODULE := libgps.utils
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8084/utils/Makefile.am b/msm8084/utils/Makefile.am
new file mode 100644
index 0000000..e5935f0
--- /dev/null
+++ b/msm8084/utils/Makefile.am
@@ -0,0 +1,44 @@
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I../platform_lib_abstractions
+
+libgps_utils_so_la_h_sources = log_util.h \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
+
+libgps_utils_so_la_c_sources = linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
+
+library_includedir = $(pkgincludedir)/utils
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lstdc++ -lcutils
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
diff --git a/msm8084/utils/linked_list.c b/msm8084/utils/linked_list.c
new file mode 100644
index 0000000..2ef8cbc
--- /dev/null
+++ b/msm8084/utils/linked_list.c
@@ -0,0 +1,328 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include <stdlib.h>
+#include <stdint.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*))
+{
+ LOC_LOGD("%s: Adding to list data_obj = 0x%p\n", __FUNCTION__, 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;
+ 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)
+{
+ LOC_LOGD("%s: Removing from list\n", __FUNCTION__);
+ 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)
+{
+ LOC_LOGD("%s: Search the list\n", __FUNCTION__);
+ 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/msm8084/utils/linked_list.h b/msm8084/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/msm8084/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/msm8084/utils/loc_cfg.cpp b/msm8084/utils/loc_cfg.cpp
new file mode 100644
index 0000000..104cdd7
--- /dev/null
+++ b/msm8084/utils/loc_cfg.cpp
@@ -0,0 +1,401 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 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 <loc_cfg.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint8_t DEBUG_LEVEL = 0xff;
+static uint8_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
+};
+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;
+
+/*===========================================================================
+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(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 + 1);
+ }
+ /* 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,
+ 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, "=", &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, 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,
+ 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, loc_param_s_type* config_table,
+ uint32_t table_length)
+{
+ FILE *conf_fp = NULL;
+ char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ 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);
+}
diff --git a/msm8084/utils/loc_cfg.h b/msm8084/utils/loc_cfg.h
new file mode 100644
index 0000000..bd25e86
--- /dev/null
+++ b/msm8084/utils/loc_cfg.h
@@ -0,0 +1,91 @@
+/* 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 LOC_CFG_H
+#define LOC_CFG_H
+
+#include <stdio.h>
+#include <stdint.h>
+
+#define LOC_MAX_PARAM_NAME 48
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE 80
+
+#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
+{
+ char param_name[LOC_MAX_PARAM_NAME];
+ void *param_ptr;
+ uint8_t *param_set; /* was this value set by config file? */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for float */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+void loc_read_conf(const char* conf_file_name,
+ loc_param_s_type* config_table,
+ uint32_t table_length);
+int loc_read_conf_r(FILE *conf_fp, loc_param_s_type* config_table,
+ uint32_t table_length);
+int loc_update_conf(const char* conf_data, int32_t length,
+ loc_param_s_type* config_table, uint32_t table_length);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/msm8084/utils/loc_log.cpp b/msm8084/utils/loc_log.cpp
new file mode 100644
index 0000000..f961631
--- /dev/null
+++ b/msm8084/utils/loc_log.cpp
@@ -0,0 +1,241 @@
+/* Copyright (c) 2011-2012, 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_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#ifdef USE_GLIB
+#include <time.h>
+#endif /* USE_GLIB */
+#include "log_util.h"
+#include "platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_msg_q_status_num = sizeof(loc_msg_q_status) / sizeof(loc_name_val_s_type);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+loc_name_val_s_type target_name[] =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_QCA1530),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ static char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index >= target_name_num || index < 0)
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ snprintf(ret, sizeof(ret), " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ snprintf(ret, sizeof(ret), " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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, unsigned long 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/msm8084/utils/loc_log.h b/msm8084/utils/loc_log.h
new file mode 100644
index 0000000..82dc636
--- /dev/null
+++ b/msm8084/utils/loc_log.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2011-2012, 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
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ char name[128];
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#define CHECK_MASK(type, value, mask_var, mask) \
+ ((mask_var & mask) ? (type) value : (type) (-1))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask);
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, unsigned long buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/msm8084/utils/loc_misc_utils.cpp b/msm8084/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..7e96313
--- /dev/null
+++ b/msm8084/utils/loc_misc_utils.cpp
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#include <ctype.h>
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+
+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;
+}
diff --git a/msm8084/utils/loc_misc_utils.h b/msm8084/utils/loc_misc_utils.h
new file mode 100644
index 0000000..7d66d84
--- /dev/null
+++ b/msm8084/utils/loc_misc_utils.h
@@ -0,0 +1,99 @@
+/* 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/msm8084/utils/loc_target.cpp b/msm8084/utils/loc_target.cpp
new file mode 100644
index 0000000..45bd04d
--- /dev/null
+++ b/msm8084/utils/loc_target.cpp
@@ -0,0 +1,241 @@
+/* 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.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <hardware/gps.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include "log_util.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 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
+/* When system server is started, it uses 20 seconds as ActivityManager
+ * timeout. After that it sends SIGSTOP signal to process.
+ */
+#define QCA1530_DETECT_TIMEOUT 15
+#define QCA1530_DETECT_PRESENT "yes"
+#define QCA1530_DETECT_PROGRESS "detect"
+
+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);
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+/*!
+ * \brief Checks if QCA1530 is avalable.
+ *
+ * Function verifies if qca1530 SoC is configured on the device. The test is
+ * based on property value. For 1530 scenario, the value shall be one of the
+ * following: "yes", "no", "detect". All other values are treated equally to
+ * "no". When the value is "detect" the system waits for SoC detection to
+ * finish before returning result.
+ *
+ * \retval true - QCA1530 is available.
+ * \retval false - QCA1530 is not available.
+ */
+static bool is_qca1530(void)
+{
+ static const char qca1530_property_name[] = "sys.qca1530";
+ bool res = false;
+ int ret, i;
+ char buf[PROPERTY_VALUE_MAX];
+
+ memset(buf, 0, sizeof(buf));
+
+ for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
+ {
+ ret = property_get(qca1530_property_name, buf, NULL);
+ if (ret < 0)
+ {
+ LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
+ qca1530_property_name,
+ ret);
+
+ break;
+ }
+
+ LOC_LOGV( "qca1530: property %s is set to %s",
+ qca1530_property_name,
+ buf);
+
+ if (!memcmp(buf, QCA1530_DETECT_PRESENT,
+ sizeof(QCA1530_DETECT_PRESENT)))
+ {
+ res = true;
+ break;
+ }
+ if (!memcmp(buf, QCA1530_DETECT_PROGRESS,
+ sizeof(QCA1530_DETECT_PROGRESS)))
+ {
+ LOC_LOGV("qca1530: SoC detection is in progress.");
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+
+ LOC_LOGD("qca1530: detected=%s", res ? "true" : "false");
+ return res;
+}
+
+/*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__);
+ }
+}
+
+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 id[] = "/sys/devices/soc0/soc_id";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
+ static const char mdm[] = "/dev/mdm"; // No such file or directory
+
+ char rd_hw_platform[LINE_LEN];
+ char rd_id[LINE_LEN];
+ char rd_mdm[LINE_LEN];
+ char baseband[LINE_LEN];
+
+ if (is_qca1530()) {
+ gTarget = TARGET_QCA1530;
+ goto detected;
+ }
+
+ 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);
+ }
+ if (!access(id, F_OK)) {
+ read_a_line(id, rd_id, LINE_LEN);
+ } else {
+ read_a_line(id_dep, rd_id, LINE_LEN);
+ }
+
+ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
+ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
+ && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
+ gTarget = TARGET_MPQ;
+ 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)]))) {
+
+ if (!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
+ gTarget = TARGET_UNKNOWN;
+ }
+
+detected:
+ LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
+ return gTarget;
+}
diff --git a/msm8084/utils/loc_target.h b/msm8084/utils/loc_target.h
new file mode 100644
index 0000000..9aa525f
--- /dev/null
+++ b/msm8084/utils/loc_target.h
@@ -0,0 +1,75 @@
+/* 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_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
+#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
+#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, 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);
+
+/* 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_QCA1530,
+ GNSS_UNKNOWN
+}GNSS_TARGET;
+
+typedef enum {
+ NO_SSC = 0,
+ HAS_SSC
+}SSC_TYPE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*LOC_TARGET_H*/
diff --git a/msm8084/utils/loc_timer.c b/msm8084/utils/loc_timer.c
new file mode 100644
index 0000000..1e4008e
--- /dev/null
+++ b/msm8084/utils/loc_timer.c
@@ -0,0 +1,186 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<sys/time.h>
+#include "loc_timer.h"
+#include<time.h>
+#include<errno.h>
+
+enum timer_state {
+ READY = 100,
+ WAITING,
+ DONE,
+ ABORT
+};
+
+typedef struct {
+ loc_timer_callback callback_func;
+ void *user_data;
+ unsigned int time_msec;
+ pthread_cond_t timer_cond;
+ pthread_mutex_t timer_mutex;
+ enum timer_state state;
+}timer_data;
+
+static void *timer_thread(void *thread_data)
+{
+ int ret = -ETIMEDOUT;
+ struct timespec ts;
+ struct timeval tv;
+ timer_data* t = (timer_data*)thread_data;
+
+ LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t->time_msec);
+
+ gettimeofday(&tv, NULL);
+ clock_gettime(CLOCK_REALTIME, &ts);
+ if(t->time_msec >= 1000) {
+ ts.tv_sec += t->time_msec/1000;
+ t->time_msec = t->time_msec % 1000;
+ }
+ if(t->time_msec)
+ ts.tv_nsec += t->time_msec * 1000000;
+ if(ts.tv_nsec > 999999999) {
+ LOC_LOGD("%s:%d]: Large nanosecs\n", __func__, __LINE__);
+ ts.tv_sec += 1;
+ ts.tv_nsec -= 1000000000;
+ }
+ LOC_LOGD("%s:%d]: ts.tv_sec:%d; ts.tv_nsec:%d\n"
+ "\t Current time: %d sec; %d nsec",
+ __func__, __LINE__, (int)ts.tv_sec, (int)ts.tv_nsec,
+ (int)tv.tv_sec, (int)tv.tv_usec*1000);
+
+ pthread_mutex_lock(&(t->timer_mutex));
+ if (READY == t->state) {
+ t->state = WAITING;
+ ret = pthread_cond_timedwait(&t->timer_cond, &t->timer_mutex, &ts);
+ t->state = DONE;
+ }
+ pthread_mutex_unlock(&(t->timer_mutex));
+
+ switch (ret) {
+ case ETIMEDOUT:
+ LOC_LOGV("%s:%d]: loc_timer timed out", __func__, __LINE__);
+ break;
+ case 0:
+ LOC_LOGV("%s:%d]: loc_timer stopped", __func__, __LINE__);
+ break;
+ case -ETIMEDOUT:
+ LOC_LOGV("%s:%d]: loc_timer cancelled", __func__, __LINE__);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Call to pthread timedwait failed; ret=%d\n",
+ __func__, __LINE__, ret);
+ break;
+ }
+
+ pthread_mutex_destroy(&t->timer_mutex);
+ pthread_cond_destroy(&t->timer_cond);
+
+ if(ETIMEDOUT == ret)
+ t->callback_func(t->user_data, ret);
+
+ free(t);
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return NULL;
+}
+
+void* loc_timer_start(unsigned int msec, loc_timer_callback cb_func,
+ void* caller_data)
+{
+ timer_data *t=NULL;
+ pthread_attr_t tattr;
+ pthread_t id;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ if(cb_func == NULL || msec == 0) {
+ LOC_LOGE("%s:%d]: Error: Wrong parameters\n", __func__, __LINE__);
+ goto _err;
+ }
+ t = (timer_data *)calloc(1, sizeof(timer_data));
+ if(t == NULL) {
+ LOC_LOGE("%s:%d]: Could not allocate memory. Failing.\n",
+ __func__, __LINE__);
+ goto _err;
+ }
+
+ if(pthread_cond_init(&(t->timer_cond), NULL)) {
+ LOC_LOGE("%s:%d]: Pthread cond init failed\n", __func__, __LINE__);
+ goto t_err;
+ }
+ if(pthread_mutex_init(&(t->timer_mutex), NULL)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ goto cond_err;
+ }
+
+ t->callback_func = cb_func;
+ t->user_data = caller_data;
+ t->time_msec = msec;
+ t->state = READY;
+
+ if (pthread_attr_init(&tattr)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ goto mutex_err;
+ }
+ pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+
+ if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) {
+ LOC_LOGE("%s:%d]: Could not create thread\n", __func__, __LINE__);
+ goto attr_err;
+ }
+
+ LOC_LOGD("%s:%d]: Created thread with id: %d\n",
+ __func__, __LINE__, (int)id);
+ goto _err;
+
+attr_err:
+ pthread_attr_destroy(&tattr);
+mutex_err:
+ pthread_mutex_destroy(&t->timer_mutex);
+cond_err:
+ pthread_cond_destroy(&t->timer_cond);
+t_err:
+ free(t);
+_err:
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return t;
+}
+
+void loc_timer_stop(void* handle) {
+ timer_data* t = (timer_data*)handle;
+
+ if (NULL != t && (READY == t->state || WAITING == t->state)) {
+ pthread_mutex_lock(&(t->timer_mutex));
+ if (READY == t->state || WAITING == t->state) {
+ pthread_cond_signal(&t->timer_cond);
+ t->state = ABORT;
+ }
+ pthread_mutex_unlock(&(t->timer_mutex));
+ }
+}
diff --git a/msm8084/utils/loc_timer.h b/msm8084/utils/loc_timer.h
new file mode 100644
index 0000000..0034d27
--- /dev/null
+++ b/msm8084/utils/loc_timer.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_DELAY_H__
+#define __LOC_DELAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#include<pthread.h>
+#include "log_util.h"
+
+/*
+ Return values:
+ Success = 0
+ Failure = Non zero
+*/
+typedef void(*loc_timer_callback)(void *user_data, int result);
+
+
+/*
+ Returns the handle, which can be used to stop the timer
+*/
+void* loc_timer_start(unsigned int delay_msec,
+ loc_timer_callback,
+ void* user_data);
+
+/*
+ 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/msm8084/utils/log_util.h b/msm8084/utils/log_util.h
new file mode 100644
index 0000000..8ff6b5a
--- /dev/null
+++ b/msm8084/utils/log_util.h
@@ -0,0 +1,181 @@
+/* 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__
+
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#endif /* USE_GLIB */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) \
+IF_LOC_LOGE { ALOGE("E/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/" __VA_ARGS__); }
+
+#define LOC_LOGW(...) \
+IF_LOC_LOGW { ALOGE("W/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); }
+
+#define LOC_LOGI(...) \
+IF_LOC_LOGI { ALOGE("I/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); }
+
+#define LOC_LOGD(...) \
+IF_LOC_LOGD { ALOGE("D/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); }
+
+#define LOC_LOGV(...) \
+IF_LOC_LOGV { ALOGE("V/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE("E/" __VA_ARGS__)
+
+#define LOC_LOGW(...) ALOGW("W/" __VA_ARGS__)
+
+#define LOC_LOGI(...) ALOGI("I/" __VA_ARGS__)
+
+#define LOC_LOGD(...) ALOGD("D/" __VA_ARGS__)
+
+#define LOC_LOGV(...) ALOGV("V/" __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 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 ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL)
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __func__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __func__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __func__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __func__, 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/msm8084/utils/msg_q.c b/msm8084/utils/msg_q.c
new file mode 100644
index 0000000..2abcfb1
--- /dev/null
+++ b/msm8084/utils/msg_q.c
@@ -0,0 +1,336 @@
+/* Copyright (c) 2011-2012, 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 "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.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_LOGD("%s: Sending message with handle = 0x%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_LOGD("%s: Finished Sending message with handle = 0x%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;
+
+ LOC_LOGD("%s: Waiting on message\n", __FUNCTION__);
+
+ 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_LOGD("%s: Received message 0x%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/msm8084/utils/msg_q.h b/msm8084/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/msm8084/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/msm8909/CleanSpec.mk b/msm8909/CleanSpec.mk
new file mode 100644
index 0000000..dd1849d
--- /dev/null
+++ b/msm8909/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/msm8909/Makefile.am b/msm8909/Makefile.am
new file mode 100644
index 0000000..f374a5c
--- /dev/null
+++ b/msm8909/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am - Automake script for gps loc_api
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = utils loc_api/libloc_api_50001 loc_api/loc_api_v02
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/msm8909/configure.ac b/msm8909/configure.ac
new file mode 100644
index 0000000..dca18a1
--- /dev/null
+++ b/msm8909/configure.ac
@@ -0,0 +1,85 @@
+# configure.ac -- Autoconf script for gps loc_api
+#
+# 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 package version 1.0.0
+AC_INIT([loc-api],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([utils/loc_cfg.cpp])
+# 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([QMIF], [qmi-framework])
+AC_SUBST([QMIF_CFLAGS])
+AC_SUBST([QMIF_LIBS])
+
+AC_ARG_WITH([libhardware_includes],
+ AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@],
+ [Specify the location of the libhardware headers]),
+ [libhardware_incdir=$withval],
+ with_libhardware_includes=no)
+
+if test "x$with_libhardware_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${libhardware_incdir}"
+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_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 \
+ utils/Makefile \
+ loc_api/libloc_api_50001/Makefile \
+ loc_api/loc_api_v02/Makefile \
+ loc-api.pc \
+ ])
+
+AC_OUTPUT
diff --git a/msm8909/core/Android.mk b/msm8909/core/Android.mk
new file mode 100644
index 0000000..8b998b6
--- /dev/null
+++ b/msm8909/core/Android.mk
@@ -0,0 +1,60 @@
+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_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+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 \
+ libgps.utils \
+ libdl \
+ liblog
+
+LOCAL_SRC_FILES += \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libflp
+
+LOCAL_COPY_HEADERS_TO:= libloc_core/
+LOCAL_COPY_HEADERS:= \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ LBSProxyBase.h \
+ UlpProxyBase.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8909/core/ContextBase.cpp b/msm8909/core/ContextBase.cpp
new file mode 100644
index 0000000..8449476
--- /dev/null
+++ b/msm8909/core/ContextBase.cpp
@@ -0,0 +1,136 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+loc_gps_cfg_s_type ContextBase::mGps_conf {0};
+loc_sap_cfg_s_type ContextBase::mSap_conf {0};
+
+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)();
+ }
+ }
+ 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;
+
+ // Check the target
+ if (TARGET_NO_GNSS != loc_get_target()){
+
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask, 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)(mMsgTask, exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, 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())
+{
+}
+
+}
diff --git a/msm8909/core/ContextBase.h b/msm8909/core/ContextBase.h
new file mode 100644
index 0000000..e56ff10
--- /dev/null
+++ b/msm8909/core/ContextBase.h
@@ -0,0 +1,136 @@
+/* Copyright (c) 2011-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_CONTEXT_BASE__
+#define __LOC_CONTEXT_BASE__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <MsgTask.h>
+#include <LocApiBase.h>
+#include <LBSProxyBase.h>
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+/* 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 CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t XTRA_VERSION_CHECK;
+ char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} 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);
+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() { delete mLocApi; delete mLBSProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+ inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
+ inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mLBSProxy->requestUlp(adapter, capabilities);
+ }
+ 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 uint32_t getCarrierCapabilities();
+
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/msm8909/core/LBSProxyBase.h b/msm8909/core/LBSProxyBase.h
new file mode 100644
index 0000000..fa4e707
--- /dev/null
+++ b/msm8909/core/LBSProxyBase.h
@@ -0,0 +1,65 @@
+/* Copyright (c) 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 IZAT_PROXY_BASE_H
+#define IZAT_PROXY_BASE_H
+#include <gps_extended.h>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* /* msgTask */,
+ LOC_API_ADAPTER_EVENT_MASK_T /* exMask */,
+ ContextBase* /* context */) const {
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* /* adapter */,
+ unsigned long /* capabilities */) const {}
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual bool hasCPIExtendedCapabilities() const { return false; }
+ inline virtual void modemPowerVote(bool power) const {}
+ virtual void injectFeatureConfig(ContextBase* /* context */) const {}
+ inline virtual bool hasNativeXtraClient() const { return false; }
+};
+
+typedef LBSProxyBase* (getLBSProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/msm8909/core/LocAdapterBase.cpp b/msm8909/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..0c81910
--- /dev/null
+++ b/msm8909/core/LocAdapterBase.cpp
@@ -0,0 +1,142 @@
+/* Copyright (c) 2011-2014,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.
+ *
+ */
+#define LOG_NDDEBUG 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, LocAdapterProxyBase *adapterProxyBase) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask())
+{
+ mLocApi->addAdapter(this);
+}
+
+void LocAdapterBase::handleEngineUpEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineUpEvent();
+ }
+}
+
+void LocAdapterBase::handleEngineDownEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineDownEvent();
+ }
+}
+
+void LocAdapterBase::
+ reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ if (mLocAdapterProxyBase == NULL ||
+ !mLocAdapterProxyBase->reportPosition(location,
+ locationExtended,
+ status,
+ loc_technology_mask)) {
+ DEFAULT_IMPL()
+ }
+}
+
+void LocAdapterBase::
+ reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportStatus(GpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmea(const char* nmea, int length)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestXtraData()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestTime()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestLocation()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestATL(int connHandle, AGpsType agps_type)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotify(GpsNiNotification ¬ify, const void* data)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportGnssMeasurementData(GnssData &gnssMeasurementData)
+DEFAULT_IMPL()
+} // namespace loc_core
diff --git a/msm8909/core/LocAdapterBase.h b/msm8909/core/LocAdapterBase.h
new file mode 100644
index 0000000..226f9e1
--- /dev/null
+++ b/msm8909/core/LocAdapterBase.h
@@ -0,0 +1,119 @@
+/* Copyright (c) 2011-2014,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_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+protected:
+ LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ 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 isEnabled)
+ {
+ mEvtMask =
+ isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event);
+
+ mLocApi->updateEvtMask();
+ }
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxy(UlpProxyBase* /* ulp */) {}
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeInt(LocPosMode& /* posMode */) {}
+ virtual void startFixInt() {}
+ virtual void stopFixInt() {}
+ virtual void getZppInt() {}
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotify(GpsNiNotification ¬ify,
+ const void* data);
+ inline virtual bool isInSession() { return false; }
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/msm8909/core/LocAdapterProxyBase.h b/msm8909/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..0c5a5fb
--- /dev/null
+++ b/msm8909/core/LocAdapterProxyBase.h
@@ -0,0 +1,70 @@
+/* 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_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):
+ mLocAdapterBase(new LocAdapterBase(mask, context, 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);
+ }
+
+public:
+ inline ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
+ inline virtual void handleEngineUpEvent() {};
+ inline virtual void handleEngineDownEvent() {};
+ inline virtual bool reportPosition(UlpLocation& /* location */,
+ GpsLocationExtended& /* locationExtended */,
+ enum loc_sess_status /* status */,
+ LocPosTechMask /* loc_technology_mask */) {
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif //LOC_ADAPTER_PROXY_BASE_H
diff --git a/msm8909/core/LocApiBase.cpp b/msm8909/core/LocApiBase.cpp
new file mode 100644
index 0000000..01aba47
--- /dev/null
+++ b/msm8909/core/LocApiBase.cpp
@@ -0,0 +1,552 @@
+/* Copyright (c) 2011-2014,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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <log_util.h>
+#include <LocDualContext.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ inline LocOpenMsg(LocApiBase* locApi,
+ LOC_API_ADAPTER_EVENT_MASK_T mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->open(mMask);
+ }
+ inline void locallog() {
+ LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
+ __func__, __LINE__, mMask);
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask),
+ mMask(0), mSupportedMsg(0), mContext(context)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ mMsgTask->sendMsg(new LocOpenMsg(this,
+ (adapter->getEvtMask())));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ }
+ }
+ }
+}
+
+void LocApiBase::updateEvtMask()
+{
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ LocDualContext::injectFeatureConfig(mContext);
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
+}
+
+void LocApiBase::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ // print the location info before delivering
+ LOC_LOGV("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: %lld\n rawDataSize: %d\n rawData: %p\n "
+ "Session status: %d\n Technology mask: %u",
+ 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, location.rawDataSize,
+ location.rawData, status, loc_technology_mask);
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask)
+ );
+}
+
+void LocApiBase::reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+ // print the SV info before delivering
+ LOC_LOGV("num sv: %d", svStatus.num_svs);
+ for (int i = 0; i < svStatus.num_svs && i < GNSS_MAX_SVS; i++) {
+ LOC_LOGV(" %03d: %02d %d %f %f %f 0x%02X",
+ i,
+ svStatus.gnss_sv_list[i].svid,
+ svStatus.gnss_sv_list[i].constellation,
+ svStatus.gnss_sv_list[i].c_n0_dbhz,
+ svStatus.gnss_sv_list[i].elevation,
+ svStatus.gnss_sv_list[i].azimuth,
+ svStatus.gnss_sv_list[i].flags);
+ }
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSv(svStatus,
+ locationExtended,
+ svExt)
+ );
+}
+
+void LocApiBase::reportStatus(GpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+void LocApiBase::reportNmea(const char* nmea, int length)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmea(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::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, AGpsType agps_type)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
+}
+
+void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
+{
+ mSupportedMsg = supportedMsgList;
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGnssMeasurementData(GnssData &gnssMeasurementData)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementData(gnssMeasurementData));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ deleteAidingData(GpsAidingData f)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int enable)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* apn, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double latitude, double longitude, float accuracy)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, AGpsType agpsType)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int handle, int is_succ)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(const char* url, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSUPLVersion(uint32_t version)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setLPPConfig(uint32_t profile)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage,
+ int sensorProvider)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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)
+
+enum loc_api_adapter_err LocApiBase::
+ setExtPowerConfig(int isBatteryCharging)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix(GpsLocation& zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation& zppLoc)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ memset(&tech_mask, 0, sizeof(tech_mask));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+int LocApiBase::
+ initDataServiceClient()
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+int LocApiBase::
+ setGpsLock(LOC_GPS_LOCK_MASK lock)
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+DEFAULT_IMPL()
+
+int LocApiBase::
+ getGpsLock()
+DEFAULT_IMPL(-1)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraVersionCheck(enum xtra_version_check check)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+DEFAULT_IMPL(-1)
+
+bool LocApiBase::
+ gnssConstellationConfig()
+DEFAULT_IMPL(false)
+
+} // namespace loc_core
diff --git a/msm8909/core/LocApiBase.h b/msm8909/core/LocApiBase.h
new file mode 100644
index 0000000..adfbf3b
--- /dev/null
+++ b/msm8909/core/LocApiBase.h
@@ -0,0 +1,261 @@
+/* Copyright (c) 2011-2014,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_API_BASE_H
+#define LOC_API_BASE_H
+
+#include <stddef.h>
+#include <ctype.h>
+#include <gps_extended.h>
+#include <MsgTask.h>
+#include <log_util.h>
+
+namespace loc_core {
+class ContextBase;
+
+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 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;
+
+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 class ContextBase;
+ const MsgTask* mMsgTask;
+ ContextBase *mContext;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+ uint64_t mSupportedMsg;
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+
+ void addAdapter(LocAdapterBase* adapter);
+ void removeAdapter(LocAdapterBase* adapter);
+
+ // upward calls
+ void handleEngineUpEvent();
+ void handleEngineDownEvent();
+ void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask =
+ LOC_POS_TECH_MASK_DEFAULT);
+ void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ void reportStatus(GpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, AGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ void saveSupportedMsgList(uint64_t supportedMsgList);
+ void reportGnssMeasurementData(GnssData &gnssMeasurementData);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging);
+ virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol);
+ virtual enum loc_api_adapter_err
+ getWwanZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient();
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+ virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+ inline virtual void setInSession(bool /* inSession */) {}
+ inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
+ if (msgID > LOC_API_ADAPTER_MESSAGE_MAX) {
+ return false;
+ } else {
+ uint32_t messageChecker = 1 << msgID;
+ return (messageChecker & mSupportedMsg) == messageChecker;
+ }
+ }
+ void updateEvtMask();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+
+ virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check);
+
+ /*
+ Update gps reporting events
+ */
+ virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+ /*
+ Check if the modem support the service
+ */
+ virtual bool gnssConstellationConfig();
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/msm8909/core/LocDualContext.cpp b/msm8909/core/LocDualContext.cpp
new file mode 100644
index 0000000..578421c
--- /dev/null
+++ b/msm8909/core/LocDualContext.cpp
@@ -0,0 +1,147 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+ContextBase* LocDualContext::mInjectContext = NULL;
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
+
+pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
+
+const MsgTask* LocDualContext::getMsgTask(LocThread::tCreate tCreator,
+ const char* name, bool joinable)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name, joinable);
+ }
+ return mMsgTask;
+}
+
+inline
+const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) {
+ return getMsgTask((LocThread::tCreate)NULL, name, joinable);
+}
+
+ContextBase* LocDualContext::getLocFgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mFgContext->sendMsg(firstMsg);
+ }
+
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mBgContext->sendMsg(firstMsg);
+ }
+
+ return mBgContext;
+}
+
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Enter", __func__, __LINE__);
+ if(curContext == mInjectContext) {
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+ }
+ LOC_LOGD("%s:%d]: Exit", __func__, __LINE__);
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mLBSLibName)
+{
+}
+
+}
diff --git a/msm8909/core/LocDualContext.h b/msm8909/core/LocDualContext.h
new file mode 100644
index 0000000..ce77a1a
--- /dev/null
+++ b/msm8909/core/LocDualContext.h
@@ -0,0 +1,76 @@
+/* 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 __LOC_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+ static ContextBase* mInjectContext;
+ 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:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) {
+ return getLocFgContext(NULL, NULL, name, joinable);
+ }
+ static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) {
+ return getLocBgContext(NULL, NULL, name, joinable);
+ }
+
+ static void injectFeatureConfig(ContextBase *context);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/msm8909/core/UlpProxyBase.h b/msm8909/core/UlpProxyBase.h
new file mode 100644
index 0000000..e728d80
--- /dev/null
+++ b/msm8909/core/UlpProxyBase.h
@@ -0,0 +1,84 @@
+/* Copyright (c) 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 ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+#include "fused_location_extended.h"
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ LocPosMode mPosMode;
+ bool mFixSet;
+ inline UlpProxyBase() {
+ mPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mFixSet = false;
+ }
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { mFixSet = true; return false; }
+ inline virtual bool sendStopFix() { mFixSet = false; return false; }
+ inline virtual bool sendFixMode(LocPosMode ¶ms) {
+ mPosMode = params;
+ return false;
+ }
+
+ inline virtual bool reportPosition(UlpLocation& /* location */,
+ GpsLocationExtended& /* locationExtended */,
+ void* /* locationExt */,
+ enum loc_sess_status /* status */,
+ LocPosTechMask /* loc_technology_mask */) {
+ return false;
+ }
+ inline virtual bool reportSv(GnssSvStatus& /* svStatus */,
+ GpsLocationExtended& /* locationExtended */,
+ void* /* svExt */) {
+ return false;
+ }
+ inline virtual bool reportStatus(GpsStatusValue /* status*/) {
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* /* adapter */) {}
+ inline virtual void setCapabilities(unsigned long /* capabilities */) {}
+ inline virtual bool reportBatchingSession(FlpExtBatchOptions& /* options */,
+ bool /* active */) {
+ return false;
+ }
+ inline virtual bool reportPositions(const FlpExtLocation* /* locations */,
+ int32_t /* number_of_locations */) {
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/msm8909/core/gps_extended.h b/msm8909/core/gps_extended.h
new file mode 100644
index 0000000..88b0415
--- /dev/null
+++ b/msm8909/core/gps_extended.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gps_extended_c.h>
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ GpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ char credentials[14];
+ char provider[8];
+ LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ const char* cred, const char* prov) :
+ mode(m), recurrence(recr),
+ min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
+ preferred_accuracy(accu), preferred_time(time) {
+ 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(GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(MIN_POSSIBLE_FIX_INTERVAL),
+ preferred_accuracy(50), preferred_time(120000) {
+ 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 &&
+ !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/msm8909/core/gps_extended_c.h b/msm8909/core/gps_extended_c.h
new file mode 100644
index 0000000..9944db3
--- /dev/null
+++ b/msm8909/core/gps_extended_c.h
@@ -0,0 +1,395 @@
+/* Copyright (c) 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 GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <hardware/gps.h>
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** GpsLocation has valid "is indoor?" flag */
+#define GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** GpsLocation has valid floor number */
+#define GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** GpsLocation has valid map URL*/
+#define GPS_LOCATION_HAS_MAP_URL 0x0100
+/** GpsLocation has valid map index */
+#define GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+/** 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 source is ZPP only */
+#define ULP_LOCATION_IS_FROM_ZPP 0x0004
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+/** Position is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+/** Position is from NLP */
+#define ULP_LOCATION_IS_FROM_NLP 0x0020
+/** Position is from PIP */
+#define ULP_LOCATION_IS_FROM_PIP 0x0040
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+
+/*Emergency SUPL*/
+#define GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+#define AGPS_CERTIFICATE_MAX_LENGTH 2000
+#define AGPS_CERTIFICATE_MAX_SLOTS 10
+
+enum loc_registration_mask_status {
+ LOC_REGISTRATION_MASK_ENABLED,
+ LOC_REGISTRATION_MASK_DISABLED
+};
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ GpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+/** AGPS type */
+typedef int16_t AGpsExtType;
+#define AGPS_TYPE_INVALID -1
+#define AGPS_TYPE_ANY 0
+#define AGPS_TYPE_SUPL 1
+#define AGPS_TYPE_C2K 2
+#define AGPS_TYPE_WWAN_ANY 3
+#define AGPS_TYPE_WIFI 4
+#define AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(GpsCallbacks) */
+ size_t size;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ 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 {
+ gps_xtra_download_request download_request_cb;
+ 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) */
+ size_t size;
+
+ AGpsExtType type;
+ AGpsStatusValue 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;
+ gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ gps_ni_notify_callback notify_cb;
+ gps_create_thread create_thread_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
+} 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;
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint16_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
+
+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;
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+} GpsLocationExtended;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+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)
+
+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_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_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_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)
+
+typedef unsigned int 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_MAX
+} LocCheckingMessagesID;
+
+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)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
diff --git a/msm8909/core/loc_core_log.cpp b/msm8909/core/loc_core_log.cpp
new file mode 100644
index 0000000..3ca6c0a
--- /dev/null
+++ b/msm8909/core/loc_core_log.cpp
@@ -0,0 +1,243 @@
+/* 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 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_core_log.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static const loc_name_val_s_type gps_status_name[] =
+{
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
+};
+static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(GpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
+};
+static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( GPS_DELETE_ALMANAC ),
+ NAME_VAL( GPS_DELETE_POSITION ),
+ NAME_VAL( GPS_DELETE_TIME ),
+ NAME_VAL( GPS_DELETE_IONO ),
+ NAME_VAL( GPS_DELETE_UTC ),
+ NAME_VAL( GPS_DELETE_HEALTH ),
+ NAME_VAL( GPS_DELETE_SVDIR ),
+ NAME_VAL( GPS_DELETE_SVSTEER ),
+ NAME_VAL( GPS_DELETE_SADATA ),
+ NAME_VAL( GPS_DELETE_RTI ),
+ NAME_VAL( GPS_DELETE_CELLDB_INFO ),
+ NAME_VAL( GPS_DELETE_ALL)
+};
+static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(GpsAidingData data)
+{
+ return NULL;
+}
+
+
+static const loc_name_val_s_type loc_eng_agps_types[] =
+{
+ NAME_VAL( AGPS_TYPE_INVALID ),
+ NAME_VAL( AGPS_TYPE_ANY ),
+ NAME_VAL( AGPS_TYPE_SUPL ),
+ NAME_VAL( AGPS_TYPE_C2K ),
+ NAME_VAL( AGPS_TYPE_WWAN_ANY )
+};
+static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(AGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type loc_eng_ni_types[] =
+{
+ NAME_VAL( GPS_NI_TYPE_VOICE ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ),
+ NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL )
+};
+static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(GpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type loc_eng_ni_responses[] =
+{
+ NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY )
+};
+static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(GpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static const loc_name_val_s_type loc_eng_ni_encodings[] =
+{
+ NAME_VAL( GPS_ENC_NONE ),
+ NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( GPS_ENC_UNKNOWN )
+};
+static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static const loc_name_val_s_type loc_eng_agps_status_names[] =
+{
+ NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
+};
+static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(AGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/msm8909/core/loc_core_log.h b/msm8909/core/loc_core_log.h
new file mode 100644
index 0000000..8a1825a
--- /dev/null
+++ b/msm8909/core/loc_core_log.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_CORE_LOG_H
+#define LOC_CORE_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <gps_extended.h>
+
+const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+const char* loc_get_position_mode_name(GpsPositionMode mode);
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(GpsAidingData data);
+const char* loc_get_agps_type_name(AGpsType type);
+const char* loc_get_ni_type_name(GpsNiType type);
+const char* loc_get_ni_response_name(GpsUserResponseType response);
+const char* loc_get_ni_encoding_name(GpsNiEncodingType 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(AGpsStatusValue status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CORE_LOG_H */
diff --git a/msm8909/etc/Android.mk b/msm8909/etc/Android.mk
new file mode 100644
index 0000000..33287df
--- /dev/null
+++ b/msm8909/etc/Android.mk
@@ -0,0 +1,14 @@
+
+LOCAL_PATH := $(call my-dir)
+
+ifeq ($(filter swordfish,$(TARGET_DEVICE)),)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/
+LOCAL_SRC_FILES := gps.conf
+
+include $(BUILD_PREBUILT)
+endif
diff --git a/msm8909/etc/gps.conf b/msm8909/etc/gps.conf
new file mode 100644
index 0000000..b52ea11
--- /dev/null
+++ b/msm8909/etc/gps.conf
@@ -0,0 +1,111 @@
+#Uncommenting these urls would only enable
+#the power up auto injection and force injection(test case).
+#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
+#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
+#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
+
+#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
+
+# 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 = 2
+
+# Intermediate position report, 1=enable, 0=disable
+INTERMEDIATE_POS=0
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# Emergency SUPL, 1=enable, 0=disable
+SUPL_ES=0
+
+#Choose PDN for Emergency SUPL
+#1 - Use emergency PDN
+#0 - Use regular SUPL PDN for Emergency SUPL
+USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1
+
+#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
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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 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
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=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
diff --git a/msm8909/loc-api.pc.in b/msm8909/loc-api.pc.in
new file mode 100644
index 0000000..3b4f81b
--- /dev/null
+++ b/msm8909/loc-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-api
+Description: Qualcomm GPS Location API
+Version: @VERSION@
+Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_eng_so -lgps_default_so -lloc_api
+Cflags: -I${includedir}/loc-api/libloc_api_50001 -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api
diff --git a/msm8909/loc_api/Android.mk b/msm8909/loc_api/Android.mk
new file mode 100644
index 0000000..743b386
--- /dev/null
+++ b/msm8909/loc_api/Android.mk
@@ -0,0 +1,17 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+
+LOCAL_PATH := $(call my-dir)
+
+# add RPC dirs if RPC is available
+ifneq ($(TARGET_NO_RPC),true)
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
+
+endif #TARGET_NO_RPC
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
+
+#call the subfolders
+include $(addsuffix Android.mk, $(GPS_DIR_LIST))
+
+endif#BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/Android.mk b/msm8909/loc_api/libloc_api-rpc-50001/Android.mk
new file mode 100644
index 0000000..6c5d533
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+include $(call all-subdir-makefiles)
+endif
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
new file mode 100644
index 0000000..bb3d924
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
@@ -0,0 +1,60 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+RPC_INC:=rpc_inc
+
+source_files:= \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpc.cpp
+
+LOCAL_SRC_FILES:= $(source_files)
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-DDEBUG -DUSE_QCOM_AUTO_RPC -DUSE_QCOM_AUTO_RPC
+LOCAL_CFLAGS+=$(GPS_FEATURES)
+
+# for loc_api_fixup.c
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= \
+ librpc \
+ libutils \
+ libcutils \
+ libcommondefs \
+ libgps.utils \
+ libloc_core
+
+LOCAL_STATIC_LIBRARIES := \
+ libloc_api_rpcgen
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/rpc_inc \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/loc_api/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/librpc \
+ $(TARGET_OUT_HEADERS)/libloc-rpc/rpc_inc \
+ $(TOP)/hardware/msm7k/librpc
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc-qc/$(RPC_INC)
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_rpc_glue.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_api_sync_call.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ $(RPC_INC)/LocApiRpc.h
+
+LOCAL_MODULE:= libloc_api-rpc-qc
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
new file mode 100644
index 0000000..f5c5136
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
@@ -0,0 +1,46 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I../../../platform_lib_abstractions \
+ -I./rpc_inc \
+ -I../libloc_api-rpc-stub/inc \
+ -I../../libloc_api_50001 \
+ $(MSM7K_CFLAGS) \
+ -DUSE_QCOM_AUTO_RPC
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ rpc_inc/loc_api_rpc_glue.h \
+ rpc_inc/loc_api_fixup.h \
+ rpc_inc/loc_api_sync_call.h \
+ rpc_inc/loc_apicb_appinit.h \
+
+c_sources = \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpcAdapter.cpp \
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpc_qc_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpc_qc_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpc_qc_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpc_qc_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpc_qc_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpc_qc_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpc_qc.la
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
new file mode 100644
index 0000000..01d67f4
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
@@ -0,0 +1,140 @@
+/* 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 LOC_API_RPC_H
+#define LOC_API_RPC_H
+
+#include <rpc/rpc.h>
+#include <loc_api_rpcgen_common_rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <LocApiBase.h>
+#include <loc_log.h>
+
+using namespace loc_core;
+
+class LocApiRpc : public LocApiBase {
+protected:
+ // RPC communication establishment
+ rpc_loc_client_handle_type client_handle;
+
+private:
+ int dataEnableLastSet;
+ char apnLastSet[MAX_APN_LEN];
+
+ static const LOC_API_ADAPTER_EVENT_MASK_T maskAll;
+ static const rpc_loc_event_mask_type locBits[];
+ static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ static rpc_loc_lock_e_type convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask);
+ static enum loc_api_adapter_err convertErr(int rpcErr);
+ static GpsNiEncodingType convertNiEncodingType(int loc_encoding);
+ static int NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv);
+
+ void reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr);
+ void reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+ void reportStatus(const rpc_loc_status_event_s_type *status_report_ptr);
+ void reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+ void ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr);
+ void NIEvent(const rpc_loc_ni_event_s_type *ni_req_ptr);
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+public:
+ LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ ~LocApiRpc();
+
+ virtual int locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+
+ void locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event);
+
+ // RPC adapter interface implementations
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& mode);
+ inline virtual enum loc_api_adapter_err
+ enableData(int enable) { return enableData(enable, false); }
+ virtual enum loc_api_adapter_err
+ enableData(int enable, boolean force);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ inline virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len) { return setAPN(apn, len, false); }
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len, boolean force);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(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 enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual void setInSession(bool inSession);
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+};
+
+extern "C" LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+#endif //LOC_API_RPC_H
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
new file mode 100644
index 0000000..49a6d0b
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
@@ -0,0 +1,69 @@
+/* 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "LocSvc_rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ ALOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ ALOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ ALOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
new file mode 100644
index 0000000..c483b4a
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
@@ -0,0 +1,226 @@
+/* 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 LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RPC failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+// Special return value for modem restart incurred RPC failure
+#define RPC_LOC_API_RPC_MODEM_RESTART (-1235)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE 0x00000200
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* EFS data access */
+#define RPC_LOC_EFS_MAX_PATH_LEN_BYTES 64 /* Max file name length in bytes that can be written*/
+#define RPC_LOC_EFS_MAX_FILE_LEN_BYTES 2000 /* Max file size in bytes that can be written */
+
+/* WIPER valid information flag in log report */
+#define RPC_LOC_WIPER_LOG_TIME_VALID 0x01
+#define RPC_LOC_WIPER_LOG_POS_VALID 0x02
+#define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04
+
+/* General WIPER defines */
+#define RPC_LOC_WIPER_MAC_ADDR_LENGTH 6 // Do not change this number since it affects RPC and log packet sizes
+#define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes
+
+/* WIPER AP Qualifier */
+#define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1 /* AP is being used by WPS */
+#define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */
+#define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4 /* AP has encryption turned on */
+#define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8 /* AP is in infrastructure mode and not in ad-hoc/unknown mode */
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+/* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */
+/* values for apn_profiles[0].srv_system_type */
+#define LOC_APN_PROFILE_SRV_SYS_CDMA 0x01
+#define LOC_APN_PROFILE_SRV_SYS_HDR 0x02
+#define LOC_APN_PROFILE_SRV_SYS_GSM 0x04
+#define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08
+#define LOC_APN_PROFILE_SRV_SYS_LTE 0x10
+#define LOC_APN_PROFILE_SRV_SYS_MAX 0x1F
+/* values for apn_profiles[0].pdp_type */
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4 0x01
+#define LOC_APN_PROFILE_PDN_TYPE_IPV6 0x02
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4V6 0x03
+#define LOC_APN_PROFILE_PDN_TYPE_PPP 0x04
+#define LOC_APN_PROFILE_PDN_TYPE_MAX 0x04
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
new file mode 100644
index 0000000..f037428
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
@@ -0,0 +1,59 @@
+/* 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 LOC_API_LOG_H
+#define LOC_API_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_api_rpcgen_common_rpc.h"
+
+extern int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open);
+extern const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask);
+extern const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type);
+extern const char* loc_get_ioctl_status_name(uint32 status);
+extern const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status);
+extern const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state);
+extern const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state);
+extern const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_LOG_H */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..6df33ae
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
@@ -0,0 +1,123 @@
+/* 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 LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+#include "loc_api_fixup.h"
+#include "loc_api_sync_call.h"
+#include <rpc/clnt.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ void* userData,
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+typedef void (loc_reset_notif_cb_f_type)(
+ void* userData,
+ CLIENT* clnt,
+ enum rpc_reset_event event
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_global_cb,
+ void* userData
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern void loc_clear
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+extern int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
new file mode 100644
index 0000000..43208bd
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
@@ -0,0 +1,90 @@
+/* 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 LOC_API_CB_SYNC_H
+#define LOC_API_CB_SYNC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include "loc_api_rpc_glue.h"
+#define LOC_SYNC_CALL_SLOTS_MAX 8
+
+typedef struct {
+ pthread_mutex_t lock;
+
+ /* Client ID */
+ rpc_loc_client_handle_type loc_handle;
+
+ /* Callback waiting conditional variable */
+ pthread_cond_t loc_cb_arrived_cond;
+
+ /* Callback waiting data block, protected by loc_cb_data_mutex */
+ boolean in_use;
+ boolean signal_sent;
+ boolean not_available;
+ rpc_loc_event_mask_type loc_cb_wait_event_mask; /* event to wait for */
+ rpc_loc_ioctl_e_type ioctl_type; /* ioctl to wait for */
+ rpc_loc_event_payload_u_type loc_cb_received_payload; /* received payload */
+ rpc_loc_event_mask_type loc_cb_received_event_mask; /* received event */
+} loc_sync_call_slot_s_type;
+
+typedef struct {
+ int num_of_slots;
+ loc_sync_call_slot_s_type slots[LOC_SYNC_CALL_SLOTS_MAX];
+} loc_sync_call_slot_array_s_type;
+
+/* Init function */
+void loc_api_sync_call_init();
+
+/* Destroy function */
+void loc_api_sync_call_destroy();
+
+/* Process Loc API callbacks to wake up blocked user threads */
+void loc_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+/* Reentrant synchronous IOCTL call, using Loc API return code */
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..ba41d08
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
@@ -0,0 +1,45 @@
+/* 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 LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
new file mode 100644
index 0000000..b946aec
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
@@ -0,0 +1,1465 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc"
+
+#include <unistd.h>
+#include <math.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#endif /* USE_GLIB */
+#include <LocApiRpc.h>
+#include <LocAdapterBase.h>
+#include <loc_api_fixup.h>
+#include <loc_api_rpc_glue.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_api_log.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include <librpc.h>
+#include <platform_lib_includes.h>
+
+using namespace loc_core;
+
+#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
+#define XTRA_BLOCK_SIZE (3072)
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+/*===========================================================================
+FUNCTION loc_event_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int32 loc_event_cb
+(
+ void* user,
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event));
+ loc_callback_log(loc_event, loc_event_payload);
+ int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_rpc_global_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open for RPC global events
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event));
+ ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event);
+ EXIT_LOG(%p, VOID_RET);
+}
+
+const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll =
+ LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+const rpc_loc_event_mask_type LocApiRpc::locBits[] =
+{
+ RPC_LOC_EVENT_PARSED_POSITION_REPORT,
+ RPC_LOC_EVENT_SATELLITE_REPORT,
+ RPC_LOC_EVENT_NMEA_1HZ_REPORT,
+ RPC_LOC_EVENT_NMEA_POSITION_REPORT,
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST,
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST,
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST,
+ RPC_LOC_EVENT_IOCTL_REPORT,
+ RPC_LOC_EVENT_STATUS_REPORT,
+ RPC_LOC_EVENT_WPS_NEEDED_REQUEST
+};
+
+// constructor
+LocApiRpc::LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) :
+ LocApiBase(msgTask, exMask, context),
+ client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
+ dataEnableLastSet(-1)
+{
+ memset(apnLastSet, 0, sizeof(apnLastSet));
+ loc_api_glue_init();
+}
+
+LocApiRpc::~LocApiRpc()
+{
+ close();
+}
+
+rpc_loc_event_mask_type
+LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ rpc_loc_event_mask_type newMask = 0;
+
+ for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) {
+ if (mask & bit) {
+ newMask |= locBits[i];
+ mask ^= bit;
+ }
+ }
+
+ return newMask;
+}
+
+rpc_loc_lock_e_type
+LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask)
+{
+ if (isGpsLockAll(lockMask))
+ return RPC_LOC_LOCK_ALL;
+ if (isGpsLockMO(lockMask))
+ return RPC_LOC_LOCK_MI;
+ if (isGpsLockMT(lockMask))
+ return RPC_LOC_LOCK_MT;
+ if (isGpsLockNone(lockMask))
+ return RPC_LOC_LOCK_NONE;
+ return (rpc_loc_lock_e_type)lockMask;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::convertErr(int rpcErr)
+{
+ switch(rpcErr)
+ {
+ case RPC_LOC_API_SUCCESS:
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+ case RPC_LOC_API_GENERAL_FAILURE:
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ case RPC_LOC_API_UNSUPPORTED:
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ case RPC_LOC_API_INVALID_HANDLE:
+ return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ case RPC_LOC_API_INVALID_PARAMETER:
+ return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
+ case RPC_LOC_API_ENGINE_BUSY:
+ return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
+ case RPC_LOC_API_PHONE_OFFLINE:
+ return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
+ case RPC_LOC_API_TIMEOUT:
+ return LOC_API_ADAPTER_ERR_TIMEOUT;
+ case RPC_LOC_API_RPC_MODEM_RESTART:
+ return LOC_API_ADAPTER_ERR_ENGINE_DOWN;
+ case RPC_LOC_API_RPC_FAILURE:
+ return LOC_API_ADAPTER_ERR_FAILURE;
+ default:
+ return LOC_API_ADAPTER_ERR_UNKNOWN;
+ }
+}
+
+void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event)
+{
+ static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX;
+
+ switch (event) {
+ case RPC_SUBSYSTEM_RESTART_BEGIN:
+ if (RPC_LOC_ENGINE_STATE_OFF != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_OFF;
+ handleEngineDownEvent();
+ }
+ break;
+ case RPC_SUBSYSTEM_RESTART_END:
+ if (RPC_LOC_ENGINE_STATE_ON != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_ON;
+ handleEngineUpEvent();
+ }
+ break;
+ }
+}
+
+int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ // Parsed report
+ if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
+ {
+ reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ parsed_location_report);
+ }
+
+ // Satellite report
+ if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
+ {
+ reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report);
+ }
+
+ // Status report
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report);
+ }
+
+ // NMEA
+ if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
+ {
+ reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
+ }
+ // XTRA support: supports only XTRA download
+ if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST)
+ {
+ if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
+ {
+ requestXtraData();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_TIME_REQ)
+ {
+ requestTime();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ)
+ {
+ requestLocation();
+ }
+ }
+
+ // AGPS data request
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ loc_server_request);
+ }
+
+ // NI notify request
+ if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request);
+ }
+
+ return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to
+ // cause any issues in RPC thread context
+}
+
+enum loc_api_adapter_err
+LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ // RPC does not dynamically update the event mask. And in the
+ // case of RPC, all we support are positioning (gps + agps)
+ // masks anyways, so we simply mask all of them on always.
+ // After doing so the first time in a power cycle, we know there
+ // will the following if condition will never be true any more.
+ mask = maskAll;
+
+ if (mask != mMask) {
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ close();
+ }
+
+ mMask = mask;
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and bckground.
+ client_handle = loc_open(convertMask(mask),
+ loc_event_cb,
+ loc_rpc_global_cb, this);
+
+ if (client_handle < 0) {
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+ ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ }
+ }
+
+ return ret_val;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::close()
+{
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ loc_clear(client_handle);
+ }
+
+ loc_close(client_handle);
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::startFix(const LocPosMode& posMode) {
+ LOC_LOGD("LocApiRpc::startFix() called");
+ return convertErr(
+ loc_start_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::stopFix() {
+ LOC_LOGD("LocApiRpc::stopFix() called");
+ return convertErr(
+ loc_stop_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setPositionMode(const LocPosMode& posMode)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ rpc_loc_operation_mode_e_type op_mode;
+ int ret_val;
+ const LocPosMode* fixCriteria = &posMode;
+
+ ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode);
+
+ switch (fixCriteria->mode)
+ {
+ case LOC_POSITION_MODE_MS_BASED:
+ op_mode = RPC_LOC_OPER_MODE_MSB;
+ break;
+ case LOC_POSITION_MODE_MS_ASSISTED:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ break;
+ case LOC_POSITION_MODE_RESERVED_1:
+ op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_2:
+ op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_3:
+ op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_4:
+ case LOC_POSITION_MODE_RESERVED_5:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ fix_criteria_ptr->preferred_response_time = 0;
+ break;
+ default:
+ op_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ }
+
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->preferred_operation_mode = op_mode;
+
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+
+ if (fixCriteria->preferred_accuracy > 0) {
+ fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+ }
+ if (fixCriteria->preferred_time > 0) {
+ fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
+ }
+
+ switch (fixCriteria->recurrence) {
+ case GPS_POSITION_RECURRENCE_SINGLE:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
+ break;
+ case GPS_POSITION_RECURRENCE_PERIODIC:
+ default:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
+ break;
+ }
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_time_s_type *time_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+ int ret_val;
+
+ LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+
+ time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time;
+ time_info_ptr->time_utc = time;
+ time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::injectPosition(double latitude, double longitude, float accuracy)
+{
+ /* IOCTL data */
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_pos_s_type *assistance_data_position =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position;
+ int ret_val;
+
+ /************************************************
+ * Fill in latitude, longitude & accuracy
+ ************************************************/
+
+ /* This combo is required */
+ assistance_data_position->valid_mask =
+ RPC_LOC_ASSIST_POS_VALID_LATITUDE |
+ RPC_LOC_ASSIST_POS_VALID_LONGITUDE |
+ RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR |
+ RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL;
+
+ assistance_data_position->latitude = latitude;
+ assistance_data_position->longitude = longitude;
+ assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */
+ assistance_data_position->confidence_horizontal = 63; /* 63% (1 std dev) assumed */
+
+ /* Log */
+ LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n",
+ (double) assistance_data_position->latitude,
+ (double) assistance_data_position->longitude,
+ (double) assistance_data_position->hor_unc_circular);
+
+ ret_val = loc_eng_ioctl( client_handle,
+ RPC_LOC_IOCTL_INJECT_POSITION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+{
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+
+ memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back,
+ passThroughData, sizeof (rpc_loc_ni_event_s_type));
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ default:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ }
+
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setAPN(char* apn, int len, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ int size = sizeof(apnLastSet);
+ if (force || memcmp(apnLastSet, apn, size)) {
+ if (len < size) {
+ // size will be not larger than its original value
+ size = len + 1;
+ }
+ memcpy(apnLastSet, apn, size);
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
+ memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
+
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+void LocApiRpc::setInSession(bool inSession)
+{
+ if (!inSession) {
+ enableData(dataEnableLastSet, true);
+ setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(const char* url, int len)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
+#if (AMSS_VERSION==3200)
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len;
+#else
+ strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url,
+ sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", url);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(unsigned int ip, int port, LocServerType type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ switch (type) {
+ case LOC_AGPS_MPC_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR;
+ break;
+ case LOC_AGPS_CUSTOM_PDE_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR;
+ break;
+ default:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
+ break;
+ }
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
+ LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::enableData(int enable, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ if (force || dataEnableLastSet != enable) {
+ dataEnableLastSet = enable;
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
+
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::deleteAidingData(GpsAidingData bits)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits;
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
+{
+ LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
+
+ UlpLocation location = {0};
+ GpsLocationExtended locationExtended = {0};
+
+ location.size = sizeof(location);
+ locationExtended.size = sizeof(locationExtended);
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
+ {
+ // Process the position from final and intermediate reports
+ if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS ||
+ location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS)
+ {
+ // Latitude & Longitude
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) &&
+ (location_report_ptr->latitude != 0 ||
+ location_report_ptr->longitude != 0))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = location_report_ptr->latitude;
+ location.gpsLocation.longitude = location_report_ptr->longitude;
+
+ // Time stamp (UTC)
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.gpsLocation.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ // Altitude
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ // Speed
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = location_report_ptr->speed_horizontal;
+ }
+
+ // Heading
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = location_report_ptr->heading;
+ }
+
+ // Uncertainty (circular)
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ // Technology Mask
+
+ tech_Mask |= location_report_ptr->technology_mask;
+ //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->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
+ locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
+ locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = location_report_ptr->vert_unc;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = location_report_ptr->speed_unc;
+ }
+
+ LOC_LOGV("reportPosition: fire callback\n");
+ enum loc_sess_status fixStatus =
+ (location_report_ptr->session_status
+ == RPC_LOC_SESS_STATUS_IN_PROGESS ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS);
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ (void*)location_report_ptr,
+ fixStatus,
+ tech_Mask);
+ }
+ }
+ else
+ {
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_FAILURE);
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status = %d\n",
+ location_report_ptr->session_status);
+ }
+ }
+ else
+ {
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status is not set\n");
+ }
+}
+
+void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
+{
+ QtiGnssSvStatus SvStatus = {0};
+ GpsLocationExtended locationExtended = {0};
+ locationExtended.size = sizeof(locationExtended);
+ int num_svs_max = 0;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ num_svs_max = gnss_report_ptr->sv_count;
+ if (num_svs_max > GPS_MAX_SVS)
+ {
+ num_svs_max = GPS_MAX_SVS;
+ }
+ }
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ SvStatus.num_svs = 0;
+
+ for (int i = 0; i < num_svs_max; i++)
+ {
+ sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
+ {
+ if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+ }
+ // SBAS: GPS RPN: 120-151,
+ // In exteneded measurement report, we follow nmea standard, which is from 33-64.
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
+ }
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
+ {
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
+ }
+ // Unsupported SV system
+ else
+ {
+ continue;
+ }
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ }
+
+ SvStatus.num_svs++;
+ }
+ }
+
+ if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
+ locationExtended.pdop = gnss_report_ptr->position_dop;
+ locationExtended.hdop = gnss_report_ptr->horizontal_dop;
+ locationExtended.vdop = gnss_report_ptr->vertical_dop;
+ }
+
+ if (SvStatus.num_svs >= 0)
+ {
+ LocApiBase::reportSv(SvStatus,
+ locationExtended,
+ (void*)gnss_report_ptr);
+ }
+}
+
+void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
+{
+
+ if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
+ if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON);
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN);
+ }
+ else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_END);
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF);
+ }
+ else
+ {
+ LocApiBase::reportStatus(GPS_STATUS_NONE);
+ }
+ }
+
+}
+
+void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+{
+
+#if (AMSS_VERSION==3200)
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#else
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences,
+ nmea_report_ptr->length);
+ LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n",
+ nmea_report_ptr->nmea_sentences[3],
+ nmea_report_ptr->nmea_sentences[4],
+ nmea_report_ptr->nmea_sentences[5]);
+#endif /* #if (AMSS_VERSION==3200) */
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setXtraData(char* data, int length)
+{
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ int total_parts;
+ uint8 part;
+ uint16 part_len;
+ uint16 len_injected;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
+ rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data);
+
+ predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data;
+ predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA;
+ predicted_orbits_data_ptr->total_size = length;
+ total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1;
+ predicted_orbits_data_ptr->total_parts = total_parts;
+
+ len_injected = 0; // O bytes injected
+ ioctl_data.disc = ioctl_type;
+
+ // XTRA injection starts with part 1
+ for (part = 1; part <= total_parts; part++)
+ {
+ predicted_orbits_data_ptr->part = part;
+ predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE;
+ if (XTRA_BLOCK_SIZE > (length - len_injected))
+ {
+ predicted_orbits_data_ptr->part_len = length - len_injected;
+ }
+ predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
+ predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n",
+ predicted_orbits_data_ptr->part,
+ total_parts,
+ predicted_orbits_data_ptr->part_len,
+ len_injected);
+
+ if (part < total_parts)
+ {
+ // No callback in this case
+ rpc_ret_val = loc_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data);
+
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
+ break;
+ }
+ //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor
+ usleep(10 * 1000);
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ if (!loc_eng_ioctl(client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
+ NULL))
+ {
+ rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ }
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
+ }
+
+ return convertErr(rpc_ret_val);
+}
+
+/* Request the Xtra Server Url from the modem */
+enum loc_api_adapter_err
+LocApiRpc::requestXtraServer()
+{
+ loc_api_adapter_err err;
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ err = convertErr(loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_data));
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS != err)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err);
+ return err;
+ }
+ else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+
+ reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[0],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[1],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[2],
+ 255);
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+{
+ rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+
+ if (AGPS_TYPE_INVALID == agpsType) {
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr->conn_handle = handle;
+ conn_open_status_ptr->open_status = open_status;
+#if (AMSS_VERSION==3200)
+ conn_open_status_ptr->apn_name = apn; /* requires APN */
+#else
+ if (is_succ) {
+ strlcpy(conn_open_status_ptr->apn_name, apn,
+ sizeof conn_open_status_ptr->apn_name);
+ } else {
+ conn_open_status_ptr->apn_name[0] = 0;
+ }
+#endif /* #if (AMSS_VERSION==3200) */
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n",
+ log_succ_fail_string(is_succ),
+ apn);
+ } else {
+ rpc_loc_server_multi_open_status_s_type *conn_multi_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS;
+ conn_multi_open_status_ptr->conn_handle = handle;
+ conn_multi_open_status_ptr->open_status = open_status;
+ if (is_succ) {
+ strlcpy(conn_multi_open_status_ptr->apn_name, apn,
+ sizeof conn_multi_open_status_ptr->apn_name);
+ } else {
+ conn_multi_open_status_ptr->apn_name[0] = 0;
+ }
+
+ switch(bearer)
+ {
+ case AGPS_APN_BEARER_IPV4:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
+ break;
+ case AGPS_APN_BEARER_IPV6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6;
+ break;
+ case AGPS_APN_BEARER_IPV4V6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6;
+ break;
+ default:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
+ }
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
+ log_succ_fail_string(is_succ),
+ apn,
+ conn_multi_open_status_ptr->pdp_type);
+ }
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlCloseStatus(int handle, int is_succ)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
+ conn_close_status_ptr->conn_handle = handle;
+ conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr)
+{
+ int connHandle;
+ AGpsType agps_type;
+
+ LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)",
+ loc_get_event_atl_open_name(server_request_ptr->event));
+ switch (server_request_ptr->event)
+ {
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle;
+ if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type
+ == RPC_LOC_SERVER_CONNECTION_LBS) {
+ agps_type = AGPS_TYPE_SUPL;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle);
+ } else {
+ agps_type = AGPS_TYPE_WWAN_ANY;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle);
+ }
+ requestATL(connHandle, agps_type);
+ break;
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle);
+ requestATL(connHandle, AGPS_TYPE_INVALID);
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle);
+ releaseATL(connHandle);
+ break;
+ default:
+ LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event);
+ }
+}
+
+void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req)
+{
+ GpsNiNotification notif = {0};
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ LOC_LOGI("VX Notification");
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ // Requestor ID
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ vx_req->requester_id.requester_id,
+ vx_req->requester_id.requester_id_length);
+ notif.text_encoding = 0; // No text and no encoding
+ notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme);
+ NIEventFillVerfiyType(notif, vx_req->notification_priv_type);
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ LOC_LOGI("UMTS CP Notification\n");
+ notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE; // Stores notification text
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text.notification_text_val,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+ umts_cp_req->requestor_id.string_len);
+#else
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string,
+ umts_cp_req->requestor_id.string_len);
+#endif
+ notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type);
+
+ // LCS address (using extras field)
+ if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0)
+ {
+ // 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;
+
+#if (AMSS_VERSION==3200)
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
+#else
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address;
+#endif /* #if (AMSS_VERSION==3200) */
+
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source,
+ umts_cp_req->ext_client_address_data.ext_client_address_len);
+
+ // The address is ASCII string
+ if (addr_len)
+ {
+ strlcat(notif.extras, lcs_addr, sizeof notif.extras);
+ }
+ }
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ LOC_LOGI("SUPL Notification\n");
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#else
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#else
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: requestor_id not present.");
+ }
+
+ // Encoding type
+ if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
+ {
+ notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ }
+ else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+ }
+ break;
+
+ default:
+ LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ return;
+ }
+
+ // this copy will get freed in loc_eng_ni when loc_ni_respond() is called
+ rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy));
+ memcpy(copy, ni_req, sizeof(*copy));
+ requestNiNotify(notif, (const void*)copy);
+}
+
+int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv)
+{
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif.notify_flags = 0;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_ACCEPT;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_DENY;
+ return 1;
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setSUPLVersion(uint32_t version)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version;
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
+{
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ return GPS_ENC_SUPL_UTF8;
+ case RPC_LOC_NI_SUPL_UCS2:
+ return GPS_ENC_SUPL_UCS2;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ return GPS_ENC_SUPL_GSM_DEFAULT;
+ case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
+ return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ default:
+ return GPS_ENC_UNKNOWN;
+ }
+}
+
+LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context) {
+ return new LocApiRpc(msgTask, exMask, context);
+}
+
+/*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+*/
+int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+ LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask);
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask);
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val);
+ return (ret_val == TRUE ? 0 : -1);
+}
+
+/*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+*/
+int LocApiRpc :: getGpsLock()
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+ boolean ret_val;
+ int ret=0;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload);
+ if(ret_val == TRUE) {
+ ret = (int)callback_payload.data.engine_lock;
+ LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__);
+ ret = -1;
+ }
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return ret;
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
new file mode 100644
index 0000000..837ef11
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
new file mode 100644
index 0000000..1c48232
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
@@ -0,0 +1,345 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc_glue"
+
+#include "loc_api_log.h"
+#include "loc_log.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "rpc/rpc.h"
+#include "loc_api_fixup.h"
+
+/* Event names */
+loc_name_val_s_type loc_event_name[] =
+ {
+ NAME_VAL( RPC_LOC_EVENT_PARSED_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_SATELLITE_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_1HZ_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_LOCATION_SERVER_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_IOCTL_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_STATUS_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ),
+ };
+int loc_event_num = sizeof loc_event_name / sizeof(loc_name_val_s_type);
+
+/* Event names */
+loc_name_val_s_type loc_event_atl_open_name[] =
+ {
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_OPEN ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_CLOSE ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_MULTI_OPEN )
+ };
+int loc_event_atl_open_num = sizeof loc_event_atl_open_name / sizeof(loc_name_val_s_type);
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open)
+{
+ return loc_get_name_from_val(loc_event_atl_open_name, loc_event_atl_open_num,
+ (long) loc_event_atl_open);
+}
+
+/* IOCTL Type names */
+loc_name_val_s_type loc_ioctl_type_name[] =
+ {
+ NAME_VAL( RPC_LOC_IOCTL_GET_API_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_UTC_TIME ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_RTC_VALUE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_POSITION ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_ENGINE_STATE ),
+ NAME_VAL( RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_DATA_ENABLE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_DELETE_ASSIST_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR ),
+ };
+int loc_ioctl_type_num = sizeof loc_ioctl_type_name / sizeof(loc_name_val_s_type);
+
+/* IOCTL Status names */
+loc_name_val_s_type loc_ioctl_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_API_SUCCESS ),
+ NAME_VAL( RPC_LOC_API_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_API_UNSUPPORTED ),
+ NAME_VAL( RPC_LOC_API_INVALID_HANDLE ),
+ NAME_VAL( RPC_LOC_API_INVALID_PARAMETER ),
+ NAME_VAL( RPC_LOC_API_ENGINE_BUSY ),
+ NAME_VAL( RPC_LOC_API_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_API_TIMEOUT ),
+ NAME_VAL( RPC_LOC_API_RPC_FAILURE ),
+ NAME_VAL( RPC_LOC_API_RPC_MODEM_RESTART )
+ };
+int loc_ioctl_status_num = sizeof loc_ioctl_status_name / sizeof(loc_name_val_s_type);
+
+/* Fix session status names */
+loc_name_val_s_type loc_sess_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_SESS_STATUS_SUCCESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_IN_PROGESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_TIMEOUT ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_BAD_PARAMETER ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_ENGINE_LOCKED )
+ };
+int loc_sess_status_num = sizeof loc_sess_status_name / sizeof(loc_name_val_s_type);
+
+/* Engine state names */
+loc_name_val_s_type loc_engine_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_ENGINE_STATE_ON ),
+ NAME_VAL( RPC_LOC_ENGINE_STATE_OFF )
+ };
+int loc_engine_state_num = sizeof loc_engine_state_name / sizeof(loc_name_val_s_type);
+
+/* Fix session state names */
+loc_name_val_s_type loc_fix_session_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_BEGIN ),
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_END )
+ };
+int loc_fix_session_state_num = sizeof loc_fix_session_state_name / sizeof(loc_name_val_s_type);
+
+
+static const char* log_final_interm_string(int is_final)
+{
+ return is_final ? "final" : "intermediate";
+}
+
+/* Logs parsed report */
+static void log_parsed_report(const rpc_loc_parsed_position_s_type *parsed_report)
+{
+ rpc_loc_session_status_e_type status = parsed_report->session_status;
+ LOC_LOGD("Session status: %s Valid mask: 0x%X\n",
+ loc_get_sess_status_name(status),
+ (uint) parsed_report->valid_mask);
+ LOC_LOGD("Latitude: %.7f (%s)\n", parsed_report->latitude,
+ log_final_interm_string(
+ (parsed_report->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ parsed_report->session_status == RPC_LOC_SESS_STATUS_SUCCESS));
+ LOC_LOGD("Longitude: %.7f\n", parsed_report->longitude);
+ LOC_LOGD("Accuracy: %.7f\n", parsed_report->hor_unc_circular);
+}
+
+/* Logs status report */
+static void log_status_report(const rpc_loc_status_event_s_type *status_event)
+{
+ rpc_loc_status_event_e_type event = status_event->event;
+ switch (event) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ LOC_LOGD("Engine state: %s\n",
+ loc_get_engine_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.engine_state));
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ LOC_LOGD("Fix session state: %s\n",
+ loc_get_fix_session_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state));
+ break;
+ default:
+ break;
+ }
+}
+
+/* Logs valid fields in the GNSS SV constellation report */
+static void log_satellite_report(const rpc_loc_gnss_info_s_type *gnss)
+{
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP)
+ {
+ LOC_LOGV("position dop: %.3f\n", (float) gnss->position_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP)
+ {
+ LOC_LOGV("horizontal dop: %.3f\n", (float) gnss->horizontal_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP)
+ {
+ LOC_LOGV("vertical dop: %.3f\n", (float) gnss->vertical_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED)
+ {
+ LOC_LOGV("altitude assumed: %d\n", (int) gnss->altitude_assumed);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ LOC_LOGD("sv count: %d\n", (int) gnss->sv_count);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ LOC_LOGV("sv list: ");
+
+ if (gnss->sv_count)
+ {
+ LOC_LOGV("\n\tsys\tprn\thlth\tproc\teph\talm\telev\tazi\tsnr\n");
+ }
+ else {
+ LOC_LOGV("empty\n");
+ }
+
+ int i;
+ for (i = 0; i < gnss->sv_count; i++)
+ {
+ const rpc_loc_sv_info_s_type *sv = &gnss->sv_list.sv_list_val[i];
+ rpc_loc_sv_info_valid_mask_type mask = sv->valid_mask;
+ LOC_LOGV(" %d: \t%d\t%d\t%d\t%d\t%d\t%d\t%.3f\t%.3f\t%.3f\n", i,
+ CHECK_MASK(int, sv->system, mask, RPC_LOC_SV_INFO_VALID_SYSTEM),
+ CHECK_MASK(int, sv->prn, mask, RPC_LOC_SV_INFO_VALID_PRN),
+ CHECK_MASK(int, sv->health_status, mask, RPC_LOC_SV_INFO_VALID_HEALTH_STATUS),
+ CHECK_MASK(int, sv->process_status, mask, RPC_LOC_SV_INFO_VALID_PROCESS_STATUS),
+ CHECK_MASK(int, sv->has_eph, mask, RPC_LOC_SV_INFO_VALID_HAS_EPH),
+ CHECK_MASK(int, sv->has_alm, mask, RPC_LOC_SV_INFO_VALID_HAS_ALM),
+ CHECK_MASK(float, sv->elevation, mask, RPC_LOC_SV_INFO_VALID_ELEVATION),
+ CHECK_MASK(float, sv->azimuth, mask, RPC_LOC_SV_INFO_VALID_AZIMUTH),
+ CHECK_MASK(float, sv->snr, mask, RPC_LOC_SV_INFO_VALID_SNR)
+ );
+ }
+ }
+}
+
+/* Logs a callback event */
+int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ switch (loc_event)
+ {
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ log_satellite_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.gnss_report);
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ log_status_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.status_report);
+ break;
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ log_parsed_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.parsed_location_report);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask)
+{
+ return loc_get_name_from_mask(loc_event_name, loc_event_num,
+ (long) loc_event_mask);
+}
+
+/* Finds IOCTL type name */
+const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type)
+{
+ return loc_get_name_from_val(loc_ioctl_type_name, loc_ioctl_type_num,
+ (long) ioctl_type);
+}
+
+/* Finds IOCTL status name */
+const char* loc_get_ioctl_status_name(uint32 status)
+{
+ return loc_get_name_from_val(loc_ioctl_status_name, loc_ioctl_status_num,
+ (long) status);
+}
+
+/* Finds session status name */
+const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status)
+{
+ return loc_get_name_from_val(loc_sess_status_name, loc_sess_status_num,
+ (long) status);
+}
+
+/* Find engine state name */
+const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state)
+{
+ return loc_get_name_from_val(loc_engine_state_name, loc_engine_state_num,
+ (long) state);
+}
+
+/* Find engine state name */
+const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state)
+{
+ return loc_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num,
+ (long) state);
+}
+
+/* Event names */
+loc_name_val_s_type rpc_reset_event_name[] =
+{
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_BEGIN ),
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_END )
+};
+int rpc_reset_event_num = sizeof rpc_reset_event_name / sizeof(loc_name_val_s_type);
+
+const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event)
+{
+ return loc_get_name_from_val(rpc_reset_event_name, rpc_reset_event_num, event);
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
new file mode 100644
index 0000000..e0f400c
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
@@ -0,0 +1,636 @@
+/* Copyright (c) 2011-2012, 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 FILES FOR MODULE
+
+======================================================================*/
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <loc_api_log.h>
+
+#include <rpc/rpc.h>
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "rpc_inc/loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+#define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/* Logging Improvement */
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/* Uncomment to force ALOGD messages */
+// #define ALOGD ALOGI
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_MAX_CLIENTS 16
+typedef struct
+{
+ uint32 cb_id; /* same as rpc/types.h */
+ loc_event_cb_f_type *cb_func; /* callback func */
+ loc_reset_notif_cb_f_type *rpc_cb; /* callback from RPC */
+ rpc_loc_client_handle_type handle; /* stores handle for client closing */
+ void* user; /* user's own data handle */
+} loc_glue_cb_entry_s_type;
+
+loc_glue_cb_entry_s_type loc_glue_callback_table[LOC_API_CB_MAX_CLIENTS];
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) a ## v ## b
+#define RPC_CALLBACK_FUNC_VERSION(a,v,b) RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { EXIT_LOG_CALLFLOW(%d, RPC_LOC_API_RPC_FAILURE); return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { \
+ LOC_LOGE("%s:%d] failure code %d", __func__, __LINE__, stat); \
+ return (ret_type)((stat == RPC_SUBSYSTEM_RESTART) ? \
+ RPC_LOC_API_RPC_MODEM_RESTART : RPC_LOC_API_RPC_FAILURE); \
+ }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ // The lower word of cd_id is the index
+ int index = argp->cb_id & 0xFFFF;
+
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (index >= LOC_API_CB_MAX_CLIENTS || loc_glue_callback_table[index].cb_func == NULL)
+ {
+ LOC_LOGE("Warning: No callback handler %d.\n", index);
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOC_LOGV("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOC_LOGV("Callback received: %x (cb_id=%p handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ argp->cb_id,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ /* Gives control to synchronous call handler */
+ loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload);
+
+ int32 rc = (loc_glue_callback_table[index].cb_func)(loc_glue_callback_table[index].user,
+ loc_handle, loc_event, loc_event_payload);
+
+ LOC_LOGV("cb_func=%p", loc_glue_callback_table[index].cb_func);
+
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOC_LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+/*===========================================================================
+
+FUNCTION rpc_loc_event_cb_f_type_<version>_svc (MACRO)
+
+DESCRIPTION
+ Callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_event_cb_f_type_, RPC_LOC_EVENT_CB_F_TYPE_VERSION, _svc) (
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ return rpc_loc_event_cb_f_type_svc(argp, ret, req);
+}
+
+/*===========================================================================
+
+FUNCTION loc_apicbprog_<version>_freeresult (MACRO)
+
+DESCRIPTION
+ Free up RPC data structure
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+#define VERSION_CONCAT(MAJOR,MINOR) MAJOR##MINOR
+#define loc_apicb_prog_VER_freeresult(M,N) \
+int RPC_CALLBACK_FUNC_VERSION(loc_apicbprog_, VERSION_CONCAT(M,N), _freeresult) \
+(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) \
+{ \
+ return loc_apicbprog_freeresult(transp, xdr_result, result); \
+}
+
+/* Define all of the possible minors */
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0001);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0002);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0003);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0004);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0005);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+/*===========================================================================
+
+FUNCTION rpc_loc_api_cb_null_<version>_svc (MACRO) [Patch for wrong RPCGEN stubs]
+
+DESCRIPTION
+ Null callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+
+===========================================================================*/
+#define rpc_loc_api_cb_null_VER_svc(M,N) \
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_api_cb_null_, VERSION_CONCAT(M,N), _svc) ( \
+ void *a, int *b, struct svc_req *req) \
+{ \
+ return 1; \
+}
+
+/* Define all of the possible minors */
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0001);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0002);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0003);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0004);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0005);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+static void loc_api_glue_rpc_cb(CLIENT* client, enum rpc_reset_event event)
+{
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) {
+ if (NULL != loc_glue_callback_table[i].rpc_cb) {
+ loc_glue_callback_table[i].rpc_cb(loc_glue_callback_table[i].user, client, event);
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Initialize data */
+ int i;
+ int pid = getpid();
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ loc_glue_callback_table[i].cb_id = i | (pid << 16);
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].user = NULL;
+ }
+
+ /* Print msg */
+ LOC_LOGV("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOC_LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ LOC_LOGE("Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ loc_api_sync_call_init();
+
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOC_LOGD("Loc API RPC client initialized.\n");
+ clnt_register_reset_notification_cb(loc_api_clnt, loc_api_glue_rpc_cb);
+ }
+ else {
+ LOC_LOGE("Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_cb,
+ void* userData
+)
+{
+ int try_num = RPC_TRY_NUM;
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_client_handle_type ret_val;
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+
+ int i, j = LOC_API_CB_MAX_CLIENTS;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].user == userData)
+ {
+ LOC_LOGW("Client already opened service (callback=%p)...\n",
+ event_callback);
+ break;
+ } else if (j == LOC_API_CB_MAX_CLIENTS &&
+ loc_glue_callback_table[i].user == NULL) {
+ j = i;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ i = j;
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGE("Too many clients opened at once...\n");
+ return RPC_LOC_CLIENT_HANDLE_INVALID;
+ }
+
+ loc_glue_callback_table[i].cb_func = event_callback;
+ loc_glue_callback_table[i].rpc_cb = rpc_cb;
+ loc_glue_callback_table[i].user = userData;
+
+ args.event_callback = loc_glue_callback_table[i].cb_id;
+ LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client open");
+
+ /*try more for rpc_loc_open_xx()*/
+
+ do
+ {
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
+ ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
+ try_num--;
+
+ }while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num );
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ /* save the handle in the table */
+ loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
+
+ return ret_val;
+
+}
+
+int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client close");
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt);
+
+ loc_clear(handle);
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ ret_val = (int32) rets.loc_close_result;
+
+ return ret_val;
+}
+
+void loc_clear(rpc_loc_client_handle_type handle) {
+ /* Clean the client's callback function in callback table */
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].handle == handle)
+ {
+ /* Found the client */
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].user = NULL;
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGW("Handle not found (handle=%d)...\n", (int) handle);
+ }
+}
+
+int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc start fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_start_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc stop fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_stop_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ break;
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ break;
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ break;
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ break;
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, loc_get_ioctl_type_name(ioctl_type));
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_ioctl_result;
+
+ return ret_val;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ clnt_unregister_reset_notification_cb(loc_api_clnt);
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl
+
+DESCRIPTION
+ This function calls loc_ioctl and waits for the callback result before
+ returning back to the user.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS;
+
+ ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr);
+
+ LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, returt %s\n",
+ (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type),
+ loc_get_ioctl_status_name(ret_val) );
+
+ return ret_val;
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
new file mode 100644
index 0000000..ae629d7
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
@@ -0,0 +1,565 @@
+/* Copyright (c) 2011-2012, 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 <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include "loc_api_sync_call.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_slot_array_s_type loc_sync_data;
+
+pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
+boolean loc_sync_call_inited = 0;
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_init
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_init()
+{
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 1) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 1;
+
+ loc_sync_data.num_of_slots = LOC_SYNC_CALL_SLOTS_MAX;
+
+ int i;
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->not_available = 0;
+ slot->in_use = 0;
+ slot->loc_handle = -1;
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_destroy
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_destroy()
+{
+ int i;
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 0) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 0;
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->not_available = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ pthread_cond_destroy(&slot->loc_cb_arrived_cond);
+ pthread_mutex_destroy(&slot->lock);
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_match_callback
+
+DESCRIPTION
+ Checks if an awaited event has arrived
+
+RETURN VALUE
+ TRUE arrived
+ FALSE not matching
+
+===========================================================================*/
+static boolean loc_match_callback(
+ rpc_loc_event_mask_type wait_mask,
+ rpc_loc_ioctl_e_type wait_ioctl,
+ rpc_loc_event_mask_type event_mask,
+ const rpc_loc_event_payload_u_type *callback_payload
+)
+{
+ if ((event_mask & wait_mask) == 0) return FALSE;
+
+ if (event_mask != RPC_LOC_EVENT_IOCTL_REPORT || wait_ioctl == 0 ||
+ ( (callback_payload != NULL) &&
+ callback_payload->rpc_loc_event_payload_u_type_u.ioctl_report.type == wait_ioctl) )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_callback_process_sync_call
+
+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_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ int i;
+
+ ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->in_use &&
+ slot->signal_sent == 0 &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload))
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+
+ slot->loc_cb_received_event_mask = loc_event;
+
+ ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ slot->signal_sent = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+ break;
+ } else {
+ /* do nothing */
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_a_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_lock_a_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+ if (pthread_mutex_trylock(&slot->lock) == EBUSY)
+ {
+ ALOGV("trylock EBUSY : %d", i);
+ continue;
+ }
+
+ if (!slot->in_use && !slot->not_available)
+ {
+ select_id = i;
+ /* Return from here and leave the mutex locked.
+ * will unlock it in loc_unlock_slot()
+ */
+ break;
+ }
+ /* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_unlock_slot
+
+DESCRIPTION
+ Unlocks a buffer slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_unlock_slot(int select_id)
+{
+ pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_slot
+
+DESCRIPTION
+ Locks a specific slot that was previously locked from loc_lock_a_slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_lock_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_set_slot_in_use
+
+DESCRIPTION
+ Sets the in_use flag of slot to true or false.
+ Should be called only after the slot is locked
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_set_slot_in_use(int select_id, boolean in_use)
+{
+ loc_sync_data.slots[select_id].in_use = in_use;
+ if (in_use == 1)
+ loc_sync_data.slots[select_id].signal_sent = 0;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_save_callback
+
+DESCRIPTION
+ Selects which callback or IOCTL event to wait for.
+
+ The event_mask specifies the event(s). If it is RPC_LOC_EVENT_IOCTL_REPORT,
+ then ioctl_type specifies the IOCTL event.
+
+ If ioctl_type is non-zero, RPC_LOC_EVENT_IOCTL_REPORT is automatically added.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : out of buffer
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_api_save_callback(
+ int select_id, /* Selected slot */
+ rpc_loc_client_handle_type loc_handle, /* Client handle */
+ rpc_loc_event_mask_type event_mask, /* Event mask to wait for */
+ rpc_loc_ioctl_e_type ioctl_type /* IOCTL type to wait for */
+)
+{
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ slot->loc_handle = loc_handle;
+
+ slot->loc_cb_wait_event_mask = event_mask;
+ slot->ioctl_type = ioctl_type;
+ if (ioctl_type) slot->loc_cb_wait_event_mask |= RPC_LOC_EVENT_IOCTL_REPORT;
+
+ return;
+}
+
+/*===========================================================================
+
+FUNCTION loc_save_user_payload
+
+DESCRIPTION
+ Saves received payload into user data structures
+
+RETURN VALUE
+ None
+
+===========================================================================*/
+static void loc_save_user_payload(
+ rpc_loc_event_payload_u_type *user_cb_payload,
+ rpc_loc_ioctl_callback_s_type *user_ioctl_buffer,
+ const rpc_loc_event_payload_u_type *received_cb_payload
+)
+{
+ if (user_cb_payload)
+ {
+ memcpy(user_cb_payload, received_cb_payload,
+ sizeof (rpc_loc_event_payload_u_type));
+ }
+ if (user_ioctl_buffer)
+ {
+ memcpy(user_ioctl_buffer,
+ &received_cb_payload->rpc_loc_event_payload_u_type_u.ioctl_report,
+ sizeof *user_ioctl_buffer);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_wait_callback
+
+DESCRIPTION
+ Waits for a selected callback. The wait expires in timeout_seconds seconds.
+
+ If the function is called before an existing wait has finished, it will
+ immediately return EBUSY.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS if successful (0)
+ RPC_LOC_API_TIMEOUT if timed out
+ RPC_LOC_API_ENGINE_BUSY if already in a wait
+ RPC_LOC_API_INVALID_PARAMETER if callback is not yet selected
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_api_wait_callback(
+ int select_id, /* ID from loc_select_callback() */
+ int timeout_seconds, /* Timeout in this number of seconds */
+ rpc_loc_event_payload_u_type *callback_payload, /* Pointer to callback payload buffer, can be NULL */
+ rpc_loc_ioctl_callback_s_type *ioctl_payload /* Pointer to IOCTL payload, can be NULL */
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc = 0; /* return code from pthread calls */
+
+ struct timespec expire_time;
+
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ clock_gettime(CLOCK_REALTIME, &expire_time);
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Waiting */
+ while (slot->signal_sent == 0 && rc != ETIMEDOUT) {
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+ }
+
+ if (rc == ETIMEDOUT)
+ {
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ ALOGE("TIMEOUT: %d", select_id);
+ }
+ else {
+ /* Obtained the first awaited callback */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_ioctl
+
+DESCRIPTION
+ Synchronous IOCTL call (reentrant version)
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Loc API error code (0 = success)
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int rc = -1;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ select_id = loc_lock_a_slot();
+
+ if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
+ {
+ ALOGE("slot not available ioctl_type = %s",
+ loc_get_ioctl_type_name(ioctl_type));
+ return rc;
+ }
+
+ loc_set_slot_in_use(select_id, 1); // set slot in use to true
+
+ // Select the callback we are waiting for
+ loc_api_save_callback(select_id, handle, 0, ioctl_type);
+
+ loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true
+
+ // we want to avoid keeping the slot locked during the loc_ioctl because the rpc
+ // framework will also lock a different mutex during this call, and typically
+ // locking two different mutexes at the same time can lead to deadlock.
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+
+ loc_lock_slot(select_id);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else {
+ ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
+ select_id, ioctl_type);
+ // Wait for the callback of loc_ioctl
+ if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
+ {
+ // Callback waiting failed
+ ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else
+ {
+ if (cb_data_ptr) memcpy(cb_data_ptr, &callback_data, sizeof *cb_data_ptr);
+ if (callback_data.status != RPC_LOC_API_SUCCESS)
+ {
+ rc = callback_data.status;
+ ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ } else {
+ ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
+ select_id, ioctl_type, rc);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+
+ loc_set_slot_in_use(select_id, 0); // set slot in use to false
+ loc_unlock_slot(select_id);
+
+ return rc;
+}
+
+
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..db5b291
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
@@ -0,0 +1,86 @@
+/* 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.
+ */
+
+#include "rpc/rpc.h"
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+#include "rpc_inc/loc_api_fixup.h"
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+ svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ svrPort = NULL;
+}
+
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
new file mode 100644
index 0000000..c0987e6
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
@@ -0,0 +1,36 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# functions
+LOC_RPCGEN_APIS_PATH := $(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+LOC_RPCGEN_APIS_PATH_FL := ../../../../../$(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+
+LOCAL_MODULE := libloc_api_rpcgen
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_SHARED_LIBRARIES := \
+ librpc \
+ libcommondefs
+
+LOCAL_SRC_FILES += \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+LOCAL_C_INCLUDES += hardware/msm7k/librpc
+LOCAL_C_INCLUDES += $(LOC_RPCGEN_APIS_PATH)/../../SHARED_LIBRARIES/libcommondefs_intermediates/inc
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc
+
+LOCAL_COPY_HEADERS_TO := loc_api/rpcgen/inc
+LOCAL_COPY_HEADERS := inc/loc_api_rpcgen_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_common_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_cb_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_apicb_appinit.h
+
+LOCAL_LDLIBS += -lpthread
+LOCAL_PRELINK_MODULE := false
+include $(BUILD_STATIC_LIBRARY)
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
new file mode 100644
index 0000000..4ac8c8a
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
@@ -0,0 +1,42 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I./inc \
+ $(MSM7K_CFLAGS)
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ inc/loc_api_rpcgen_rpc.h \
+ inc/loc_api_rpcgen_common_rpc.h \
+ inc/loc_api_rpcgen_cb_rpc.h \
+ inc/loc_apicb_appinit.h
+
+c_sources = \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-stub/inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpcgen_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpcgen_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpcgen_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpcgen_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpcgen_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpcgen_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpcgen.la
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
new file mode 100644
index 0000000..87f2c37
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_RPC_H_RPCGEN
+#define _LOC_API_CB_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00050006
+
+#define LOC_APICBPROG 0x3100008C
+#define LOC_APICBVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001();
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc();
+extern int loc_apicbprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002();
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc();
+extern int loc_apicbprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003();
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc();
+extern int loc_apicbprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004();
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc();
+extern int loc_apicbprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005();
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc();
+extern int loc_apicbprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006();
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc();
+extern int loc_apicbprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_RPC_H_RPCGEN */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
new file mode 100644
index 0000000..8107de2
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
@@ -0,0 +1,1261 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_RPC_H_RPCGEN
+#define _LOC_API_COMMON_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040030
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_API_CB_NULL_VERSION 0x00050002
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00050001
+#define RPC_LOC_STOP_FIX_VERSION 0x00050001
+#define RPC_LOC_START_FIX_VERSION 0x00050001
+#define RPC_LOC_IOCTL_VERSION 0x00050001
+#define RPC_LOC_CLOSE_VERSION 0x00050001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001
+#define RPC_LOC_OPEN_VERSION 0x00050001
+#define RPC_LOC_API_NULL_VERSION 0x00050001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0005
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+typedef struct rpc_loc_server_addr_ipv6_type rpc_loc_server_addr_ipv6_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ rpc_loc_server_addr_ipv6_type ipv6;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+typedef struct rpc_loc_pos_inj_request_s_type rpc_loc_pos_inj_request_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET = 0 + 1,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216,
+};
+typedef enum rpc_loc_server_connection_e_type rpc_loc_server_connection_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+typedef struct rpc_loc_server_multi_open_req_s_type rpc_loc_server_multi_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP = 0 + 1,
+ RPC_LOC_SERVER_PDP_IPV6 = 0 + 2,
+ RPC_LOC_SERVER_PDP_IPV4V6 = 0 + 3,
+ RPC_LOC_SERVER_PDP_MAX = 268435456,
+};
+typedef enum rpc_loc_server_pdp_type_e_type rpc_loc_server_pdp_type_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_multi_open_status_s_type rpc_loc_server_multi_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456,
+};
+typedef enum rpc_loc_error_estimate_config_e_type rpc_loc_error_estimate_config_e_type;
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ char apn_name[100];
+};
+typedef struct rpc_loc_apn_profiles_type rpc_loc_apn_profiles_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_boolean data_enable;
+ rpc_uint32 supl_version;
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_uint32 supl_version;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type (XDR *, rpc_loc_server_addr_ipv6_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type (XDR *, rpc_loc_pos_inj_request_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_connection_e_type (XDR *, rpc_loc_server_connection_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (XDR *, rpc_loc_server_multi_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type (XDR *, rpc_loc_server_pdp_type_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (XDR *, rpc_loc_server_multi_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type (XDR *, rpc_loc_error_estimate_config_e_type*);
+extern bool_t xdr_rpc_loc_apn_profiles_type (XDR *, rpc_loc_apn_profiles_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_connection_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type ();
+extern bool_t xdr_rpc_loc_apn_profiles_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_RPC_H_RPCGEN */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
new file mode 100644
index 0000000..6138432
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
@@ -0,0 +1,288 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_RPC_H_RPCGEN
+#define _LOC_API_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00050006
+
+#define LOC_APIPROG 0x3000008C
+#define LOC_APIVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00050001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00050001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00050001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00050001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00050001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001();
+extern bool_t rpc_loc_api_null_0x00050001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001();
+extern bool_t rpc_loc_open_0x00050001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001();
+extern bool_t rpc_loc_close_0x00050001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001();
+extern bool_t rpc_loc_start_fix_0x00050001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001();
+extern bool_t rpc_loc_stop_fix_0x00050001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001();
+extern bool_t rpc_loc_ioctl_0x00050001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001();
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc();
+extern int loc_apiprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050002();
+extern bool_t rpc_loc_api_null_0x00050002_svc();
+extern int loc_apiprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050003(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050003_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050003();
+extern bool_t rpc_loc_api_null_0x00050003_svc();
+extern int loc_apiprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050004(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050004_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050004();
+extern bool_t rpc_loc_api_null_0x00050004_svc();
+extern int loc_apiprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050005(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050005_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050005();
+extern bool_t rpc_loc_api_null_0x00050005_svc();
+extern int loc_apiprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050006(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050006_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050006();
+extern bool_t rpc_loc_api_null_0x00050006_svc();
+extern int loc_apiprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_RPC_H_RPCGEN */
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..875c4f0
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* 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.
+ *
+ */
+
+/* Initialization function for callbacks */
+int loc_apicb_app_init();
+
+void loc_apicb_app_deinit();
+
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
new file mode 100644
index 0000000..2ef5852
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
@@ -0,0 +1,327 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00050001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00050001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00050001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00050001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050002(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050002_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050002_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050002_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050003(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050003_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050003_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050003_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050004(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050004_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050004_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050004_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050005(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050005_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050005_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050005_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050006(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050006_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050006_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050006_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
new file mode 100644
index 0000000..ad171dc
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
new file mode 100644
index 0000000..3e39576
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
@@ -0,0 +1,155 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api_rpcgen_rpc.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00050001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00050001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00050001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00050001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050003(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050004(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050005(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050006(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
new file mode 100644
index 0000000..21be8f4
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
@@ -0,0 +1,1775 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_common_rpc.h"
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv6_type (XDR *xdrs, rpc_loc_server_addr_ipv6_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_vector (xdrs, (char *)objp->addr, 8,
+ sizeof (rpc_uint16), (xdrproc_t) xdr_rpc_uint16))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ if (!xdr_rpc_loc_server_addr_ipv6_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv6))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_inj_request_s_type (XDR *xdrs, rpc_loc_pos_inj_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->position_uncertainty))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ if (!xdr_rpc_loc_pos_inj_request_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.pos_injection))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_e_type (XDR *xdrs, rpc_loc_server_connection_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_req_s_type (XDR *xdrs, rpc_loc_server_multi_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ if (!xdr_rpc_loc_server_connection_e_type (xdrs, &objp->connection_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ if (!xdr_rpc_loc_server_multi_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.multi_open_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_pdp_type_e_type (XDR *xdrs, rpc_loc_server_pdp_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_status_s_type (XDR *xdrs, rpc_loc_server_multi_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_rpc_loc_server_pdp_type_e_type (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_error_estimate_config_e_type (XDR *xdrs, rpc_loc_error_estimate_config_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_apn_profiles_type (XDR *xdrs, rpc_loc_apn_profiles_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint32 (xdrs, &objp->srv_system_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ if (!xdr_rpc_loc_error_estimate_config_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.error_estimate_config))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.data_enable))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_multi_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.multi_conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_callback_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
new file mode 100644
index 0000000..a0fdcab
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
@@ -0,0 +1,199 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_rpc.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..b469eb0
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ */
+#include "librpc.h"
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_0x00010001 */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+
+
+
+ if(svc_register(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+void loc_apicb_app_deinit(void)
+{
+
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+
+ svc_unregister(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001);
+}
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
new file mode 100644
index 0000000..82dca56
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
@@ -0,0 +1,261 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00050006 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050002;
+
+version LOC_APIVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050003;
+
+version LOC_APIVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050004;
+
+version LOC_APIVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APIVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050006;
+
+
+} = 0x3000008C;
+
+const LOC_APIVERS = 0x00050006;
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
new file mode 100644
index 0000000..4756c6c
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
@@ -0,0 +1,187 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00050006 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APICBVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050002;
+
+version LOC_APICBVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050003;
+
+version LOC_APICBVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050004;
+
+version LOC_APICBVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APICBVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050006;
+
+
+} = 0x3100008C;
+
+const LOC_APICBVERS = 0x00050006;
diff --git a/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
new file mode 100644
index 0000000..e059c66
--- /dev/null
+++ b/msm8909/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
@@ -0,0 +1,1021 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040030;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_API_CB_NULL_VERSION = 0x00050002;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00050001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00050001;
+const RPC_LOC_START_FIX_VERSION = 0x00050001;
+const RPC_LOC_IOCTL_VERSION = 0x00050001;
+const RPC_LOC_CLOSE_VERSION = 0x00050001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001;
+const RPC_LOC_OPEN_VERSION = 0x00050001;
+const RPC_LOC_API_NULL_VERSION = 0x00050001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0005;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[200];
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256];
+};
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ rpc_loc_server_addr_ipv6_type ipv6;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20];
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP,
+ RPC_LOC_SERVER_PDP_IPV6,
+ RPC_LOC_SERVER_PDP_IPV4V6,
+ RPC_LOC_SERVER_PDP_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100];
+};
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456
+};
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ rpc_boolean data_enable;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/msm8909/loc_api/libloc_api_50001/Android.mk b/msm8909/loc_api/libloc_api_50001/Android.mk
new file mode 100644
index 0000000..2353a37
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/Android.mk
@@ -0,0 +1,110 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_eng
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_nmea.cpp \
+ LocEngAdapter.cpp
+
+LOCAL_SRC_FILES += \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/libflp
+
+LOCAL_COPY_HEADERS_TO:= libloc_eng/
+LOCAL_COPY_HEADERS:= \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+## Libs
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_eng \
+ libloc_core \
+ libgps.utils \
+ libdl
+
+ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false)
+endif
+
+LOCAL_SRC_FILES += \
+ loc.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
+endif
+
+ifeq ($(TARGET_USES_QCOM_BSP), true)
+LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
+endif
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/libflp
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp
new file mode 100644
index 0000000..49d467a
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -0,0 +1,423 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_EngAdapter"
+
+#include <cutils/properties.h>
+#include <LocEngAdapter.h>
+#include "loc_eng_msg.h"
+#include "loc_log.h"
+
+using namespace loc_core;
+
+LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
+ LocAdapterBase(adapter->getMsgTask()),
+ mLocEngAdapter(adapter)
+{
+}
+void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
+ sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
+}
+void LocInternalAdapter::startFixInt() {
+ sendMsg(new LocEngStartFix(mLocEngAdapter));
+}
+void LocInternalAdapter::stopFixInt() {
+ sendMsg(new LocEngStopFix(mLocEngAdapter));
+}
+void LocInternalAdapter::getZppInt() {
+ sendMsg(new LocEngGetZpp(mLocEngAdapter));
+}
+
+LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ LocThread::tCreate tCreator) :
+ LocAdapterBase(mask,
+ //Get the AFW context if VzW context has not already been intialized in
+ //loc_ext
+ context == NULL?
+ LocDualContext::getLocFgContext(tCreator,
+ NULL,
+ LocDualContext::mLocationHalName,
+ false)
+ :context),
+ mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
+ mUlp(new UlpProxyBase()), mNavigating(false),
+ mSupportsAgpsRequests(false),
+ mSupportsPositionInjection(false),
+ mSupportsTimeInjection(false),
+ mPowerVote(0)
+{
+ memset(&mFixCriteria, 0, sizeof(mFixCriteria));
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ LOC_LOGD("LocEngAdapter created");
+}
+
+inline
+LocEngAdapter::~LocEngAdapter()
+{
+ delete mInternalAdapter;
+ LOC_LOGV("LocEngAdapter deleted");
+}
+
+void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
+ struct LocSetUlpProxy : public LocMsg {
+ LocAdapterBase* mAdapter;
+ UlpProxyBase* mUlp;
+ inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
+ LocMsg(), mAdapter(adapter), mUlp(ulp) {
+ }
+ virtual void proc() const {
+ LOC_LOGV("%s] ulp %p adapter %p", __func__,
+ mUlp, mAdapter);
+ mAdapter->setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
+}
+
+void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ if (ulp == mUlp) {
+ //This takes care of the case when double initalization happens
+ //and we get the same object back for UlpProxyBase . Do nothing
+ return;
+ }
+
+ LOC_LOGV("%s] %p", __func__, ulp);
+ if (NULL == ulp) {
+ LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__);
+ ulp = new UlpProxyBase();
+ }
+
+ if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) {
+ // need to send this mode and start msg to ULP
+ ulp->sendFixMode(mUlp->mPosMode);
+ }
+
+ if(mUlp->mFixSet) {
+ ulp->sendStartFix();
+ }
+
+ delete mUlp;
+ mUlp = ulp;
+}
+
+int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask)
+{
+ struct LocEngAdapterGpsLock : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LOC_GPS_LOCK_MASK mLockMask;
+ inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) :
+ LocMsg(), mAdapter(adapter), mLockMask(lockMask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setGpsLock(mLockMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+ };
+ sendMsg(new LocEngAdapterGpsLock(this, lockMask));
+ return 0;
+}
+
+void LocEngAdapter::requestPowerVote()
+{
+ if (getPowerVoteRight()) {
+ /* Power voting without engine lock:
+ * 101: vote down, 102-104 - vote up
+ * These codes are used not to confuse with actual engine lock
+ * functionality, that can't be used in SSR scenario, as it
+ * conflicts with initialization sequence.
+ */
+ bool powerUp = getPowerVote();
+ LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp);
+ setGpsLock(powerUp ? 103 : 101);
+ }
+}
+
+void LocInternalAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ sendMsg(new LocEngReportPosition(mLocEngAdapter,
+ location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask));
+}
+
+
+void LocEngAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ if (! mUlp->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask )) {
+ mInternalAdapter->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask);
+ }
+}
+
+void LocInternalAdapter::reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt){
+ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
+ locationExtended, svExt));
+}
+
+void LocEngAdapter::reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+
+ // We want to send SV info to ULP to help it in determining GNSS
+ // signal strength ULP will forward the SV reports to HAL without
+ // any modifications
+ if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
+ mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
+ }
+}
+
+void LocEngAdapter::setInSession(bool inSession)
+{
+ mNavigating = inSession;
+ mLocApi->setInSession(inSession);
+ if (!mNavigating) {
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ }
+}
+
+void LocInternalAdapter::reportStatus(GpsStatusValue status)
+{
+ sendMsg(new LocEngReportStatus(mLocEngAdapter, status));
+}
+
+void LocEngAdapter::reportStatus(GpsStatusValue status)
+{
+ if (!mUlp->reportStatus(status)) {
+ mInternalAdapter->reportStatus(status);
+ }
+}
+
+inline
+void LocEngAdapter::reportNmea(const char* nmea, int length)
+{
+ sendMsg(new LocEngReportNmea(mOwner, nmea, length));
+}
+
+inline
+bool LocEngAdapter::reportXtraServer(const char* url1,
+ const char* url2,
+ const char* url3,
+ const int maxlength)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReportXtraServer(mOwner, url1,
+ url2, url3, maxlength));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestATL(mOwner,
+ connHandle, agps_type));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::releaseATL(int connHandle)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReleaseATL(mOwner, connHandle));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestXtraData()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestXtra(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestTime()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestTime(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data)
+{
+ if (mSupportsAgpsRequests) {
+ notif.size = sizeof(notif);
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ sendMsg(new LocEngRequestNi(mOwner, notif, data));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestSuplES(int connHandle)
+{
+ if (mSupportsAgpsRequests)
+ sendMsg(new LocEngRequestSuplEs(mOwner, connHandle));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallOpened()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsOpened(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallClosed()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsClosed(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+void LocEngAdapter::handleEngineDownEvent()
+{
+ sendMsg(new LocEngDown(mOwner));
+}
+
+inline
+void LocEngAdapter::handleEngineUpEvent()
+{
+ sendMsg(new LocEngUp(mOwner));
+}
+
+enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty)
+{
+ loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d",
+ __func__, __LINE__, mSupportsTimeInjection);
+
+ if (mSupportsTimeInjection) {
+ LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
+ result = mLocApi->setTime(time, timeReference, uncertainty);
+ }
+ return result;
+}
+
+enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
+{
+ enum loc_api_adapter_err ret;
+ ENTRY_LOG();
+ enum xtra_version_check eCheck;
+ switch (check) {
+ case 0:
+ eCheck = DISABLED;
+ break;
+ case 1:
+ eCheck = AUTO;
+ break;
+ case 2:
+ eCheck = XTRA2;
+ break;
+ case 3:
+ eCheck = XTRA3;
+ break;
+ default:
+ eCheck = DISABLED;
+ }
+ ret = mLocApi->setXtraVersionCheck(eCheck);
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+void LocEngAdapter::reportGnssMeasurementData(GnssData &gnssMeasurementData)
+{
+ sendMsg(new LocEngReportGnssMeasurement(mOwner,
+ gnssMeasurementData));
+}
+
+/*
+ Update Registration Mask
+ */
+void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+{
+ LOC_LOGD("entering %s", __func__);
+ int result = LOC_API_ADAPTER_ERR_FAILURE;
+ result = mLocApi->updateRegistrationMask(event, isEnabled);
+ if (result == LOC_API_ADAPTER_ERR_SUCCESS) {
+ LOC_LOGD("%s] update registration mask succeed.", __func__);
+ } else {
+ LOC_LOGE("%s] update registration mask failed.", __func__);
+ }
+}
+
+/*
+ Set Gnss Constellation Config
+ */
+bool LocEngAdapter::gnssConstellationConfig()
+{
+ LOC_LOGD("entering %s", __func__);
+ bool result = false;
+ result = mLocApi->gnssConstellationConfig();
+ return result;
+}
diff --git a/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h
new file mode 100644
index 0000000..6666860
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -0,0 +1,355 @@
+/* Copyright (c) 2011-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_API_ENG_ADAPTER_H
+#define LOC_API_ENG_ADAPTER_H
+
+#include <ctype.h>
+#include <hardware/gps.h>
+#include <loc.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <platform_lib_includes.h>
+
+#define MAX_URL_LEN 256
+
+using namespace loc_core;
+
+class LocEngAdapter;
+
+class LocInternalAdapter : public LocAdapterBase {
+ LocEngAdapter* mLocEngAdapter;
+public:
+ LocInternalAdapter(LocEngAdapter* adapter);
+
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void setPositionModeInt(LocPosMode& posMode);
+ virtual void startFixInt();
+ virtual void stopFixInt();
+ virtual void getZppInt();
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+};
+
+typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
+
+class LocEngAdapter : public LocAdapterBase {
+ void* mOwner;
+ LocInternalAdapter* mInternalAdapter;
+ UlpProxyBase* mUlp;
+ LocPosMode mFixCriteria;
+ bool mNavigating;
+ // mPowerVote is encoded as
+ // mPowerVote & 0x20 -- powerVoteRight
+ // mPowerVote & 0x10 -- power On / Off
+ unsigned int mPowerVote;
+ static const unsigned int POWER_VOTE_RIGHT = 0x20;
+ static const unsigned int POWER_VOTE_VALUE = 0x10;
+
+public:
+ bool mSupportsAgpsRequests;
+ bool mSupportsPositionInjection;
+ bool mSupportsTimeInjection;
+ GnssSystemInfo mGnssInfo;
+
+ LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ LocThread::tCreate tCreator);
+ virtual ~LocEngAdapter();
+
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ void setXtraUserAgent();
+ inline void requestUlp(unsigned long capabilities) {
+ mContext->requestUlp(mInternalAdapter, capabilities);
+ }
+ inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
+ inline UlpProxyBase* getUlpProxy() { return mUlp; }
+ inline void* getOwner() { return mOwner; }
+ inline bool hasAgpsExtendedCapabilities() {
+ return mContext->hasAgpsExtendedCapabilities();
+ }
+ inline bool hasCPIExtendedCapabilities() {
+ return mContext->hasCPIExtendedCapabilities();
+ }
+ inline bool hasNativeXtraClient() {
+ return mContext->hasNativeXtraClient();
+ }
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+
+ inline enum loc_api_adapter_err
+ startFix()
+ {
+ return mLocApi->startFix(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ stopFix()
+ {
+ return mLocApi->stopFix();
+ }
+ inline enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f)
+ {
+ return mLocApi->deleteAidingData(f);
+ }
+ inline enum loc_api_adapter_err
+ enableData(int enable)
+ {
+ return mLocApi->enableData(enable);
+ }
+ inline enum loc_api_adapter_err
+ setAPN(char* apn, int len)
+ {
+ return mLocApi->setAPN(apn, len);
+ }
+ inline enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy)
+ {
+ return mLocApi->injectPosition(latitude, longitude, accuracy);
+ }
+ inline enum loc_api_adapter_err
+ setXtraData(char* data, int length)
+ {
+ return mLocApi->setXtraData(data, length);
+ }
+ inline enum loc_api_adapter_err
+ requestXtraServer()
+ {
+ return mLocApi->requestXtraServer();
+ }
+ inline enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+ {
+ return mLocApi->atlOpenStatus(handle, is_succ, apn, bearer, agpsType);
+ }
+ inline enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ)
+ {
+ return mLocApi->atlCloseStatus(handle, is_succ);
+ }
+ inline enum loc_api_adapter_err
+ setPositionMode(const LocPosMode *posMode)
+ {
+ if (NULL != posMode) {
+ mFixCriteria = *posMode;
+ }
+ return mLocApi->setPositionMode(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ setServer(const char* url, int len)
+ {
+ return mLocApi->setServer(url, len);
+ }
+ inline enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+ {
+ return mLocApi->setServer(ip, port, type);
+ }
+ inline enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData)
+ {
+ return mLocApi->informNiResponse(userResponse, passThroughData);
+ }
+ inline enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version)
+ {
+ return mLocApi->setSUPLVersion(version);
+ }
+ inline enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile)
+ {
+ return mLocApi->setLPPConfig(profile);
+ }
+ inline enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider)
+ {
+ return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider);
+ }
+ inline enum loc_api_adapter_err
+ setSensorProperties(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)
+ {
+ return mLocApi->setSensorProperties(gyroBiasVarianceRandomWalk_valid, gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid, angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid, rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid, velocityBiasVarianceRandomWalk);
+ }
+ inline virtual enum loc_api_adapter_err
+ setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
+ {
+ return mLocApi->setSensorPerfControlConfig(controlMode, accelSamplesPerBatch, accelBatchesPerSec,
+ gyroSamplesPerBatch, gyroBatchesPerSec,
+ accelSamplesPerBatchHigh, accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
+ algorithmConfig);
+ }
+ inline virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging)
+ {
+ return mLocApi->setExtPowerConfig(isBatteryCharging);
+ }
+ inline virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+ {
+ return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
+ }
+ inline virtual int initDataServiceClient()
+ {
+ return mLocApi->initDataServiceClient();
+ }
+ inline virtual int openAndStartDataCall()
+ {
+ return mLocApi->openAndStartDataCall();
+ }
+ inline virtual void stopDataCall()
+ {
+ mLocApi->stopDataCall();
+ }
+ inline virtual void closeDataCall()
+ {
+ mLocApi->closeDataCall();
+ }
+ inline enum loc_api_adapter_err
+ getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
+ {
+ return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
+ }
+ enum loc_api_adapter_err setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty);
+ enum loc_api_adapter_err setXtraVersionCheck(int check);
+ inline virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+ {
+ mLocApi->installAGpsCert(pData, length, slotBitMask);
+ }
+ virtual void handleEngineDownEvent();
+ virtual void handleEngineUpEvent();
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
+
+ inline const LocPosMode& getPositionMode() const
+ {return mFixCriteria;}
+ inline virtual bool isInSession()
+ { return mNavigating; }
+ void setInSession(bool inSession);
+
+ // Permit/prohibit power voting
+ inline void setPowerVoteRight(bool powerVoteRight) {
+ mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) :
+ (mPowerVote & ~POWER_VOTE_RIGHT);
+ }
+ inline bool getPowerVoteRight() const {
+ return (mPowerVote & POWER_VOTE_RIGHT) != 0 ;
+ }
+ // Set the power voting up/down and do actual operation if permitted
+ inline void setPowerVote(bool powerOn) {
+ mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) :
+ (mPowerVote & ~POWER_VOTE_VALUE);
+ requestPowerVote();
+ mContext->modemPowerVote(powerOn);
+ }
+ inline bool getPowerVote() const {
+ return (mPowerVote & POWER_VOTE_VALUE) != 0 ;
+ }
+ // Do power voting according to last settings if permitted
+ void requestPowerVote();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ inline int setGpsLock(LOC_GPS_LOCK_MASK lock)
+ {
+ return mLocApi->setGpsLock(lock);
+ }
+
+ int setGpsLockMsg(LOC_GPS_LOCK_MASK lock);
+
+ /*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+ */
+ inline int getGpsLock()
+ {
+ return mLocApi->getGpsLock();
+ }
+
+ /*
+ Update Registration Mask
+ */
+ void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+
+ /*
+ Set Gnss Constellation Config
+ */
+ bool gnssConstellationConfig();
+};
+
+#endif //LOC_API_ENG_ADAPTER_H
diff --git a/msm8909/loc_api/libloc_api_50001/Makefile.am b/msm8909/loc_api/libloc_api_50001/Makefile.am
new file mode 100644
index 0000000..2374357
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/Makefile.am
@@ -0,0 +1,76 @@
+AM_CFLAGS = \
+ -I../../utils \
+ -I../../platform_lib_abstractions \
+ -fno-short-enums \
+ -DFEATURE_GNSS_BIT_API
+
+libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp
+
+if USE_GLIB
+libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la
+
+
+libloc_eng_so_la_SOURCES = \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+
+if USE_GLIB
+libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_eng_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la
+
+
+libgps_default_so_la_SOURCES = \
+ loc.cpp \
+ gps.c
+
+if USE_GLIB
+libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_default_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la
+
+library_include_HEADERS = \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+library_includedir = $(pkgincludedir)/libloc_api_50001
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la
diff --git a/msm8909/loc_api/libloc_api_50001/gps.c b/msm8909/loc_api/libloc_api_50001/gps.c
new file mode 100644
index 0000000..29f20f4
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/gps.c
@@ -0,0 +1,73 @@
+/* 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 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 <hardware/gps.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
+
+ if(dev == NULL)
+ return -1;
+
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = 1,
+ .hal_api_version = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/msm8909/loc_api/libloc_api_50001/loc.cpp b/msm8909/loc_api/libloc_api_50001/loc.cpp
new file mode 100644
index 0000000..dbb3242
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc.cpp
@@ -0,0 +1,1083 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_afw"
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_eng.h>
+#include <loc_target.h>
+#include <loc_log.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <LocDualContext.h>
+#include <cutils/properties.h>
+
+using namespace loc_core;
+
+#define LOC_PM_CLIENT_NAME "GPS"
+
+//Globals defns
+static gps_location_callback gps_loc_cb = NULL;
+static gps_sv_status_callback gps_sv_cb = NULL;
+
+static void local_loc_cb(UlpLocation* location, void* locExt);
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
+
+static const GpsGeofencingInterface* get_geofence_interface(void);
+
+// Function declarations for sLocEngInterface
+static int loc_init(GpsCallbacks* callbacks);
+static int loc_start();
+static int loc_stop();
+static void loc_cleanup();
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_inject_location(double latitude, double longitude, float accuracy);
+static void loc_delete_aiding_data(GpsAidingData f);
+static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy,
+ uint32_t preferred_time);
+static const void* loc_get_extension(const char* name);
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_init,
+ loc_start,
+ loc_stop,
+ loc_cleanup,
+ loc_inject_time,
+ loc_inject_location,
+ loc_delete_aiding_data,
+ loc_set_position_mode,
+ loc_get_extension
+};
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_agps_init(AGpsCallbacks* callbacks);
+static int loc_agps_open(const char* apn);
+static int loc_agps_closed();
+static int loc_agps_open_failed();
+static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType);
+
+static const AGpsInterface sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface),
+ loc_agps_init,
+ loc_agps_open,
+ loc_agps_closed,
+ loc_agps_open_failed,
+ loc_agps_set_server,
+ loc_agps_open_with_apniptype
+};
+
+static int loc_xtra_init(GpsXtraCallbacks* callbacks);
+static int loc_xtra_inject_data(char* data, int length);
+
+static const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ loc_xtra_init,
+ loc_xtra_inject_data
+};
+
+static void loc_ni_init(GpsNiCallbacks *callbacks);
+static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+static const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_ni_init,
+ loc_ni_respond,
+};
+
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks);
+static void loc_gps_measurement_close();
+
+static const GpsMeasurementInterface sLocEngGpsMeasurementInterface =
+{
+ sizeof(GpsMeasurementInterface),
+ loc_gps_measurement_init,
+ loc_gps_measurement_close
+};
+
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
+static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
+
+static const AGpsRilInterface sLocEngAGpsRilInterface =
+{
+ sizeof(AGpsRilInterface),
+ loc_agps_ril_init,
+ loc_agps_ril_set_ref_location,
+ loc_agps_ril_set_set_id,
+ loc_agps_ril_ni_message,
+ loc_agps_ril_update_network_state,
+ loc_agps_ril_update_network_availability
+};
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length);
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length);
+
+static const SuplCertificateInterface sLocEngAGpsCertInterface =
+{
+ sizeof(SuplCertificateInterface),
+ loc_agps_install_certificates,
+ loc_agps_revoke_certificates
+};
+
+static void loc_configuration_update(const char* config_data, int32_t length);
+
+static const GnssConfigurationInterface sLocEngConfigInterface =
+{
+ sizeof(GnssConfigurationInterface),
+ loc_configuration_update
+};
+
+static loc_eng_data_s_type loc_afw_data;
+static int gss_fd = -1;
+static int sGnssType = GNSS_UNKNOWN;
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ ENTRY_LOG_CALLFLOW();
+ const GpsInterface* ret_val;
+
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ loc_eng_read_config();
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ ret_val = NULL;
+ } else {
+ ret_val = &sLocEngInterface;
+ }
+
+ loc_eng_read_config();
+
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ unsigned int target = TARGET_DEFAULT;
+ loc_eng_read_config();
+
+ target = loc_get_target();
+ LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
+
+ sGnssType = getTargetGnssType(target);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ //APQ8064
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ gss_fd = open("/dev/gss", O_RDONLY);
+ if (gss_fd < 0) {
+ LOC_LOGE("GSS open failed: %s\n", strerror(errno));
+ }
+ else {
+ LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
+ gps_conf.CAPABILITIES);
+ }
+ break;
+ case GNSS_NONE:
+ //MPQ8064
+ LOC_LOGE("No GPS HW on this target. Not returning interface.");
+ return NULL;
+ case GNSS_QCA1530:
+ // qca1530 chip is present
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ LOC_LOGD("qca1530 present: CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
+ break;
+ }
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/Ax
+
+===========================================================================*/
+static int loc_init(GpsCallbacks* callbacks)
+{
+ int retVal = -1;
+ ENTRY_LOG();
+ LOC_API_ADAPTER_EVENT_MASK_T event;
+
+ if (NULL == callbacks) {
+ LOC_LOGE("loc_init failed. cb = NULL\n");
+ EXIT_LOG(%d, retVal);
+ return retVal;
+ }
+
+ event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
+ callbacks->status_cb, /* status_cb */
+ local_sv_cb, /* sv_status_cb */
+ callbacks->nmea_cb, /* nmea_cb */
+ callbacks->set_capabilities_cb, /* set_capabilities_cb */
+ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
+ callbacks->release_wakelock_cb, /* release_wakelock_cb */
+ callbacks->create_thread_cb, /* create_thread_cb */
+ NULL, /* location_ext_parser */
+ NULL, /* sv_ext_parser */
+ callbacks->request_utc_time_cb, /* request_utc_time_cb */
+ callbacks->set_system_info_cb, /* set_system_info_cb */
+ callbacks->gnss_sv_status_cb, /* gnss_sv_status_cb */
+ };
+
+ gps_loc_cb = callbacks->location_cb;
+ gps_sv_cb = callbacks->sv_status_cb;
+
+ retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
+ loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities()
+ && !loc_afw_data.adapter->hasNativeXtraClient();
+ loc_afw_data.adapter->setGpsLockMsg(0);
+ loc_afw_data.adapter->requestUlp(ContextBase::getCarrierCapabilities());
+
+ if(retVal) {
+ LOC_LOGE("loc_eng_init() fail!");
+ goto err;
+ }
+
+ loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530);
+ loc_afw_data.adapter->setPowerVote(true);
+
+ LOC_LOGD("loc_eng_init() success!");
+
+err:
+ EXIT_LOG(%d, retVal);
+ return retVal;
+}
+
+/*===========================================================================
+FUNCTION loc_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_cleanup()
+{
+ ENTRY_LOG();
+
+ loc_afw_data.adapter->setPowerVote(false);
+ loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK);
+
+ loc_eng_cleanup(loc_afw_data);
+ gps_loc_cb = NULL;
+ gps_sv_cb = NULL;
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_start()
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_start(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_stop()
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ ret_val = loc_eng_stop(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_set_position_mode(GpsPositionMode mode,
+ GpsPositionRecurrence recurrence,
+ uint32_t min_interval,
+ uint32_t preferred_accuracy,
+ uint32_t preferred_time)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ LocPositionMode locMode;
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ locMode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ locMode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ locMode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+
+ LocPosMode params(locMode, recurrence, min_interval,
+ preferred_accuracy, preferred_time, NULL, NULL);
+ ret_val = loc_eng_set_position_mode(loc_afw_data, params);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG();
+ int ret_val = 0;
+
+ ret_val = loc_eng_inject_time(loc_afw_data, time,
+ timeReference, uncertainty);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_inject_location(double latitude, double longitude, float accuracy)
+{
+ ENTRY_LOG();
+
+ int ret_val = 0;
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_delete_aiding_data(GpsAidingData f)
+{
+ ENTRY_LOG();
+
+#ifndef TARGET_BUILD_VARIANT_USER
+ loc_eng_delete_aiding_data(loc_afw_data, f);
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+const GpsGeofencingInterface* get_geofence_interface(void)
+{
+ ENTRY_LOG();
+ void *handle;
+ const char *error;
+ typedef const GpsGeofencingInterface* (*get_gps_geofence_interface_function) (void);
+ get_gps_geofence_interface_function get_gps_geofence_interface;
+ static const GpsGeofencingInterface* geofence_interface = NULL;
+
+ dlerror(); /* Clear any existing error */
+
+ handle = dlopen ("libgeofence.so", RTLD_NOW);
+
+ if (!handle)
+ {
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlopen for libgeofence.so failed, error = %s\n", __func__, error);
+ }
+ goto exit;
+ }
+ dlerror(); /* Clear any existing error */
+ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
+ if ((error = dlerror()) != NULL || NULL == get_gps_geofence_interface) {
+ LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
+ goto exit;
+ }
+
+ geofence_interface = get_gps_geofence_interface();
+
+exit:
+ EXIT_LOG(%d, geofence_interface == NULL);
+ return geofence_interface;
+}
+/*===========================================================================
+FUNCTION loc_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* loc_get_extension(const char* name)
+{
+ ENTRY_LOG();
+ const void* ret_val = NULL;
+
+ LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsInterface;
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngNiInterface;
+ }
+ else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
+ {
+ char baseband[PROPERTY_VALUE_MAX];
+ property_get("ro.baseband", baseband, "msm");
+ if (strcmp(baseband, "csfb") == 0)
+ {
+ ret_val = &sLocEngAGpsRilInterface;
+ }
+ }
+ else if (strcmp(name, GPS_GEOFENCING_INTERFACE) == 0)
+ {
+ if ((gps_conf.CAPABILITIES | GPS_CAPABILITY_GEOFENCING) == gps_conf.CAPABILITIES ){
+ ret_val = get_geofence_interface();
+ }
+ }
+ else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsCertInterface;
+ }
+ else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngConfigInterface;
+ }
+ else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngGpsMeasurementInterface;
+ }
+ else
+ {
+ LOC_LOGE ("get_extension: Invalid interface passed in\n");
+ }
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_init(AGpsCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_agps_init(loc_afw_data, (AGpsExtCallbacks*)callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open(const char* apn)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType = AGPS_APN_BEARER_IPV4;
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_with_apniptype
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType;
+
+ switch (apnIpType) {
+ case APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_closed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_agps_open_failed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_set_server
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ LocServerType serverType;
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ break;
+ case AGPS_TYPE_C2K:
+ serverType = LOC_AGPS_CDMA_PDE_SERVER;
+ break;
+ default:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ }
+ int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTIONf571
+ loc_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ GpsXtraExtCallbacks extCallbacks;
+ memset(&extCallbacks, 0, sizeof(extCallbacks));
+ extCallbacks.download_request_cb = callbacks->download_request_cb;
+ int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_xtra_inject_data
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_inject_data(char* data, int length)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE))
+ ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
+ else
+ LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d",
+ __func__, data, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_init
+
+DESCRIPTION
+ This function initializes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_gps_measurement_init(loc_afw_data,
+ callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_close
+
+DESCRIPTION
+ This function closes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_gps_measurement_close()
+{
+ ENTRY_LOG();
+ loc_eng_gps_measurement_close(loc_afw_data);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_init(GpsNiCallbacks *callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG();
+ loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+// Below stub functions are members of sLocEngAGpsRilInterface
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {}
+
+/*===========================================================================
+FUNCTION loc_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_ril_update_network_availability(int available, const char* apn)
+{
+ ENTRY_LOG();
+ loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length)
+{
+ ENTRY_LOG();
+ LOC_LOGE("%s:%d]: agps_revoke_certificates not supported",__func__, __LINE__);
+ int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static void loc_configuration_update(const char* config_data, int32_t length)
+{
+ ENTRY_LOG();
+ loc_eng_configuration_update(loc_afw_data, config_data, length);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ case GNSS_QCA1530:
+ //APQ
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ break;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_loc_cb(UlpLocation* location, void* locExt)
+{
+ ENTRY_LOG();
+ if (NULL != location) {
+ CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
+
+ if (NULL != gps_loc_cb) {
+ gps_loc_cb(&location->gpsLocation);
+ }
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
+{
+ ENTRY_LOG();
+ if (NULL != gps_sv_cb) {
+ CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
+ gps_sv_cb(sv_status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc.h b/msm8909/loc_api/libloc_api_50001/loc.h
new file mode 100644
index 0000000..04a7b61
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2011,2014,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_H__
+#define __LOC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/
+
+typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
+typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
+typedef void* (*loc_ext_parser)(void* data);
+
+typedef struct {
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ gps_request_utc_time request_utc_time_cb;
+ gnss_set_system_info set_system_info_cb;
+ gnss_sv_status_callback gnss_sv_status_cb;
+} LocCallbacks;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_H__
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
new file mode 100644
index 0000000..98a3c49
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
@@ -0,0 +1,3024 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <time.h>
+#include <new>
+#include <LocEngAdapter.h>
+
+#include <cutils/sched_policy.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+#include <glib.h>
+#include <sys/syscall.h>
+#endif /* USE_GLIB */
+
+#include <string.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_dmn_conn.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_msg.h>
+#include <loc_eng_nmea.h>
+#include <msg_q.h>
+#include <loc.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_core_log.h"
+#include "loc_eng_log.h"
+
+#define SUCCESS TRUE
+#define FAILURE FALSE
+
+#ifndef GPS_CONF_FILE
+#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
+#endif
+
+#ifndef SAP_CONF_FILE
+#define SAP_CONF_FILE "/etc/sap.conf"
+#endif
+
+#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net"
+
+using namespace loc_core;
+
+boolean configAlreadyRead = false;
+unsigned int agpsStatus = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type gps_conf_table[] =
+{
+ {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'},
+ {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
+ {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+ {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
+ {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'},
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
+ {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
+ {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'},
+ {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'},
+ {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'},
+ {"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
+};
+
+static const loc_param_s_type sap_conf_table[] =
+{
+ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'}
+};
+
+static void loc_default_parameters(void)
+{
+ /*Defaults for gps.conf*/
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.NMEA_PROVIDER = 0;
+ gps_conf.GPS_LOCK = 0;
+ gps_conf.SUPL_VER = 0x10000;
+ gps_conf.SUPL_MODE = 0x3;
+ gps_conf.CAPABILITIES = 0x7;
+ /* LTE Positioning Profile configuration is disable by default*/
+ gps_conf.LPP_PROFILE = 0;
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+ /*XTRA version check is disabled by default*/
+ gps_conf.XTRA_VERSION_CHECK=0;
+ /*Use emergency PDN by default*/
+ gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
+
+ /*Defaults for sap.conf*/
+ sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ sap_conf.SENSOR_USAGE = 0; /* Enabled */
+ sap_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 */
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ /* default provider is SSC */
+ sap_conf.SENSOR_PROVIDER = 1;
+
+ /* None of the 10 slots for agps certificates are writable by default */
+ gps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+}
+
+// 2nd half of init(), singled out for
+// modem restart to use.
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
+
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+// Internal functions
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_report_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_process_conn_request(loc_eng_data_s_type &loc_eng_data,
+ int connHandle, AGpsType agps_type);
+static void loc_eng_agps_close_status(loc_eng_data_s_type &loc_eng_data, int is_succ);
+static void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data) ;
+static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
+static void deleteAidingData(loc_eng_data_s_type &logEng);
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
+static int dataCallCb(void *cb_data);
+static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ loc_eng_data.adapter->deleteAidingData(loc_eng_data.aiding_data_for_deletion);
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+}
+
+static void* noProc(void* data)
+{
+ return NULL;
+}
+
+/*********************************************************************
+ * definitions of the static messages used in the file
+ *********************************************************************/
+// case LOC_ENG_MSG_REQUEST_NI:
+LocEngRequestNi::LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data) :
+ LocMsg(), mLocEng(locEng), mNotify(notif), mPayload(data) {
+ locallog();
+}
+void LocEngRequestNi::proc() const {
+ loc_eng_ni_request_handler(*((loc_eng_data_s_type*)mLocEng),
+ &mNotify, mPayload);
+}
+void LocEngRequestNi::locallog() const
+{
+ LOC_LOGV("id: %d\n type: %s\n flags: %d\n time out: %d\n "
+ "default response: %s\n requestor id encoding: %s\n"
+ " text encoding: %s\n passThroughData: %p",
+ mNotify.notification_id,
+ loc_get_ni_type_name(mNotify.ni_type),
+ mNotify.notify_flags,
+ mNotify.timeout,
+ loc_get_ni_response_name(mNotify.default_response),
+ loc_get_ni_encoding_name(mNotify.requestor_id_encoding),
+ loc_get_ni_encoding_name(mNotify.text_encoding),
+ mPayload);
+}
+inline void LocEngRequestNi::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_INFORM_NI_RESPONSE:
+// in loc_eng_ni.cpp
+
+// case LOC_ENG_MSG_START_FIX:
+LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStartFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_start_handler(*locEng);
+}
+inline void LocEngStartFix::locallog() const
+{
+ LOC_LOGV("LocEngStartFix");
+}
+inline void LocEngStartFix::log() const
+{
+ locallog();
+}
+void LocEngStartFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_STOP_FIX:
+LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStopFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_stop_handler(*locEng);
+}
+inline void LocEngStopFix::locallog() const
+{
+ LOC_LOGV("LocEngStopFix");
+}
+inline void LocEngStopFix::log() const
+{
+ locallog();
+}
+void LocEngStopFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_POSITION_MODE:
+LocEngPositionMode::LocEngPositionMode(LocEngAdapter* adapter,
+ LocPosMode &mode) :
+ LocMsg(), mAdapter(adapter), mPosMode(mode)
+{
+ mPosMode.logv();
+}
+inline void LocEngPositionMode::proc() const {
+ mAdapter->setPositionMode(&mPosMode);
+}
+inline void LocEngPositionMode::log() const {
+ mPosMode.logv();
+}
+void LocEngPositionMode::send() const {
+ mAdapter->sendMsg(this);
+}
+
+LocEngGetZpp::LocEngGetZpp(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngGetZpp::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_get_zpp_handler(*locEng);
+}
+inline void LocEngGetZpp::locallog() const
+{
+ LOC_LOGV("LocEngGetZpp");
+}
+inline void LocEngGetZpp::log() const
+{
+ locallog();
+}
+void LocEngGetZpp::send() const {
+ mAdapter->sendMsg(this);
+}
+
+struct LocEngSetTime : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUtcTime mTime;
+ const int64_t mTimeReference;
+ const int mUncertainty;
+ inline LocEngSetTime(LocEngAdapter* adapter,
+ GpsUtcTime t, int64_t tf, int unc) :
+ LocMsg(), mAdapter(adapter),
+ mTime(t), mTimeReference(tf), mUncertainty(unc)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setTime(mTime, mTimeReference, mUncertainty);
+ }
+ inline void locallog() const {
+ LOC_LOGV("time: %lld\n timeReference: %lld\n uncertainty: %d",
+ mTime, mTimeReference, mUncertainty);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+ // case LOC_ENG_MSG_INJECT_LOCATION:
+struct LocEngInjectLocation : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const double mLatitude;
+ const double mLongitude;
+ const float mAccuracy;
+ inline LocEngInjectLocation(LocEngAdapter* adapter,
+ double lat, double lon, float accur) :
+ LocMsg(), mAdapter(adapter),
+ mLatitude(lat), mLongitude(lon), mAccuracy(accur)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ inline void locallog() const {
+ LOC_LOGV("latitude: %f\n longitude: %f\n accuracy: %f",
+ mLatitude, mLongitude, mAccuracy);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_IPV4:
+struct LocEngSetServerIpv4 : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned int mNlAddr;
+ const int mPort;
+ const LocServerType mServerType;
+ inline LocEngSetServerIpv4(LocEngAdapter* adapter,
+ unsigned int ip,
+ int port,
+ LocServerType type) :
+ LocMsg(), mAdapter(adapter),
+ mNlAddr(ip), mPort(port), mServerType(type)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mNlAddr, mPort, mServerType);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s",
+ mNlAddr, mPort, loc_get_server_type_name(mServerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_URL:
+struct LocEngSetServerUrl : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLen;
+ char* mUrl;
+ inline LocEngSetServerUrl(LocEngAdapter* adapter,
+ char* urlString,
+ int url_len) :
+ LocMsg(), mAdapter(adapter),
+ mLen(url_len), mUrl(new char[mLen+1])
+ {
+ memcpy((void*)mUrl, (void*)urlString, url_len);
+ mUrl[mLen] = 0;
+ locallog();
+ }
+ inline ~LocEngSetServerUrl()
+ {
+ delete[] mUrl;
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mUrl, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
+struct LocEngAGlonassProtocol : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned long mAGlonassProtocl;
+ inline LocEngAGlonassProtocol(LocEngAdapter* adapter,
+ unsigned long protocol) :
+ LocMsg(), mAdapter(adapter), mAGlonassProtocl(protocol)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setAGLONASSProtocol(mAGlonassProtocl);
+ }
+ inline void locallog() const {
+ LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SUPL_VERSION:
+struct LocEngSuplVer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSuplVer;
+ inline LocEngSuplVer(LocEngAdapter* adapter,
+ int suplVer) :
+ LocMsg(), mAdapter(adapter), mSuplVer(suplVer)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSUPLVersion(mSuplVer);
+ }
+ inline void locallog() const {
+ LOC_LOGV("SUPL Version: %d", mSuplVer);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSuplMode : public LocMsg {
+ UlpProxyBase* mUlp;
+
+ inline LocEngSuplMode(UlpProxyBase* ulp) :
+ LocMsg(), mUlp(ulp)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mUlp->setCapabilities(ContextBase::getCarrierCapabilities());
+ }
+ inline void locallog() const {
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LPP_CONFIG:
+struct LocEngLppConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLppConfig;
+ inline LocEngLppConfig(LocEngAdapter* adapter,
+ int lppConfig) :
+ LocMsg(), mAdapter(adapter), mLppConfig(lppConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setLPPConfig(mLppConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG:
+struct LocEngSensorControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSensorsDisabled;
+ const int mSensorProvider;
+ inline LocEngSensorControlConfig(LocEngAdapter* adapter,
+ int sensorsDisabled, int sensorProvider) :
+ LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled),
+ mSensorProvider(sensorProvider)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d",
+ mSensorsDisabled, mSensorProvider);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PROPERTIES:
+struct LocEngSensorProperties : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const bool mGyroBiasVarianceRandomWalkValid;
+ const float mGyroBiasVarianceRandomWalk;
+ const bool mAccelRandomWalkValid;
+ const float mAccelRandomWalk;
+ const bool mAngleRandomWalkValid;
+ const float mAngleRandomWalk;
+ const bool mRateRandomWalkValid;
+ const float mRateRandomWalk;
+ const bool mVelocityRandomWalkValid;
+ const float mVelocityRandomWalk;
+ inline LocEngSensorProperties(LocEngAdapter* adapter,
+ bool gyroBiasRandomWalk_valid,
+ float gyroBiasRandomWalk,
+ bool accelRandomWalk_valid,
+ float accelRandomWalk,
+ bool angleRandomWalk_valid,
+ float angleRandomWalk,
+ bool rateRandomWalk_valid,
+ float rateRandomWalk,
+ bool velocityRandomWalk_valid,
+ float velocityRandomWalk) :
+ LocMsg(), mAdapter(adapter),
+ mGyroBiasVarianceRandomWalkValid(gyroBiasRandomWalk_valid),
+ mGyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
+ mAccelRandomWalkValid(accelRandomWalk_valid),
+ mAccelRandomWalk(accelRandomWalk),
+ mAngleRandomWalkValid(angleRandomWalk_valid),
+ mAngleRandomWalk(angleRandomWalk),
+ mRateRandomWalkValid(rateRandomWalk_valid),
+ mRateRandomWalk(rateRandomWalk),
+ mVelocityRandomWalkValid(velocityRandomWalk_valid),
+ mVelocityRandomWalk(velocityRandomWalk)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorProperties(mGyroBiasVarianceRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalkValid,
+ mAccelRandomWalk,
+ mAngleRandomWalkValid,
+ mAngleRandomWalk,
+ mRateRandomWalkValid,
+ mRateRandomWalk,
+ mVelocityRandomWalkValid,
+ mVelocityRandomWalk);
+ }
+ inline void locallog() const {
+ LOC_LOGV("Sensor properties validity, Gyro Random walk: %d "
+ "Accel Random Walk: %d "
+ "Angle Random Walk: %d Rate Random Walk: %d "
+ "Velocity Random Walk: %d\n"
+ "Sensor properties, Gyro Random walk: %f "
+ "Accel Random Walk: %f "
+ "Angle Random Walk: %f Rate Random Walk: %f "
+ "Velocity Random Walk: %f",
+ mGyroBiasVarianceRandomWalkValid,
+ mAccelRandomWalkValid,
+ mAngleRandomWalkValid,
+ mRateRandomWalkValid,
+ mVelocityRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalk,
+ mAngleRandomWalk,
+ mRateRandomWalk,
+ mVelocityRandomWalk
+ );
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG:
+struct LocEngSensorPerfControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mControlMode;
+ const int mAccelSamplesPerBatch;
+ const int mAccelBatchesPerSec;
+ const int mGyroSamplesPerBatch;
+ const int mGyroBatchesPerSec;
+ const int mAccelSamplesPerBatchHigh;
+ const int mAccelBatchesPerSecHigh;
+ const int mGyroSamplesPerBatchHigh;
+ const int mGyroBatchesPerSecHigh;
+ const int mAlgorithmConfig;
+ inline LocEngSensorPerfControlConfig(LocEngAdapter* adapter,
+ int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig) :
+ LocMsg(), mAdapter(adapter),
+ mControlMode(controlMode),
+ mAccelSamplesPerBatch(accelSamplesPerBatch),
+ mAccelBatchesPerSec(accelBatchesPerSec),
+ mGyroSamplesPerBatch(gyroSamplesPerBatch),
+ mGyroBatchesPerSec(gyroBatchesPerSec),
+ mAccelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
+ mAccelBatchesPerSecHigh(accelBatchesPerSecHigh),
+ mGyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
+ mGyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
+ mAlgorithmConfig(algorithmConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorPerfControlConfig(mControlMode,
+ mAccelSamplesPerBatch,
+ mAccelBatchesPerSec,
+ mGyroSamplesPerBatch,
+ mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh,
+ mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh,
+ mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("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",
+ mControlMode,
+ mAccelSamplesPerBatch, mAccelBatchesPerSec,
+ mGyroSamplesPerBatch, mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh, mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh, mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_EXT_POWER_CONFIG:
+struct LocEngExtPowerConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mIsBatteryCharging;
+ inline LocEngExtPowerConfig(LocEngAdapter* adapter,
+ int isBatteryCharging) :
+ LocMsg(), mAdapter(adapter),
+ mIsBatteryCharging(isBatteryCharging)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setExtPowerConfig(mIsBatteryCharging);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
+ mIsBatteryCharging);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_POSITION:
+LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology) :
+ LocMsg(), mAdapter(adapter), mLocation(loc),
+ mLocationExtended(locExtended),
+ mLocationExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->location_ext_parser(locExt)),
+ mStatus(st), mTechMask(technology)
+{
+ locallog();
+}
+void LocEngReportPosition::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
+ bool reported = false;
+ if (locEng->location_cb != NULL) {
+ if (LOC_SESS_FAILURE == mStatus) {
+ // in case we want to handle the failure case
+ locEng->location_cb(NULL, NULL);
+ reported = true;
+ }
+ // what's in the else if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ else if ((LOC_SESS_SUCCESS == mStatus &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID) &
+ mTechMask)) ||
+ (LOC_SESS_INTERMEDIATE == locEng->intermediateFix &&
+ !((mLocation.gpsLocation.flags &
+ GPS_LOCATION_HAS_ACCURACY) &&
+ (gps_conf.ACCURACY_THRES != 0) &&
+ (mLocation.gpsLocation.accuracy >
+ gps_conf.ACCURACY_THRES)))) {
+ locEng->location_cb((UlpLocation*)&(mLocation),
+ (void*)mLocationExt);
+ reported = true;
+ }
+ }
+
+ // if we have reported this fix
+ if (reported &&
+ // and if this is a singleshot
+ GPS_POSITION_RECURRENCE_SINGLE ==
+ locEng->adapter->getPositionMode().recurrence) {
+ if (LOC_SESS_INTERMEDIATE == mStatus) {
+ // modem could be still working for a final fix,
+ // although we no longer need it. So stopFix().
+ locEng->adapter->stopFix();
+ }
+ // turn off the session flag.
+ locEng->adapter->setInSession(false);
+ }
+
+ LOC_LOGV("LocEngReportPosition::proc() - generateNmea: %d, position source: %d, "
+ "engine_status: %d, isInSession: %d",
+ locEng->generateNmea, mLocation.position_source,
+ locEng->engine_status, locEng->adapter->isInSession());
+
+ if (locEng->generateNmea &&
+ locEng->adapter->isInSession())
+ {
+ unsigned char generate_nmea = reported &&
+ (mStatus != LOC_SESS_FAILURE);
+ loc_eng_nmea_generate_pos(locEng, mLocation, mLocationExtended,
+ generate_nmea);
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(mLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+ }
+}
+void LocEngReportPosition::locallog() const {
+ LOC_LOGV("LocEngReportPosition");
+}
+void LocEngReportPosition::log() const {
+ locallog();
+}
+void LocEngReportPosition::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+// case LOC_ENG_MSG_REPORT_SV:
+LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
+ GnssSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExt) :
+ LocMsg(), mAdapter(adapter), mSvStatus(sv),
+ mLocationExtended(locExtended),
+ mSvExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->sv_ext_parser(svExt))
+{
+ locallog();
+}
+void LocEngReportSv::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gnss_sv_status_cb != NULL) {
+ LOC_LOGE("Calling gnss_sv_status_cb");
+ locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
+ }
+
+ if (locEng->generateNmea)
+ {
+ loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
+ }
+ }
+}
+void LocEngReportSv::locallog() const {
+ LOC_LOGV("%s:%d] LocEngReportSv",__func__, __LINE__);
+}
+inline void LocEngReportSv::log() const {
+ locallog();
+}
+void LocEngReportSv::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REPORT_STATUS:
+LocEngReportStatus::LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus) :
+ LocMsg(), mAdapter(adapter), mStatus(engineStatus)
+{
+ locallog();
+}
+inline void LocEngReportStatus::proc() const
+{
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ loc_eng_report_status(*locEng, mStatus);
+ update_aiding_data_for_deletion(*locEng);
+}
+inline void LocEngReportStatus::locallog() const {
+ LOC_LOGV("LocEngReportStatus");
+}
+inline void LocEngReportStatus::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_NMEA:
+LocEngReportNmea::LocEngReportNmea(void* locEng,
+ const char* data, int len) :
+ LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
+{
+ memcpy((void*)mNmea, (void*)data, len);
+ locallog();
+}
+void LocEngReportNmea::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+
+ if (locEng->nmea_cb != NULL)
+ locEng->nmea_cb(now, mNmea, mLen);
+}
+inline void LocEngReportNmea::locallog() const {
+ LOC_LOGV("LocEngReportNmea");
+}
+inline void LocEngReportNmea::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_XTRA_SERVER:
+LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
+ const char *url1,
+ const char *url2,
+ const char *url3,
+ const int maxlength) :
+ LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
+ mServers(new char[3*(mMaxLen+1)])
+{
+ char * cptr = mServers;
+ memset(mServers, 0, 3*(mMaxLen+1));
+
+ // Override modem URLs with uncommented gps.conf urls
+ if( gps_conf.XTRA_SERVER_1[0] != '\0' ) {
+ url1 = &gps_conf.XTRA_SERVER_1[0];
+ }
+ if( gps_conf.XTRA_SERVER_2[0] != '\0' ) {
+ url2 = &gps_conf.XTRA_SERVER_2[0];
+ }
+ if( gps_conf.XTRA_SERVER_3[0] != '\0' ) {
+ url3 = &gps_conf.XTRA_SERVER_3[0];
+ }
+ // copy non xtra1.gpsonextra.net URLs into the forwarding buffer.
+ if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url1, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url2, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url3, mMaxLen + 1);
+ }
+ locallog();
+}
+
+void LocEngReportXtraServer::proc() const {
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->report_xtra_server_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("report_xtra_server_cb", %s, mServers);
+ locEngXtra->report_xtra_server_cb(mServers,
+ &(mServers[mMaxLen+1]),
+ &(mServers[(mMaxLen+1)<<1]));
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngReportXtraServer::locallog() const {
+ LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n"
+ " server3: %s\n",
+ mServers, &mServers[mMaxLen+1], &mServers[(mMaxLen+1)<<1]);
+}
+inline void LocEngReportXtraServer::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_BIT:
+// case LOC_ENG_MSG_RELEASE_BIT:
+LocEngReqRelBIT::LocEngReqRelBIT(void* locEng, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mIPv4Addr(ipv4),
+ mIPv6Addr(ipv6 ? new char[16] : NULL), mIsReq(isReq) {
+ if (NULL != ipv6)
+ memcpy(mIPv6Addr, ipv6, 16);
+ locallog();
+}
+inline LocEngReqRelBIT::~LocEngReqRelBIT() {
+ if (mIPv6Addr) {
+ delete[] mIPv6Addr;
+ }
+}
+void LocEngReqRelBIT::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ BITSubscriber s(getAgpsStateMachine(*locEng, mType),
+ mIPv4Addr, mIPv6Addr);
+ AgpsStateMachine* sm = (AgpsStateMachine*)s.mStateMachine;
+
+ if (mIsReq) {
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ sm->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelBIT::locallog() const {
+ LOC_LOGV("LocEngRequestBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)mIPv4Addr,
+ (unsigned char)(mIPv4Addr>>8),
+ (unsigned char)(mIPv4Addr>>16),
+ (unsigned char)(mIPv4Addr>>24),
+ NULL != mIPv6Addr ? mIPv6Addr : "");
+}
+inline void LocEngReqRelBIT::log() const {
+ locallog();
+}
+void LocEngReqRelBIT::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_RELEASE_BIT:
+struct LocEngReleaseBIT : public LocMsg {
+ const BITSubscriber mSubscriber;
+ inline LocEngReleaseBIT(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ LocMsg(),
+ mSubscriber(stateMachine, ipv4, ipv6)
+ {
+ locallog();
+ }
+ inline virtual void proc() const
+ {
+ AgpsStateMachine* sm = (AgpsStateMachine*)mSubscriber.mStateMachine;
+ sm->unsubscribeRsrc((Subscriber*)&mSubscriber);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngReleaseBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mSubscriber.ID>>24),
+ (unsigned char)(mSubscriber.ID>>16),
+ (unsigned char)(mSubscriber.ID>>8),
+ (unsigned char)mSubscriber.ID,
+ NULL != mSubscriber.mIPv6Addr ? mSubscriber.mIPv6Addr : "");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// LocEngSuplEsOpened
+LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsOpened::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_GRANTED);
+ }
+}
+void LocEngSuplEsOpened::locallog() const {
+ LOC_LOGV("LocEngSuplEsOpened");
+}
+void LocEngSuplEsOpened::log() const {
+ locallog();
+}
+
+// LocEngSuplEsClosed
+LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsClosed::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_RELEASED);
+ }
+}
+void LocEngSuplEsClosed::locallog() const {
+ LOC_LOGV("LocEngSuplEsClosed");
+}
+void LocEngSuplEsClosed::log() const {
+ locallog();
+}
+
+
+// case LOC_ENG_MSG_REQUEST_SUPL_ES:
+LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngRequestSuplEs::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ DSSubscriber s(sm, mID);
+ sm->subscribeRsrc((Subscriber*)&s);
+ }
+ else if (locEng->agnss_nif) {
+ AgpsStateMachine *sm = locEng->agnss_nif;
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ false);
+ sm->subscribeRsrc((Subscriber*)&s);
+ LOC_LOGD("%s:%d]: Using regular ATL for SUPL ES", __func__, __LINE__);
+ }
+ else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1);
+ }
+}
+inline void LocEngRequestSuplEs::locallog() const {
+ LOC_LOGV("LocEngRequestSuplEs");
+}
+inline void LocEngRequestSuplEs::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_ATL:
+LocEngRequestATL::LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type) :
+ LocMsg(), mLocEng(locEng), mID(id), mType(agps_type) {
+ locallog();
+}
+void LocEngRequestATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = (AgpsStateMachine*)
+ getAgpsStateMachine(*locEng, mType);
+ if (sm) {
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ AGPS_TYPE_INVALID == mType);
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngRequestATL::locallog() const {
+ LOC_LOGV("LocEngRequestATL");
+}
+inline void LocEngRequestATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_RELEASE_ATL:
+LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngReleaseATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+
+ if (locEng->agnss_nif) {
+ ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false);
+ if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->internet_nif) {
+ ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false);
+ if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from internet_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->ds_nif) {
+ DSSubscriber s3(locEng->ds_nif, mID);
+ if (locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from ds_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ LOC_LOGW("%s:%d]: Could not release ATL. "
+ "No subscribers found\n",
+ __func__, __LINE__);
+ locEng->adapter->atlCloseStatus(mID, 0);
+}
+inline void LocEngReleaseATL::locallog() const {
+ LOC_LOGV("LocEngReleaseATL");
+}
+inline void LocEngReleaseATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_WIFI:
+// case LOC_ENG_MSG_RELEASE_WIFI:
+LocEngReqRelWifi::LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mSenderId(sender_id),
+ mSSID(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == p ? NULL : new char[SSID_BUF_SIZE]),
+ mIsReq(isReq) {
+ if (NULL != s)
+ strlcpy(mSSID, s, SSID_BUF_SIZE);
+ if (NULL != p)
+ strlcpy(mPassword, p, SSID_BUF_SIZE);
+ locallog();
+}
+LocEngReqRelWifi::~LocEngReqRelWifi() {
+ if (NULL != mSSID) {
+ delete[] mSSID;
+ }
+ if (NULL != mPassword) {
+ delete[] mPassword;
+ }
+}
+void LocEngReqRelWifi::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->wifi_nif) {
+ WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
+ if (mIsReq) {
+ locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
+ }
+ } else {
+ locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngReqRelWifi::locallog() const {
+ LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
+ mIsReq ? "LocEngRequestWifi" : "LocEngReleaseWifi",
+ mSenderId,
+ NULL != mSSID ? mSSID : "",
+ NULL != mPassword ? mPassword : "");
+}
+inline void LocEngReqRelWifi::log() const {
+ locallog();
+}
+void LocEngReqRelWifi::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REQUEST_XTRA_DATA:
+LocEngRequestXtra::LocEngRequestXtra(void* locEng) :
+ mLocEng(locEng) {
+ locallog();
+}
+void LocEngRequestXtra::proc() const
+{
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->download_request_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("download_request_cb", %p, mLocEng);
+ locEngXtra->download_request_cb();
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngRequestXtra::locallog() const {
+ LOC_LOGV("LocEngReqXtra");
+}
+inline void LocEngRequestXtra::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_TIME:
+LocEngRequestTime::LocEngRequestTime(void* locEng) :
+ LocMsg(), mLocEng(locEng)
+{
+ locallog();
+}
+void LocEngRequestTime::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (gps_conf.CAPABILITIES & GPS_CAPABILITY_ON_DEMAND_TIME) {
+ if (locEng->request_utc_time_cb != NULL) {
+ locEng->request_utc_time_cb();
+ } else {
+ LOC_LOGE("Callback function for request time is NULL");
+ }
+ }
+}
+inline void LocEngRequestTime::locallog() const {
+ LOC_LOGV("LocEngReqTime");
+}
+inline void LocEngRequestTime::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_DELETE_AIDING_DATA:
+struct LocEngDelAidData : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ const GpsAidingData mType;
+ inline LocEngDelAidData(loc_eng_data_s_type* locEng,
+ GpsAidingData f) :
+ LocMsg(), mLocEng(locEng), mType(f)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocEng->aiding_data_for_deletion = mType;
+ update_aiding_data_for_deletion(*mLocEng);
+ }
+ inline void locallog() const {
+ LOC_LOGV("aiding data msak %d", mType);
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENABLE_DATA:
+struct LocEngEnableData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mEnable;
+ char* mAPN;
+ const int mLen;
+ inline LocEngEnableData(LocEngAdapter* adapter,
+ const char* name, int len, int enable) :
+ LocMsg(), mAdapter(adapter),
+ mEnable(enable), mAPN(NULL), mLen(len)
+ {
+ if (NULL != name) {
+ mAPN = new char[len+1];
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ }
+ locallog();
+ }
+ inline ~LocEngEnableData() {
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter->enableData(mEnable);
+ if (NULL != mAPN) {
+ mAdapter->setAPN(mAPN, mLen);
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("apn: %s\n enable: %d",
+ (NULL == mAPN) ? "NULL" : mAPN, mEnable);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_INJECT_XTRA_DATA:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_SET_CAPABILITIES:
+struct LocEngSetCapabilities : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_capabilities_cb) {
+ LOC_LOGV("calling set_capabilities_cb 0x%x",
+ gps_conf.CAPABILITIES);
+ mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES);
+ } else {
+ LOC_LOGV("set_capabilities_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetCapabilities");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+struct LocEngSetSystemInfo : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetSystemInfo(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_system_info_cb) {
+ LOC_LOGV("calling set_system_info_cb 0x%x",
+ mLocEng->adapter->mGnssInfo.year_of_hw);
+ mLocEng->set_system_info_cb(&(mLocEng->adapter->mGnssInfo));
+ }
+ else {
+ LOC_LOGV("set_system_info_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetSystemInfo");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LOC_INIT:
+struct LocEngInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_reinit(*mLocEng);
+ // set the capabilities
+ mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
+ mLocEng->adapter->sendMsg(new LocEngSetSystemInfo(mLocEng));
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInit");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REQUEST_XTRA_SERVER:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
+struct LocEngAtlOpenSuccess : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ const int mLen;
+ char* mAPN;
+ const AGpsBearerType mBearerType;
+ inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
+ const char* name,
+ int len,
+ AGpsBearerType btype) :
+ LocMsg(),
+ mStateMachine(statemachine), mLen(len),
+ mAPN(new char[len+1]), mBearerType(btype)
+ {
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ locallog();
+ }
+ inline ~LocEngAtlOpenSuccess()
+ {
+ delete[] mAPN;
+ }
+ inline virtual void proc() const {
+ mStateMachine->setBearer(mBearerType);
+ mStateMachine->setAPN(mAPN, mLen);
+ mStateMachine->onRsrcEvent(RSRC_GRANTED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n"
+ " bearer type: %s",
+ loc_get_agps_type_name(mStateMachine->getType()),
+ mAPN,
+ loc_get_agps_bear_name(mBearerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_CLOSED:
+struct LocEngAtlClosed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_RELEASED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_OPEN_FAILED:
+struct LocEngAtlOpenFailed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_DENIED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenFailed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENGINE_DOWN:
+LocEngDown::LocEngDown(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngDown::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_down(*locEng);
+}
+inline void LocEngDown::locallog() const {
+ LOC_LOGV("LocEngDown");
+}
+inline void LocEngDown::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_ENGINE_UP:
+LocEngUp::LocEngUp(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngUp::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_up(*locEng);
+}
+inline void LocEngUp::locallog() const {
+ LOC_LOGV("LocEngUp");
+}
+inline void LocEngUp::log() const {
+ locallog();
+}
+
+struct LocEngDataClientInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngDataClientInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+ }
+ virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ if(!locEng->adapter->initDataServiceClient()) {
+ locEng->ds_nif = new DSStateMachine(servicerTypeExt,
+ (void *)dataCallCb,
+ locEng->adapter);
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngDataClientInit\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInstallAGpsCert : public LocMsg {
+ LocEngAdapter* mpAdapter;
+ const size_t mNumberOfCerts;
+ const uint32_t mSlotBitMask;
+ DerEncodedCertificate* mpData;
+ inline LocEngInstallAGpsCert(LocEngAdapter* adapter,
+ const DerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask) :
+ LocMsg(), mpAdapter(adapter),
+ mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask),
+ mpData(new DerEncodedCertificate[mNumberOfCerts])
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ mpData[i].data = new u_char[pData[i].length];
+ if (mpData[i].data) {
+ memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length);
+ mpData[i].length = pData[i].length;
+ } else {
+ LOC_LOGE("malloc failed for cert#%d", i);
+ break;
+ }
+ }
+ locallog();
+ }
+ inline ~LocEngInstallAGpsCert()
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ if (mpData[i].data) {
+ delete[] mpData[i].data;
+ }
+ }
+ delete[] mpData;
+ }
+ inline virtual void proc() const {
+ mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u",
+ mNumberOfCerts, mSlotBitMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngUpdateRegistrationMask : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ loc_registration_mask_status mIsEnabled;
+ inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng,
+ LOC_API_ADAPTER_EVENT_MASK_T mask,
+ loc_registration_mask_status isEnabled) :
+ LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ locEng->adapter->updateRegistrationMask(mMask,
+ mIsEnabled);
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngUpdateRegistrationMask\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngGnssConstellationConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->mGnssInfo.size = sizeof(GnssSystemInfo);
+ if (mAdapter->gnssConstellationConfig()) {
+ LOC_LOGV("Modem supports GNSS measurements\n");
+ gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
+ mAdapter->mGnssInfo.year_of_hw = 2016;
+ } else {
+ mAdapter->mGnssInfo.year_of_hw = 2015;
+ LOC_LOGV("Modem does not support GNSS measurements\n");
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngGnssConstellationConfig\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
+LocEngReportGnssMeasurement::LocEngReportGnssMeasurement(void* locEng,
+ GnssData &gnssData) :
+ LocMsg(), mLocEng(locEng), mGnssData(gnssData)
+{
+ locallog();
+}
+void LocEngReportGnssMeasurement::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gnss_measurement_cb != NULL) {
+ LOC_LOGV("Calling gnss_measurement_cb");
+ locEng->gnss_measurement_cb((GnssData*)&(mGnssData));
+ }
+ }
+}
+
+void LocEngReportGnssMeasurement::locallog() const {
+ IF_LOC_LOGV {
+ LOC_LOGV("%s:%d]: Received in GPS HAL."
+ "GNSS Measurements count: %d \n",
+ __func__, __LINE__, mGnssData.measurement_count);
+ for (int i =0; i< mGnssData.measurement_count && i < GNSS_MAX_SVS; i++) {
+ LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
+ " GPS_HAL => Measurement ID | svid | time_offset_ns | state |"
+ " c_n0_dbhz | pseudorange_rate_mps |"
+ " pseudorange_rate_uncertainty_mps |"
+ " accumulated_delta_range_state | flags \n"
+ " GPS_HAL => %d | %d | %f | %d | %f | %f | %f | %d | %d \n",
+ i,
+ mGnssData.measurements[i].svid,
+ mGnssData.measurements[i].time_offset_ns,
+ mGnssData.measurements[i].state,
+ mGnssData.measurements[i].c_n0_dbhz,
+ mGnssData.measurements[i].pseudorange_rate_mps,
+ mGnssData.measurements[i].pseudorange_rate_uncertainty_mps,
+ mGnssData.measurements[i].accumulated_delta_range_state,
+ mGnssData.measurements[i].flags);
+ }
+ LOC_LOGV(" GPS_HAL => Clocks Info: \n"
+ " time_ns | full_bias_ns | bias_ns | bias_uncertainty_ns | "
+ " drift_nsps | drift_uncertainty_nsps | hw_clock_discontinuity_count | flags"
+ " GPS_HAL => Clocks Info: %lld | %lld | %g | %g | %g | %g | %d | 0x%04x\n",
+ mGnssData.clock.time_ns,
+ mGnssData.clock.full_bias_ns,
+ mGnssData.clock.bias_ns,
+ mGnssData.clock.bias_uncertainty_ns,
+ mGnssData.clock.drift_nsps,
+ mGnssData.clock.drift_uncertainty_nsps,
+ mGnssData.clock.hw_clock_discontinuity_count,
+ mGnssData.clock.flags);
+ }
+}
+
+inline void LocEngReportGnssMeasurement::log() const {
+ locallog();
+}
+
+/*********************************************************************
+ * Initialization checking macros
+ *********************************************************************/
+#define STATE_CHECK(ctx, x, ret) \
+ if (!(ctx)) \
+ { \
+ /* Not intialized, abort */\
+ LOC_LOGE("%s: log_eng state error: %s", __func__, x); \
+ EXIT_LOG(%s, x); \
+ ret; \
+ }
+#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event, ContextBase* context)
+
+{
+ int ret_val = 0;
+
+ ENTRY_LOG_CALLFLOW();
+ if (NULL == callbacks || 0 == event) {
+ LOC_LOGE("loc_eng_init: bad parameters cb %p eMask %d", callbacks, event);
+ ret_val = -1;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+ }
+
+ STATE_CHECK((NULL == loc_eng_data.adapter),
+ "instance already initialized", return 0);
+
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data));
+
+ // Save callbacks
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+ loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+ loc_eng_data.set_system_info_cb = callbacks->set_system_info_cb;
+ loc_eng_data.gnss_sv_status_cb = callbacks->gnss_sv_status_cb;
+ loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
+ callbacks->location_ext_parser : noProc;
+ loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
+ callbacks->sv_ext_parser : noProc;
+ loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
+ // initial states taken care of by the memset above
+ // loc_eng_data.engine_status -- GPS_STATUS_NONE;
+ // loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
+ // loc_eng_data.mute_session_state -- LOC_MUTE_SESS_NONE;
+
+ if ((event & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) && (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_AP))
+ {
+ event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
+ loc_eng_data.generateNmea = true;
+ }
+ else
+ {
+ loc_eng_data.generateNmea = false;
+ }
+
+ loc_eng_data.adapter =
+ new LocEngAdapter(event, &loc_eng_data, context,
+ (LocThread::tCreate)callbacks->create_thread_cb);
+
+ loc_eng_data.adapter->mGnssInfo.size = sizeof(GnssSystemInfo);
+ loc_eng_data.adapter->mGnssInfo.year_of_hw = 2015;
+ LOC_LOGD("loc_eng_init created client, id = %p\n",
+ loc_eng_data.adapter);
+ loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngGnssConstellationConfig(adapter));
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE,
+ sap_conf.SENSOR_PROVIDER));
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+
+ /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
+ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) {
+ adapter->sendMsg(new LocEngSensorProperties(adapter,
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sap_conf.GYRO_BIAS_RANDOM_WALK,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY));
+ }
+
+ adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter,
+ sap_conf.SENSOR_CONTROL_MODE,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK));
+
+ adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0)));
+
+ loc_eng_xtra_version_check(loc_eng_data, gps_conf.XTRA_VERSION_CHECK);
+
+ LOC_LOGD("loc_eng_reinit reinit() successful");
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // XTRA has no state, so we are fine with it.
+
+ // we need to check and clear NI
+#if 0
+ // we need to check and clear ATL
+ if (NULL != loc_eng_data.agnss_nif) {
+ delete loc_eng_data.agnss_nif;
+ loc_eng_data.agnss_nif = NULL;
+ }
+ if (NULL != loc_eng_data.internet_nif) {
+ delete loc_eng_data.internet_nif;
+ loc_eng_data.internet_nif = NULL;
+ }
+#endif
+ if (loc_eng_data.adapter->isInSession())
+ {
+ LOC_LOGD("loc_eng_cleanup: fix not stopped. stop it now.");
+ loc_eng_stop(loc_eng_data);
+ }
+
+#if 0 // can't afford to actually clean up, for many reason.
+
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ delete loc_eng_data.adapter;
+ loc_eng_data.adapter = NULL;
+
+ loc_eng_dmn_conn_loc_api_server_unblock();
+ loc_eng_dmn_conn_loc_api_server_join();
+
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (!loc_eng_data.adapter->isInSession()) {
+ ret_val = loc_eng_data.adapter->startFix();
+
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS ||
+ ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN ||
+ ret_val == LOC_API_ADAPTER_ERR_PHONE_OFFLINE ||
+ ret_val == LOC_API_ADAPTER_ERR_INTERNAL)
+ {
+ loc_eng_data.adapter->setInSession(TRUE);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_stop_wrapper
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (loc_eng_data.adapter->isInSession()) {
+
+ ret_val = loc_eng_data.adapter->stopFix();
+ loc_eng_data.adapter->setInSession(FALSE);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
+
+DESCRIPTION
+ Mutes one session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: Success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ // The position mode for AUTO/GSS/QCA1530 can only be standalone
+ if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) &&
+ !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
+ (params.mode != LOC_POSITION_MODE_STANDALONE)) {
+ params.mode = LOC_POSITION_MODE_STANDALONE;
+ LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530.");
+ }
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
+ {
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngPositionMode(adapter, params));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
+ int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
+ uncertainty));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
+ double longitude, float accuracy)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ if(adapter->mSupportsPositionInjection)
+ {
+ adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
+ accuracy));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData f)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+
+ if (loc_eng_data.status_cb)
+ {
+ GpsStatus gs = { sizeof(gs),status };
+ CALLBACK_LOG_CALLFLOW("status_cb", %s,
+ loc_get_gps_status_name(gs.status));
+ loc_eng_data.status_cb(&gs);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ UlpLocation location;
+ LocPosTechMask tech_mask = LOC_POS_TECH_MASK_DEFAULT;
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+
+ ret_val = loc_eng_data.adapter->getZpp(location.gpsLocation, tech_mask);
+ //Mark the location source as from ZPP
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_ZPP;
+
+ loc_eng_data.adapter->getUlpProxy()->reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_SUCCESS,
+ tech_mask);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*
+ Callback function passed to Data Services State Machine
+ This becomes part of the state machine's servicer and
+ is used to send requests to the data services client
+*/
+static int dataCallCb(void *cb_data)
+{
+ LOC_LOGD("Enter dataCallCb\n");
+ int ret=0;
+ if(cb_data != NULL) {
+ dsCbData *cbData = (dsCbData *)cb_data;
+ LocEngAdapter *locAdapter = (LocEngAdapter *)cbData->mAdapter;
+ if(cbData->action == GPS_REQUEST_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_REQUEST_AGPS_DATA_CONN\n");
+ ret = locAdapter->openAndStartDataCall();
+ }
+ else if(cbData->action == GPS_RELEASE_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_RELEASE_AGPS_DATA_CONN\n");
+ locAdapter->stopDataCall();
+ }
+ }
+ else {
+ LOC_LOGE("NULL argument received. Failing.\n");
+ ret = -1;
+ goto err;
+ }
+
+err:
+ LOC_LOGD("Exit dataCallCb ret = %d\n", ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_reinit
+
+DESCRIPTION
+ 2nd half of loc_eng_agps_init(), singled out for modem restart to use.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+
+ // Set server addresses which came before init
+ if (loc_eng_data.supl_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_SUPL_SERVER,
+ loc_eng_data.supl_host_buf,
+ loc_eng_data.supl_port_buf);
+ }
+
+ if (loc_eng_data.c2k_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_CDMA_PDE_SERVER,
+ loc_eng_data.c2k_host_buf,
+ loc_eng_data.c2k_port_buf);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+ STATE_CHECK((NULL == loc_eng_data.agps_status_cb),
+ "agps instance already initialized",
+ return);
+ if (callbacks == NULL) {
+ LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks);
+ EXIT_LOG(%s, VOID_RET);
+ return;
+ }
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WWAN_ANY,
+ false);
+ loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WIFI,
+ true);
+
+ if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
+ (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) {
+ loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_SUPL,
+ false);
+
+ if (adapter->mSupportsAgpsRequests) {
+ if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data));
+ }
+ loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
+ NULL, NULL, &loc_eng_data);
+ }
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void deleteAidingData(loc_eng_data_s_type &logEng) {
+ if (logEng.engine_status != GPS_STATUS_ENGINE_ON &&
+ logEng.aiding_data_for_deletion != 0) {
+ logEng.adapter->deleteAidingData(logEng.aiding_data_for_deletion);
+ logEng.aiding_data_for_deletion = 0;
+ }
+}
+
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
+ AgpsStateMachine* stateMachine;
+ switch (agpsType) {
+ case AGPS_TYPE_WIFI: {
+ stateMachine = locEng.wifi_nif;
+ break;
+ }
+ case AGPS_TYPE_INVALID:
+ case AGPS_TYPE_SUPL: {
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ case AGPS_TYPE_SUPL_ES: {
+ locEng.ds_nif ?
+ stateMachine = locEng.ds_nif:
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ default:
+ stateMachine = locEng.internet_nif;
+ }
+ return stateMachine;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ if (apn == NULL)
+ {
+ LOC_LOGE("APN Name NULL\n");
+ return 0;
+ }
+
+ LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
+
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+
+ loc_eng_data.adapter->sendMsg(
+ new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform engine about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION resolve_in_addr
+
+DESCRIPTION
+ Translates a hostname to in_addr struct
+
+DEPENDENCIES
+ n/a
+
+RETURN VALUE
+ TRUE if successful
+
+SIDE EFFECTS
+ n/a
+
+===========================================================================*/
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
+{
+ ENTRY_LOG();
+ boolean ret_val = TRUE;
+
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ ret_val = FALSE;
+ }
+ }
+
+ EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server
+
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ int ret = 0;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ char url[MAX_URL_LEN];
+ unsigned int len = 0;
+ const char nohost[] = "NONE";
+ if (hostname == NULL ||
+ strncasecmp(nohost, hostname, sizeof(nohost)) == 0) {
+ url[0] = NULL;
+ } else {
+ len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port);
+ }
+
+ if (sizeof(url) > len) {
+ adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len));
+ }
+ } else if (LOC_AGPS_CDMA_PDE_SERVER == type ||
+ LOC_AGPS_CUSTOM_PDE_SERVER == type ||
+ LOC_AGPS_MPC_SERVER == type) {
+ struct in_addr addr;
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ ret = -2;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ adapter->sendMsg(new LocEngSetServerIpv4(adapter, ip, port, type));
+ }
+ } else {
+ LOC_LOGE("loc_eng_set_server, type %d cannot be resolved.\n", type);
+ }
+
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server_proxy
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type,
+ const char* hostname, int port)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = 0;
+
+ LOC_LOGV("save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case LOC_AGPS_SUPL_SERVER:
+ strlcpy(loc_eng_data.supl_host_buf, hostname,
+ sizeof(loc_eng_data.supl_host_buf));
+ loc_eng_data.supl_port_buf = port;
+ loc_eng_data.supl_host_set = 1;
+ break;
+ case LOC_AGPS_CDMA_PDE_SERVER:
+ strlcpy(loc_eng_data.c2k_host_buf, hostname,
+ sizeof(loc_eng_data.c2k_host_buf));
+ loc_eng_data.c2k_port_buf = port;
+ loc_eng_data.c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+
+ if (NULL != loc_eng_data.adapter)
+ {
+ ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int available, const char* apn)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ //This is to store the status of data availability over the network.
+ //If GPS is not enabled, the INIT_CHECK will fail and the modem will
+ //not be updated with the network's availability. Since the data status
+ //can change before GPS is enabled the, storing the status will enable
+ //us to inform the modem after GPS is enabled
+ agpsStatus = available;
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+ if (apn != NULL)
+ {
+ LOC_LOGD("loc_eng_agps_ril_update_network_availability: APN Name = [%s]\n", apn);
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngEnableData(adapter, apn, apn_len, available));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t numberOfCerts)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+
+ uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK;
+ uint32_t slotCount = 0;
+ for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) {
+ slotBitMaskCounter &= slotBitMaskCounter - 1;
+ }
+ LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u",
+ slotBitMask, slotCount, numberOfCerts);
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (numberOfCerts == 0) {
+ LOC_LOGE("No certs to install, since numberOfCerts is zero");
+ ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+ } else if (!adapter) {
+ LOC_LOGE("adapter is null!");
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ } else if (slotCount < numberOfCerts) {
+ LOC_LOGE("Not enough cert slots (%u) to install %u certs!",
+ slotCount, numberOfCerts);
+ ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES;
+ } else {
+ for (int i=0; i < numberOfCerts; ++i)
+ {
+ if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) {
+ LOC_LOGE("cert#(%u) length of %u is too big! greater than %u",
+ certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH);
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ break;
+ }
+ }
+
+ if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) {
+ adapter->sendMsg(new LocEngInstallAGpsCert(adapter,
+ certificates,
+ numberOfCerts,
+ slotBitMask));
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if (config_data && length > 0) {
+ loc_gps_cfg_s_type gps_conf_tmp = gps_conf;
+ UTIL_UPDATE_CONF(config_data, length, gps_conf_table);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ // it is possible that HAL is not init'ed at this time
+ if (adapter) {
+ if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) {
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ }
+ if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) {
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ }
+ if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) {
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter,
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+ }
+ if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) {
+ adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy()));
+ }
+ }
+
+ gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER;
+ gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE;
+ gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT;
+ gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK;
+ gps_conf = gps_conf_tmp;
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+ // Switch from WAIT to MUTE, for "engine on" or "session begin" event
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+
+ // Switch off MUTE session
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION &&
+ (status == GPS_STATUS_SESSION_END || status == GPS_STATUS_ENGINE_OFF))
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+
+ // Session End is not reported during Android navigating state
+ boolean navigating = loc_eng_data.adapter->isInSession();
+ if (status != GPS_STATUS_NONE &&
+ !(status == GPS_STATUS_SESSION_END && navigating) &&
+ !(status == GPS_STATUS_SESSION_BEGIN && !navigating))
+ {
+ if (loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ // Inform GpsLocationProvider about mNavigating status
+ loc_inform_gps_status(loc_eng_data, status);
+ }
+ else {
+ LOC_LOGD("loc_eng_report_status: muting the status report.");
+ }
+ }
+
+ // Only keeps ENGINE ON/OFF in engine_status
+ if (status == GPS_STATUS_ENGINE_ON || status == GPS_STATUS_ENGINE_OFF)
+ {
+ loc_eng_data.engine_status = status;
+ }
+
+ // Only keeps SESSION BEGIN/END in fix_session_status
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = status;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_engine_down
+ loc_eng_handle_engine_up
+
+DESCRIPTION
+ Calls this function when it is detected that modem restart is happening.
+ Either we detected the modem is down or received modem up event.
+ This must be called from the deferred thread to avoid race condition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_reset_on_engine_restart(loc_eng_data);
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_OFF);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_reinit(loc_eng_data);
+
+ loc_eng_data.adapter->requestPowerVote();
+
+ if (loc_eng_data.agps_status_cb != NULL) {
+ if (loc_eng_data.agnss_nif)
+ loc_eng_data.agnss_nif->dropAllSubscribers();
+ if (loc_eng_data.internet_nif)
+ loc_eng_data.internet_nif->dropAllSubscribers();
+
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ // modem is back up. If we crashed in the middle of navigating, we restart.
+ if (loc_eng_data.adapter->isInSession()) {
+ // This sets the copy in adapter to modem
+ loc_eng_data.adapter->setInSession(false);
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+#ifdef USE_GLIB
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+#endif /* USE_GLIB */
+
+/*===========================================================================
+FUNCTION loc_eng_read_config
+
+DESCRIPTION
+ Initiates the reading of the gps config file stored in /etc dir
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_read_config(void)
+{
+ ENTRY_LOG_CALLFLOW();
+ if(configAlreadyRead == false)
+ {
+ // Initialize our defaults before reading of configuration file overwrites them.
+ loc_default_parameters();
+ // We only want to parse the conf file once. This is a good place to ensure that.
+ // In fact one day the conf file should go into context.
+ UTIL_READ_CONF(GPS_CONF_FILE, gps_conf_table);
+ UTIL_READ_CONF(SAP_CONF_FILE, sap_conf_table);
+ configAlreadyRead = true;
+ } else {
+ LOC_LOGV("GPS Config file has already been read\n");
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_init
+
+DESCRIPTION
+ Initialize gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ STATE_CHECK((NULL == loc_eng_data.gnss_measurement_cb),
+ "gnss measurement already initialized",
+ return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
+ STATE_CHECK((callbacks != NULL),
+ "callbacks can not be NULL",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+ STATE_CHECK(loc_eng_data.adapter,
+ "GpsInterface must be initialized first",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_ENABLED));
+ // set up the callback
+ loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback;
+ LOC_LOGD ("%s, event masks updated successfully", __func__);
+
+ return GPS_MEASUREMENT_OPERATION_SUCCESS;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_close
+
+DESCRIPTION
+ Close gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_DISABLED));
+ // set up the callback
+ loc_eng_data.gnss_measurement_cb = NULL;
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng.h b/msm8909/loc_api/libloc_api_50001/loc_eng.h
new file mode 100644
index 0000000..f9b59fd
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng.h
@@ -0,0 +1,211 @@
+/* Copyright (c) 2009-2014,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_ENG_H
+#define LOC_ENG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+#define MAX_NUM_ATL_CONNECTIONS 2
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc.h>
+#include <loc_eng_xtra.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_agps.h>
+#include <loc_cfg.h>
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_eng_agps.h>
+#include <LocEngAdapter.h>
+
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+#define SUCCESS TRUE
+#define FAILURE FALSE
+#define INVALID_ATL_CONNECTION_HANDLE -1
+
+#define gps_conf ContextBase::mGps_conf
+#define sap_conf ContextBase::mSap_conf
+
+enum loc_nmea_provider_e_type {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+};
+
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE = 0,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
+// Module data
+typedef struct loc_eng_data_s
+{
+ LocEngAdapter *adapter;
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ agps_status_extended agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_request_utc_time request_utc_time_cb;
+ gnss_set_system_info set_system_info_cb;
+ gnss_sv_status_callback gnss_sv_status_cb;
+ gnss_measurement_callback gnss_measurement_cb;
+ boolean intermediateFix;
+ AGpsStatusValue agps_status;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ loc_eng_ni_data_s_type loc_eng_ni_data;
+
+ // AGPS state machines
+ AgpsStateMachine* agnss_nif;
+ AgpsStateMachine* internet_nif;
+ AgpsStateMachine* wifi_nif;
+ //State machine for Data Services
+ AgpsStateMachine* ds_nif;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // For muting session broadcast
+ loc_mute_session_e_type mute_session_state;
+
+ // For nmea generation
+ boolean generateNmea;
+ uint32_t sv_used_mask;
+ float hdop;
+ float pdop;
+ float vdop;
+
+ // Address buffers, for addressing setting before init
+ int supl_host_set;
+ char supl_host_buf[101];
+ int supl_port_buf;
+ int c2k_host_set;
+ char c2k_host_buf[101];
+ int c2k_port_buf;
+ int mpc_host_set;
+ char mpc_host_buf[101];
+ int mpc_port_buf;
+
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+} loc_eng_data_s_type;
+
+//loc_eng functions
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
+ LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event,
+ ContextBase* context);
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data,
+ GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
+ double latitude, double longitude,
+ float accuracy);
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
+ GpsAidingData f);
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms);
+const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
+ const char* name);
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_read_config(void);
+
+//loc_eng_agps functions
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
+ AGpsExtCallbacks* callbacks);
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType);
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int avaiable, const char* apn);
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t length);
+
+//loc_eng_xtra functions
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks);
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length);
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, int check);
+
+//loc_eng_ni functions
+extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data,
+ GpsNiExtCallbacks *callbacks);
+extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response);
+extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough);
+extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length);
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks);
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // LOC_ENG_H
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_agps.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_agps.cpp
new file mode 100644
index 0000000..5016b5c
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -0,0 +1,970 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng_agps.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <platform_lib_includes.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_dmn_conn.h>
+#include <sys/time.h>
+
+//======================================================================
+// C callbacks
+//======================================================================
+
+// This is given to linked_list_add as the dealloc callback
+// data -- an instance of Subscriber
+static void deleteObj(void* data)
+{
+ delete (Subscriber*)data;
+}
+
+// This is given to linked_list_search() as the comparison callback
+// when the state manchine needs to process for particular subscriber
+// fromCaller -- caller provides this obj
+// fromList -- linked_list_search() function take this one from list
+static bool hasSubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ return s1->forMe(*notification);
+}
+
+// This is gvien to linked_list_search() to notify subscriber objs
+// when the state machine needs to inform all subscribers of resource
+// status changes, e.g. when resource is GRANTED.
+// fromCaller -- caller provides this ptr to a Notification obj.
+// fromList -- linked_list_search() function take this one from list
+static bool notifySubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ // we notify every subscriber indiscriminatively
+ // each subscriber decides if this notification is interesting.
+ return s1->notifyRsrcStatus(*notification) &&
+ // if we do not want to delete the subscriber from the
+ // the list, we must set this to false so this function
+ // returns false
+ notification->postNotifyDelete;
+}
+
+//======================================================================
+// Notification
+//======================================================================
+const int Notification::BROADCAST_ALL = 0x80000000;
+const int Notification::BROADCAST_ACTIVE = 0x80000001;
+const int Notification::BROADCAST_INACTIVE = 0x80000002;
+const unsigned char DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const unsigned int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+//======================================================================
+// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
+//======================================================================
+bool Subscriber::forMe(Notification ¬ification)
+{
+ if (NULL != notification.rcver) {
+ return equals(notification.rcver);
+ } else {
+ return Notification::BROADCAST_ALL == notification.groupID ||
+ (Notification::BROADCAST_ACTIVE == notification.groupID &&
+ !isInactive()) ||
+ (Notification::BROADCAST_INACTIVE == notification.groupID &&
+ isInactive());
+ }
+}
+bool BITSubscriber::equals(const Subscriber *s) const
+{
+ BITSubscriber* bitS = (BITSubscriber*)s;
+
+ return (ID == bitS->ID &&
+ (INADDR_NONE != (unsigned int)ID ||
+ 0 == strncmp(mIPv6Addr, bitS->mIPv6Addr, sizeof(mIPv6Addr))));
+}
+
+bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ ((LocEngAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_DENIED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ case RSRC_GRANTED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ break;
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+bool DSSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+ LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
+ if(notify) {
+ switch(notification.rsrcStatus) {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ case RSRC_GRANTED:
+ ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
+ break;
+ default:
+ notify = false;
+ }
+ }
+ return notify;
+}
+void DSSubscriber :: setInactive()
+{
+ mIsInactive = true;
+ ((DSStateMachine *)mStateMachine)->informStatus(RSRC_UNSUBSCRIBE, ID);
+}
+//======================================================================
+// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
+//======================================================================
+
+// AgpsReleasedState
+class AgpsReleasedState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasedState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasedState = this; }
+
+ inline ~AgpsReleasedState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasedState";}
+};
+
+AgpsState* AgpsReleasedState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ LOC_LOGD("AgpsReleasedState::onRsrcEvent; event:%d\n", (int)event);
+ if (mStateMachine->hasSubscribers()) {
+ LOC_LOGE("Error: %s subscriber list not empty!!!", whoami());
+ // I don't know how to recover from it. I am adding this rather
+ // for debugging purpose.
+ }
+
+ AgpsState* nextState = this;
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // no notification until we get RSRC_GRANTED
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // request from connecivity service for NIF
+ //The if condition is added so that if the data call setup fails
+ //for DS State Machine, we want to retry in released state.
+ //for AGps State Machine, sendRsrcRequest() will always return success
+ if(!mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN)) {
+ // move the state to PENDING
+ nextState = mPendingState;
+ }
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ // the list should really be empty, nothing to remove.
+ // but we might as well just tell the client it is
+ // unsubscribed. False tolerance, right?
+ Subscriber* subscriber = (Subscriber*) data;
+ Notification notification(subscriber, event, false);
+ subscriber->notifyRsrcStatus(notification);
+ }
+ // break;
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ default:
+ LOC_LOGW("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ break;
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsPendingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsPendingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mPendingState = this; }
+
+ inline ~AgpsPendingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsPendingState";}
+};
+
+AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsPendingState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_ACTIVE, event, false);
+ // notify all subscribers NIF resource GRANTED
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_RELEASED:
+ // no state change.
+ // we are expecting either GRANTED or DENIED. Handling RELEASED
+ // may like break our state machine in race conditions.
+ break;
+
+ case RSRC_DENIED:
+ {
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // notify all subscribers NIF resource RELEASED or DENIED
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+
+class AgpsAcquiredState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsAcquiredState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mAcquiredState = this; }
+
+ inline ~AgpsAcquiredState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() { return (char*)"AgpsAcquiredState"; }
+};
+
+
+AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;
+ LOC_LOGD("AgpsAcquiredState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // we already have the NIF resource, simply notify subscriber
+ Subscriber* subscriber = (Subscriber*) data;
+ // we have rsrc in hand, so grant it right away
+ Notification notification(subscriber, RSRC_GRANTED, false);
+ subscriber->notifyRsrcStatus(notification);
+ // add subscriber to the list
+ mStateMachine->addSubscriber(subscriber);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ LOC_LOGW("%s: %d, RSRC_GRANTED already received", whoami(), event);
+ // no state change.
+ break;
+
+ case RSRC_RELEASED:
+ {
+ LOC_LOGW("%s: %d, a force rsrc release", whoami(), event);
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_DENIED:
+ // no state change.
+ // we are expecting RELEASED. Handling DENIED
+ // may like break our state machine in race conditions.
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsReleasingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasingState = this; }
+
+ inline ~AgpsReleasingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasingState";}
+};
+
+AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsReleasingState::onRsrcEvent; event:%d\n", (int)event);
+
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_DENIED:
+ // A race condition subscriber unsubscribes before AFW denies resource.
+ case RSRC_RELEASED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_INACTIVE, event, true);
+ // notify all subscribers that are active NIF resource RELEASE
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+
+ if (mStateMachine->hasActiveSubscribers()) {
+ nextState = mPendingState;
+ // request from connecivity service for NIF
+ mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN);
+ } else {
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+//======================================================================
+//Servicer
+//======================================================================
+Servicer* Servicer :: getServicer(servicerType type, void *cb_func)
+{
+ LOC_LOGD(" Enter getServicer type:%d\n", (int)type);
+ switch(type) {
+ case servicerTypeNoCbParam:
+ return (new Servicer(cb_func));
+ case servicerTypeExt:
+ return (new ExtServicer(cb_func));
+ case servicerTypeAgps:
+ return (new AGpsServicer(cb_func));
+ default:
+ return NULL;
+ }
+}
+
+int Servicer :: requestRsrc(void *cb_data)
+{
+ callback();
+ return 0;
+}
+
+int ExtServicer :: requestRsrc(void *cb_data)
+{
+ int ret=-1;
+ LOC_LOGD("Enter ExtServicer :: requestRsrc\n");
+ ret = callbackExt(cb_data);
+ LOC_LOGD("Exit ExtServicer :: requestRsrc\n");
+ return(ret);
+}
+
+int AGpsServicer :: requestRsrc(void *cb_data)
+{
+ callbackAGps((AGpsStatus *)cb_data);
+ return 0;
+}
+
+//======================================================================
+// AgpsStateMachine
+//======================================================================
+
+AgpsStateMachine::AgpsStateMachine(servicerType servType,
+ void *cb_func,
+ AGpsExtType type,
+ bool enforceSingleSubscriber) :
+ mStatePtr(new AgpsReleasedState(this)),mType(type),
+ mAPN(NULL),
+ mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID),
+ mEnforceSingleSubscriber(enforceSingleSubscriber),
+ mServicer(Servicer :: getServicer(servType, (void *)cb_func))
+{
+ linked_list_init(&mSubscribers);
+
+ // setting up mReleasedState
+ mStatePtr->mPendingState = new AgpsPendingState(this);
+ mStatePtr->mAcquiredState = new AgpsAcquiredState(this);
+ mStatePtr->mReleasingState = new AgpsReleasingState(this);
+
+ // setting up mAcquiredState
+ mStatePtr->mAcquiredState->mReleasedState = mStatePtr;
+ mStatePtr->mAcquiredState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mAcquiredState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mPendingState
+ mStatePtr->mPendingState->mAcquiredState = mStatePtr->mAcquiredState;
+ mStatePtr->mPendingState->mReleasedState = mStatePtr;
+ mStatePtr->mPendingState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mReleasingState
+ mStatePtr->mReleasingState->mReleasedState = mStatePtr;
+ mStatePtr->mReleasingState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mReleasingState->mAcquiredState = mStatePtr->mAcquiredState;
+}
+
+AgpsStateMachine::~AgpsStateMachine()
+{
+ dropAllSubscribers();
+
+ // free the 3 states. We must read out all 3 pointers first.
+ // Otherwise we run the risk of getting pointers from already
+ // freed memory.
+ AgpsState* acquiredState = mStatePtr->mAcquiredState;
+ AgpsState* releasedState = mStatePtr->mReleasedState;
+ AgpsState* pendindState = mStatePtr->mPendingState;
+ AgpsState* releasingState = mStatePtr->mReleasingState;
+
+ delete acquiredState;
+ delete releasedState;
+ delete pendindState;
+ delete releasingState;
+ delete mServicer;
+ linked_list_destroy(&mSubscribers);
+
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ mAPN = NULL;
+ }
+}
+
+void AgpsStateMachine::setAPN(const char* apn, unsigned int len)
+{
+ if (NULL != mAPN) {
+ delete mAPN;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ memcpy(mAPN, apn, len);
+ mAPN[len] = NULL;
+
+ mAPNLen = len;
+ } else {
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+}
+
+void AgpsStateMachine::onRsrcEvent(AgpsRsrcStatus event)
+{
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+}
+
+void AgpsStateMachine::notifySubscribers(Notification& notification) const
+{
+ if (notification.postNotifyDelete) {
+ // just any non NULL value to get started
+ Subscriber* s = (Subscriber*)~0;
+ while (NULL != s) {
+ s = NULL;
+ // if the last param sets to true, _search will delete
+ // the node from the list for us. But the problem is
+ // once that is done, _search returns, leaving the
+ // rest of the list unprocessed. So we need a loop.
+ linked_list_search(mSubscribers, (void**)&s, notifySubscriber,
+ (void*)¬ification, true);
+ delete s;
+ }
+ } else {
+ // no loop needed if it the last param sets to false, which
+ // mean nothing gets deleted from the list.
+ linked_list_search(mSubscribers, NULL, notifySubscriber,
+ (void*)¬ification, false);
+ }
+}
+
+void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL == s) {
+ linked_list_add(mSubscribers, subscriber->clone(), deleteObj);
+ }
+}
+
+int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+
+ if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) {
+ AGpsExtStatus nifRequest;
+ nifRequest.size = sizeof(nifRequest);
+ nifRequest.type = mType;
+ nifRequest.status = action;
+
+ if (s == NULL) {
+ nifRequest.ipv4_addr = INADDR_NONE;
+ memset(&nifRequest.addr, 0, sizeof(nifRequest.addr));
+ nifRequest.ssid[0] = '\0';
+ nifRequest.password[0] = '\0';
+ } else {
+ s->setIPAddresses(nifRequest.addr);
+ s->setWifiInfo(nifRequest.ssid, nifRequest.password);
+ }
+
+ CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
+ mServicer->requestRsrc((void *)&nifRequest);
+ }
+ return 0;
+}
+
+void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
+{
+ if (mEnforceSingleSubscriber && hasSubscribers()) {
+ Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
+ notifySubscriber(¬ification, subscriber);
+ } else {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
+ }
+}
+
+bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL != s) {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_UNSUBSCRIBE, (void*)s);
+ return true;
+ }
+ return false;
+}
+
+bool AgpsStateMachine::hasActiveSubscribers() const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+ return NULL != s;
+}
+
+//======================================================================
+// DSStateMachine
+//======================================================================
+void delay_callback(void *callbackData, int result)
+{
+ if(callbackData) {
+ DSStateMachine *DSSMInstance = (DSStateMachine *)callbackData;
+ DSSMInstance->retryCallback();
+ }
+ else {
+ LOC_LOGE(" NULL argument received. Failing.\n");
+ goto err;
+ }
+err:
+ return;
+}
+
+DSStateMachine :: DSStateMachine(servicerType type, void *cb_func,
+ LocEngAdapter* adapterHandle):
+ AgpsStateMachine(type, cb_func, AGPS_TYPE_INVALID,false),
+ mLocAdapter(adapterHandle)
+{
+ LOC_LOGD("%s:%d]: New DSStateMachine\n", __func__, __LINE__);
+ mRetries = 0;
+}
+
+void DSStateMachine :: retryCallback(void)
+{
+ DSSubscriber *subscriber = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&subscriber, hasSubscriber,
+ (void*)¬ification, false);
+ if(subscriber)
+ mLocAdapter->requestSuplES(subscriber->ID);
+ else
+ LOC_LOGE("DSStateMachine :: retryCallback: No subscriber found." \
+ "Cannot retry data call\n");
+ return;
+}
+
+int DSStateMachine :: sendRsrcRequest(AGpsStatusValue action) const
+{
+ DSSubscriber* s = NULL;
+ dsCbData cbData;
+ int ret=-1;
+ int connHandle=-1;
+ LOC_LOGD("Enter DSStateMachine :: sendRsrcRequest\n");
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+ if(s) {
+ connHandle = s->ID;
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - subscriber found\n");
+ }
+ else
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - No subscriber found\n");
+
+ cbData.action = action;
+ cbData.mAdapter = mLocAdapter;
+ ret = mServicer->requestRsrc((void *)&cbData);
+ //Only the request to start data call returns a success/failure
+ //The request to stop data call will always succeed
+ //Hence, the below block will only be executed when the
+ //request to start the data call fails
+ switch(ret) {
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - Failure returned: %d\n",ret);
+ ((DSStateMachine *)this)->incRetries();
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+ LOC_LOGE(" Failed to start Data call. Fallback to normal ATL SUPL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ }
+ else {
+ if(loc_timer_start(DATA_CALL_RETRY_DELAY_MSEC, delay_callback, (void *)this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ ret = -1;
+ goto err;
+ }
+ }
+ break;
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No profile found for emergency call. Fallback to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("%s:%d]: Request to start data call sent\n", __func__, __LINE__);
+ break;
+ case -1:
+ //One of the ways this case can be encountered is if the callback function
+ //receives a null argument, it just exits with -1 error
+ LOC_LOGE("Error: Something went wrong somewhere. Falling back to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Unrecognized return value\n", __func__, __LINE__);
+ }
+err:
+ LOC_LOGD("EXIT DSStateMachine :: sendRsrcRequest; ret = %d\n", ret);
+ return ret;
+}
+
+void DSStateMachine :: onRsrcEvent(AgpsRsrcStatus event)
+{
+ void* currState = (void *)mStatePtr;
+ LOC_LOGD("Enter DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_GRANTED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ case RSRC_RELEASED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_RELEASED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ //To handle the case where we get a RSRC_RELEASED in
+ //pending state, we translate that to a RSRC_DENIED state
+ //since the callback from DSI is either RSRC_GRANTED or RSRC_RELEASED
+ //for when the call is connected or disconnected respectively.
+ if((void *)mStatePtr != currState)
+ break;
+ else {
+ event = RSRC_DENIED;
+ LOC_LOGE(" Switching event to RSRC_DENIED\n");
+ }
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+ LOC_LOGD("Exit DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+}
+
+void DSStateMachine :: informStatus(AgpsRsrcStatus status, int ID) const
+{
+ LOC_LOGD("DSStateMachine :: informStatus. Status=%d\n",(int)status);
+ switch(status) {
+ case RSRC_UNSUBSCRIBE:
+ mLocAdapter->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_RELEASED:
+ mLocAdapter->closeDataCall();
+ break;
+ case RSRC_DENIED:
+ ((DSStateMachine *)this)->mRetries = 0;
+ mLocAdapter->requestATL(ID, AGPS_TYPE_SUPL);
+ break;
+ case RSRC_GRANTED:
+ mLocAdapter->atlOpenStatus(ID, 1,
+ NULL,
+ AGPS_APN_BEARER_INVALID,
+ AGPS_TYPE_INVALID);
+ break;
+ default:
+ LOC_LOGW("DSStateMachine :: informStatus - unknown status");
+ }
+ return;
+}
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_agps.h b/msm8909/loc_api/libloc_api_50001/loc_eng_agps.h
new file mode 100644
index 0000000..2d689ce
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -0,0 +1,431 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_ENG_AGPS_H__
+#define __LOC_ENG_AGPS_H__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_core_log.h>
+#include <linked_list.h>
+#include <loc_timer.h>
+#include <LocEngAdapter.h>
+
+// forward declaration
+class AgpsStateMachine;
+class Subscriber;
+
+// NIF resource events
+typedef enum {
+ RSRC_SUBSCRIBE,
+ RSRC_UNSUBSCRIBE,
+ RSRC_GRANTED,
+ RSRC_RELEASED,
+ RSRC_DENIED,
+ RSRC_STATUS_MAX
+} AgpsRsrcStatus;
+
+typedef enum {
+ servicerTypeNoCbParam,
+ servicerTypeAgps,
+ servicerTypeExt
+}servicerType;
+
+//DS Callback struct
+typedef struct {
+ LocEngAdapter *mAdapter;
+ AGpsStatusValue action;
+}dsCbData;
+
+// information bundle for subscribers
+struct Notification {
+ // goes to every subscriber
+ static const int BROADCAST_ALL;
+ // goes to every ACTIVE subscriber
+ static const int BROADCAST_ACTIVE;
+ // goes to every INACTIVE subscriber
+ static const int BROADCAST_INACTIVE;
+
+ // go to a specific subscriber
+ const Subscriber* rcver;
+ // broadcast
+ const int groupID;
+ // the new resource status event
+ const AgpsRsrcStatus rsrcStatus;
+ // should the subscriber be deleted after the notification
+ const bool postNotifyDelete;
+
+ // convenient constructor
+ inline Notification(const int broadcast,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(subscriber), groupID(-1), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const int broadcast) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber) :
+ rcver(subscriber), groupID(-1), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+};
+
+class AgpsState {
+ // allows AgpsStateMachine to access private data
+ // no class members are public. We don't want
+ // anyone but state machine to use state.
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+ // state transitions are done here.
+ // Each state implements its own transitions (of course).
+ inline virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data) = 0;
+
+protected:
+ // handle back to state machine
+ const AgpsStateMachine* mStateMachine;
+ // each state has pointers to all 3 states
+ // one of which is to itself.
+ AgpsState* mReleasedState;
+ AgpsState* mAcquiredState;
+ AgpsState* mPendingState;
+ AgpsState* mReleasingState;
+
+ inline AgpsState(const AgpsStateMachine *stateMachine) :
+ mStateMachine(stateMachine),
+ mReleasedState(NULL),
+ mAcquiredState(NULL),
+ mPendingState(NULL),
+ mReleasingState(NULL) {}
+ virtual ~AgpsState() {}
+
+public:
+ // for logging purpose
+ inline virtual char* whoami() = 0;
+};
+
+class Servicer {
+ void (*callback)(void);
+public:
+ static Servicer* getServicer(servicerType type, void *cb_func);
+ virtual int requestRsrc(void *cb_data);
+ Servicer() {}
+ Servicer(void *cb_func)
+ { callback = (void(*)(void))(cb_func); }
+ virtual ~Servicer(){}
+ inline virtual char *whoami() {return (char*)"Servicer";}
+};
+
+class ExtServicer : public Servicer {
+ int (*callbackExt)(void *cb_data);
+public:
+ int requestRsrc(void *cb_data);
+ ExtServicer() {}
+ ExtServicer(void *cb_func)
+ { callbackExt = (int(*)(void *))(cb_func); }
+ virtual ~ExtServicer(){}
+ inline virtual char *whoami() {return (char*)"ExtServicer";}
+};
+
+class AGpsServicer : public Servicer {
+ void (*callbackAGps)(AGpsStatus* status);
+public:
+ int requestRsrc(void *cb_data);
+ AGpsServicer() {}
+ AGpsServicer(void *cb_func)
+ { callbackAGps = (void(*)(AGpsStatus *))(cb_func); }
+ virtual ~AGpsServicer(){}
+ inline virtual char *whoami() {return (char*)"AGpsServicer";}
+};
+
+class AgpsStateMachine {
+protected:
+ // a linked list of subscribers.
+ void* mSubscribers;
+ //handle to whoever provides the service
+ Servicer *mServicer;
+ // allows AgpsState to access private data
+ // each state is really internal data to the
+ // state machine, so it should be able to
+ // access anything within the state machine.
+ friend class AgpsState;
+ // pointer to the current state.
+ AgpsState* mStatePtr;
+private:
+ // NIF type: AGNSS or INTERNET.
+ const AGpsExtType mType;
+ // apn to the NIF. Each state machine tracks
+ // resource state of a particular NIF. For each
+ // NIF, there is also an active APN.
+ char* mAPN;
+ // for convenience, we don't do strlen each time.
+ unsigned int mAPNLen;
+ // bear
+ AGpsBearerType mBearer;
+ // ipv4 address for routing
+ bool mEnforceSingleSubscriber;
+
+public:
+ AgpsStateMachine(servicerType servType, void *cb_func,
+ AGpsExtType type, bool enforceSingleSubscriber);
+ virtual ~AgpsStateMachine();
+
+ // self explanatory methods below
+ void setAPN(const char* apn, unsigned int len);
+ inline const char* getAPN() const { return (const char*)mAPN; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return (AGpsExtType)mType; }
+
+ // someone, a ATL client or BIT, is asking for NIF
+ void subscribeRsrc(Subscriber *subscriber);
+
+ // someone, a ATL client or BIT, is done with NIF
+ bool unsubscribeRsrc(Subscriber *subscriber);
+
+ // add a subscriber in the linked list, if not already there.
+ void addSubscriber(Subscriber* subscriber) const;
+
+ virtual void onRsrcEvent(AgpsRsrcStatus event);
+
+ // put the data together and send the FW
+ virtual int sendRsrcRequest(AGpsStatusValue action) const;
+
+ //if list is empty, linked_list_empty returns 1
+ //else if list is not empty, returns 0
+ //so hasSubscribers() returns 1 if list is not empty
+ //and returns 0 if list is empty
+ inline bool hasSubscribers() const
+ { return !linked_list_empty(mSubscribers); }
+
+ bool hasActiveSubscribers() const;
+
+ inline void dropAllSubscribers() const
+ { linked_list_flush(mSubscribers); }
+
+ // private. Only a state gets to call this.
+ void notifySubscribers(Notification& notification) const;
+
+};
+
+class DSStateMachine : public AgpsStateMachine {
+ static const unsigned char MAX_START_DATA_CALL_RETRIES;
+ static const unsigned int DATA_CALL_RETRY_DELAY_MSEC;
+ LocEngAdapter* mLocAdapter;
+ unsigned char mRetries;
+public:
+ DSStateMachine(servicerType type,
+ void *cb_func,
+ LocEngAdapter* adapterHandle);
+ int sendRsrcRequest(AGpsStatusValue action) const;
+ void onRsrcEvent(AgpsRsrcStatus event);
+ void retryCallback();
+ void informStatus(AgpsRsrcStatus status, int ID) const;
+ inline void incRetries() {mRetries++;}
+ inline virtual char *whoami() {return (char*)"DSStateMachine";}
+};
+
+// each subscriber is a AGPS client. In the case of ATL, there could be
+// multiple clients from modem. In the case of BIT, there is only one
+// cilent from BIT daemon.
+struct Subscriber {
+ const uint32_t ID;
+ const AgpsStateMachine* mStateMachine;
+ inline Subscriber(const int id,
+ const AgpsStateMachine* stateMachine) :
+ ID(id), mStateMachine(stateMachine) {}
+ inline virtual ~Subscriber() {}
+
+ virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ virtual void setIPAddresses(struct sockaddr_storage& addr) = 0;
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ { ssid[0] = 0; password[0] = 0; }
+
+ inline virtual bool equals(const Subscriber *s) const
+ { return ID == s->ID; }
+
+ // notifies a subscriber a new NIF resource status, usually
+ // either GRANTE, DENIED, or RELEASED
+ virtual bool notifyRsrcStatus(Notification ¬ification) = 0;
+
+ virtual bool waitForCloseComplete() { return false; }
+ virtual void setInactive() {}
+ virtual bool isInactive() { return false; }
+
+ virtual Subscriber* clone() = 0;
+ // checks if this notification is for me, i.e.
+ // either has my id, or has a broadcast id.
+ bool forMe(Notification ¬ification);
+};
+
+// BITSubscriber, created with requests from BIT daemon
+struct BITSubscriber : public Subscriber {
+ char mIPv6Addr[16];
+
+ inline BITSubscriber(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ Subscriber(ipv4, stateMachine)
+ {
+ if (NULL == ipv6) {
+ mIPv6Addr[0] = 0;
+ } else {
+ memcpy(mIPv6Addr, ipv6, sizeof(mIPv6Addr));
+ }
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ }
+
+ virtual Subscriber* clone()
+ {
+ return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
+ }
+
+ virtual bool equals(const Subscriber *s) const;
+ inline virtual ~BITSubscriber(){}
+};
+
+// ATLSubscriber, created with requests from ATL
+struct ATLSubscriber : public Subscriber {
+ const LocEngAdapter* mLocAdapter;
+ const bool mBackwardCompatibleMode;
+ inline ATLSubscriber(const int id,
+ const AgpsStateMachine* stateMachine,
+ const LocEngAdapter* adapter,
+ const bool compatibleMode) :
+ Subscriber(id, stateMachine), mLocAdapter(adapter),
+ mBackwardCompatibleMode(compatibleMode){}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = INADDR_NONE; v6[0] = 0; }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual Subscriber* clone()
+ {
+ return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
+ mBackwardCompatibleMode);
+ }
+ inline virtual ~ATLSubscriber(){}
+};
+
+// WIFISubscriber, created with requests from MSAPM or QuIPC
+struct WIFISubscriber : public Subscriber {
+ char * mSSID;
+ char * mPassword;
+ loc_if_req_sender_id_e_type senderId;
+ bool mIsInactive;
+ inline WIFISubscriber(const AgpsStateMachine* stateMachine,
+ char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
+ Subscriber(sender_id, stateMachine),
+ mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
+ senderId(sender_id)
+ {
+ if (NULL != mSSID)
+ strlcpy(mSSID, ssid, SSID_BUF_SIZE);
+ if (NULL != mPassword)
+ strlcpy(mPassword, password, SSID_BUF_SIZE);
+ mIsInactive = false;
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ {
+ if (NULL != mSSID)
+ strlcpy(ssid, mSSID, SSID_BUF_SIZE);
+ else
+ ssid[0] = '\0';
+ if (NULL != mPassword)
+ strlcpy(password, mPassword, SSID_BUF_SIZE);
+ else
+ password[0] = '\0';
+ }
+
+ inline virtual bool waitForCloseComplete() { return true; }
+
+ inline virtual void setInactive() { mIsInactive = true; }
+ inline virtual bool isInactive() { return mIsInactive; }
+
+ virtual Subscriber* clone()
+ {
+ return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
+ }
+ inline virtual ~WIFISubscriber(){}
+};
+
+struct DSSubscriber : public Subscriber {
+ bool mIsInactive;
+ inline DSSubscriber(const AgpsStateMachine *stateMachine,
+ const int id) :
+ Subscriber(id, stateMachine)
+ {
+ mIsInactive = false;
+ }
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+ virtual Subscriber* clone()
+ {return new DSSubscriber(mStateMachine, ID);}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+ inline virtual bool waitForCloseComplete() { return true; }
+ virtual void setInactive();
+ inline virtual bool isInactive()
+ { return mIsInactive; }
+ inline virtual ~DSSubscriber(){}
+ inline virtual char *whoami() {return (char*)"DSSubscriber";}
+};
+
+#endif //__LOC_ENG_AGPS_H__
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
new file mode 100644
index 0000000..c257dff
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2011-2012, 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 <linux/stat.h>
+#include <fcntl.h>
+#include <linux/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <grp.h>
+#include <sys/stat.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_msg.h"
+
+static int loc_api_server_msgqid;
+static int loc_api_resp_msgqid;
+static int quipc_msgqid;
+static int msapm_msgqid;
+static int msapu_msgqid;
+
+static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
+static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
+static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
+static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
+static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
+
+static int loc_api_server_proc_init(void *context)
+{
+ loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
+ //change mode/group for the global_loc_api_q_path pipe
+ int result = chmod (global_loc_api_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
+ }
+
+ struct group * gps_group = getgrnam("gps");
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_q_path, gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+ else
+ {
+ LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
+ }
+
+ loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
+
+ //change mode/group for the global_loc_api_resp_q_path pipe
+ result = chmod (global_loc_api_resp_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
+ }
+
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_resp_q_path,
+ gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+
+ quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
+ msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
+ msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
+
+ LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
+ return 0;
+}
+
+static int loc_api_server_proc_pre(void *context)
+{
+ return 0;
+}
+
+static int loc_api_server_proc(void *context)
+{
+ int length, sz;
+ int result = 0;
+ static int cnt = 0;
+ struct ctrl_msgbuf * p_cmsgbuf;
+ struct ctrl_msgbuf cmsg_resp;
+
+ sz = sizeof(struct ctrl_msgbuf) + 256;
+ p_cmsgbuf = (struct ctrl_msgbuf *) malloc(sz);
+
+ if (!p_cmsgbuf) {
+ LOC_LOGE("%s:%d] Out of memory\n", __func__, __LINE__);
+ return -1;
+ }
+
+ cnt ++;
+ LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
+ length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
+ if (length <= 0) {
+ free(p_cmsgbuf);
+ LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
+ usleep(1000);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ switch(p_cmsgbuf->ctrl_type) {
+ case GPSONE_LOC_API_IF_REQUEST:
+ result = loc_eng_dmn_conn_loc_api_server_if_request_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_LOC_API_IF_RELEASE:
+ result = loc_eng_dmn_conn_loc_api_server_if_release_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_UNBLOCK:
+ LOC_LOGD("%s:%d] GPSONE_UNBLOCK\n", __func__, __LINE__);
+ break;
+
+ default:
+ LOC_LOGE("%s:%d] unsupported ctrl_type = %d\n",
+ __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ break;
+ }
+
+ free(p_cmsgbuf);
+ return 0;
+}
+
+static int loc_api_server_proc_post(void *context)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
+ return 0;
+}
+
+static int loc_eng_dmn_conn_unblock_proc(void)
+{
+ struct ctrl_msgbuf cmsgbuf;
+ cmsgbuf.ctrl_type = GPSONE_UNBLOCK;
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgsnd(loc_api_server_msgqid, & cmsgbuf, sizeof(cmsgbuf));
+ return 0;
+}
+
+static struct loc_eng_dmn_conn_thelper thelper;
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * resp_q_path, void *agps_handle)
+{
+ int result;
+
+ loc_api_handle = agps_handle;
+
+ if (loc_api_q_path) global_loc_api_q_path = loc_api_q_path;
+ if (resp_q_path) global_loc_api_resp_q_path = resp_q_path;
+
+ result = loc_eng_dmn_conn_launch_thelper( &thelper,
+ loc_api_server_proc_init,
+ loc_api_server_proc_pre,
+ loc_api_server_proc,
+ loc_api_server_proc_post,
+ create_thread_cb,
+ (char *) global_loc_api_q_path);
+ if (result != 0) {
+ LOC_LOGE("%s:%d]\n", __func__, __LINE__);
+ return -1;
+ }
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_unblock(void)
+{
+ loc_eng_dmn_conn_unblock_thelper(&thelper);
+ loc_eng_dmn_conn_unblock_proc();
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_join(void)
+{
+ loc_eng_dmn_conn_join_thelper(&thelper);
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
+ struct ctrl_msgbuf cmsgbuf;
+ LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
+ cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
+ cmsgbuf.cmsg.cmsg_response.result = status;
+ switch (sender_id) {
+ case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapu_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ default: {
+ LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
+ }
+ }
+ return 0;
+}
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
new file mode 100644
index 0000000..1d8c142
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
@@ -0,0 +1,59 @@
+/* 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_ENG_DATA_SERVER_H
+#define LOC_ENG_DATA_SERVER_H
+
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+#ifdef _ANDROID_
+
+#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q"
+
+#else
+
+#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
+
+#endif
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
+int loc_eng_dmn_conn_loc_api_server_unblock(void);
+int loc_eng_dmn_conn_loc_api_server_join(void);
+int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
+
+#endif /* LOC_ENG_DATA_SERVER_H */
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
new file mode 100644
index 0000000..a1076ff
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -0,0 +1,223 @@
+/* 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.
+ *
+ */
+#include <linux/stat.h>
+#include <fcntl.h>
+
+#include <linux/types.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgget
+
+DESCRIPTION
+ This function get a message queue
+
+ q_path - name path of the message queue
+ mode -
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ message queue id
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode)
+{
+ int msgqid;
+ msgqid = loc_eng_dmn_conn_glue_pipeget(q_path, mode);
+ return msgqid;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgremove
+
+DESCRIPTION
+ remove a message queue
+
+ q_path - name path of the message queue
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid)
+{
+ int result;
+ result = loc_eng_dmn_conn_glue_piperemove(q_path, msgqid);
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgsnd
+
+DESCRIPTION
+ Send a message
+
+ msgqid - message queue id
+ msgp - pointer to the message to be sent
+ msgsz - size of the message
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes sent out or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+ pmsg->msgsz = msgsz;
+
+ result = loc_eng_dmn_conn_glue_pipewrite(msgqid, msgp, msgsz);
+ if (result != (int) msgsz) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) msgsz);
+ return -1;
+ }
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgrcv
+
+DESCRIPTION
+ receive a message
+
+ msgqid - message queue id
+ msgp - pointer to the buffer to hold the message
+ msgsz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes received or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgbufsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, &(pmsg->msgsz), sizeof(pmsg->msgsz));
+ if (result != sizeof(pmsg->msgsz)) {
+ LOC_LOGE("%s:%d] pipe broken %d\n", __func__, __LINE__, result);
+ return -1;
+ }
+
+ if (msgbufsz < pmsg->msgsz) {
+ LOC_LOGE("%s:%d] msgbuf is too small %d < %d\n", __func__, __LINE__, (int) msgbufsz, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, (uint8_t *) msgp + sizeof(pmsg->msgsz), pmsg->msgsz - sizeof(pmsg->msgsz));
+ if (result != (int) (pmsg->msgsz - sizeof(pmsg->msgsz))) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ return pmsg->msgsz;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgunblock
+
+DESCRIPTION
+ unblock a message queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid)
+{
+ return loc_eng_dmn_conn_glue_pipeunblock(msgqid);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgflush
+
+DESCRIPTION
+ flush out the message in a queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes that are flushed out.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgflush(int msgqid)
+{
+ int length;
+ char buf[128];
+
+ do {
+ length = loc_eng_dmn_conn_glue_piperead(msgqid, buf, 128);
+ LOC_LOGD("%s:%d] %s\n", __func__, __LINE__, buf);
+ } while(length);
+ return length;
+}
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
new file mode 100644
index 0000000..d685c87
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
@@ -0,0 +1,51 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_MSG_H
+#define LOC_ENG_DMN_CONN_GLUE_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#include <linux/types.h>
+#include "loc_eng_dmn_conn_glue_pipe.h"
+
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode);
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid);
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgflush(int msgqid);
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
new file mode 100644
index 0000000..dffcad0
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -0,0 +1,214 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+// #include <linux/stat.h>
+#include <fcntl.h>
+// #include <linux/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "loc_eng_dmn_conn_glue_pipe.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeget
+
+DESCRIPTION
+ create a named pipe.
+
+ pipe_name - pipe name path
+ mode - mode
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
+{
+ int fd;
+ int result;
+
+ LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
+ result = mkfifo(pipe_name, 0660);
+
+ if ((result == -1) && (errno != EEXIST)) {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ return result;
+ }
+
+ // The mode in mkfifo is not honoured and does not provide the
+ // group permissions. Doing chmod to add group permissions.
+ result = chmod (pipe_name, 0660);
+ if (result != 0){
+ LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
+ pipe_name, strerror(errno));
+ }
+
+ fd = open(pipe_name, mode);
+ if (fd <= 0)
+ {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ }
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return fd;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperemove
+
+DESCRIPTION
+ remove a pipe
+
+ pipe_name - pipe name path
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd)
+{
+ close(fd);
+ if (pipe_name) unlink(pipe_name);
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipewrite
+
+DESCRIPTION
+ write to a pipe
+
+ fd - fd of a pipe
+ buf - buffer for the data to write
+ sz - size of the data in buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes written or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz)
+{
+ int result;
+
+ result = write(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, result = %d\n", fd, (long) buf, (int) sz, (int) result); */
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperead
+
+DESCRIPTION
+ read from a pipe
+
+ fd - fd for the pipe
+ buf - buffer to hold the data read from pipe
+ sz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes read from pipe or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz)
+{
+ int len;
+
+ len = read(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, len = %d\n", fd, (long) buf, (int) sz, len); */
+ return len;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeunblock
+
+DESCRIPTION
+ unblock a pipe
+
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 for success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeunblock(int fd)
+{
+ int result;
+ struct flock flock_v;
+ LOC_LOGD("\n");
+// result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY);
+ flock_v.l_type = F_UNLCK;
+ flock_v.l_len = 32;
+ result = fcntl(fd, F_SETLK, &flock_v);
+ if (result < 0) {
+ LOC_LOGE("fcntl failure, %s\n", strerror(errno));
+ }
+
+ return result;
+}
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
new file mode 100644
index 0000000..b2fa3a0
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
@@ -0,0 +1,50 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_PIPE_H
+#define LOC_ENG_DMN_CONN_GLUE_PIPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <linux/types.h>
+
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode);
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd);
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz);
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz);
+
+int loc_eng_dmn_conn_glue_pipeflush(int fd);
+int loc_eng_dmn_conn_glue_pipeunblock(int fd);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
new file mode 100644
index 0000000..edd53f2
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-2012, 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 <string.h>
+#include <unistd.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_msg.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+void* loc_api_handle = NULL;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ if (NULL == loc_api_handle) {
+ LOC_LOGE("%s:%d] NO agps data handle\n", __func__, __LINE__);
+ return 1;
+ }
+
+ if (NULL != loc_api_handle) {
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ true);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+ }
+
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+#endif
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ false);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+#endif
+ return 0;
+}
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
new file mode 100644
index 0000000..1c0edd5
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_HANDLER
+#define LOC_ENG_DATA_SERVER_HANDLER
+
+#include <linux/types.h>
+#include <arpa/inet.h>
+
+//for SSID_BUF_SIZE
+#include <hardware/gps.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+
+enum {
+ /* 0x0 - 0xEF is reserved for daemon internal */
+ GPSONE_LOC_API_IF_REQUEST = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE,
+ GPSONE_LOC_API_RESPONSE,
+ GPSONE_UNBLOCK,
+};
+
+enum {
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS,
+ GPSONE_LOC_API_IF_FAILURE,
+};
+
+
+struct ctrl_msg_response {
+ int result;
+};
+
+struct ctrl_msg_unblock {
+ int reserved;
+};
+
+typedef enum {
+ IF_REQUEST_TYPE_SUPL = 0,
+ IF_REQUEST_TYPE_WIFI,
+ IF_REQUEST_TYPE_ANY
+} ctrl_if_req_type_e_type;
+
+typedef enum {
+ IF_REQUEST_SENDER_ID_QUIPC = 0,
+ IF_REQUEST_SENDER_ID_MSAPM,
+ IF_REQUEST_SENDER_ID_MSAPU,
+ IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ IF_REQUEST_SENDER_ID_MODEM
+} ctrl_if_req_sender_id_e_type;
+
+struct ctrl_msg_if_request {
+ ctrl_if_req_type_e_type type;
+ ctrl_if_req_sender_id_e_type sender_id;
+ unsigned long ipv4_addr;
+ unsigned char ipv6_addr[16];
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+};
+
+/* do not change this structure */
+struct ctrl_msgbuf {
+ size_t msgsz;
+ uint16_t reserved1;
+ uint32_t reserved2;
+ uint8_t ctrl_type;
+ union {
+ struct ctrl_msg_response cmsg_response;
+ struct ctrl_msg_unblock cmsg_unblock;
+ struct ctrl_msg_if_request cmsg_if_request;
+ } cmsg;
+};
+
+extern void* loc_api_handle;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
+
+#endif /* LOC_ENG_DATA_SERVER_HANDLER */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
new file mode 100644
index 0000000..9fed9d4
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -0,0 +1,399 @@
+/* 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.
+ *
+ */
+#include <stdio.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+/*===========================================================================
+FUNCTION thelper_signal_init
+
+DESCRIPTION
+ This function will initialize the conditional variable resources.
+
+ thelper - thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+ thelper->thread_exit = 0;
+ thelper->thread_ready = 0;
+ result = pthread_cond_init( &thelper->thread_cond, NULL);
+ if (result) {
+ return result;
+ }
+
+ result = pthread_mutex_init(&thelper->thread_mutex, NULL);
+ if (result) {
+ pthread_cond_destroy(&thelper->thread_cond);
+ }
+ return result;
+}
+
+/*===========================================================================
+FUNCTION
+
+DESCRIPTION
+ This function will destroy the conditional variable resources
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result, ret_result = 0;
+ result = pthread_cond_destroy( &thelper->thread_cond);
+ if (result) {
+ ret_result = result;
+ }
+
+ result = pthread_mutex_destroy(&thelper->thread_mutex);
+ if (result) {
+ ret_result = result;
+ }
+
+ return ret_result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_wait
+
+DESCRIPTION
+ This function will be blocked on the conditional variable until thelper_signal_ready
+ is called
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = 0;
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ if (!thelper->thread_ready && !thelper->thread_exit) {
+ result = pthread_cond_wait(&thelper->thread_cond, &thelper->thread_mutex);
+ }
+
+ if (thelper->thread_exit) {
+ result = -1;
+ }
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_ready
+
+DESCRIPTION
+ This function will wake up the conditional variable
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 1;
+ result = pthread_cond_signal(&thelper->thread_cond);
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_block
+
+DESCRIPTION
+ This function will set the thread ready to 0 to block the thelper_signal_wait
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ if thread_ready is set
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = thelper->thread_ready;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 0;
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_main
+
+DESCRIPTION
+ This function is the main thread. It will be launched as a child thread
+
+ data - pointer to the instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ NULL
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void * thelper_main(void *data)
+{
+ int result = 0;
+ struct loc_eng_dmn_conn_thelper * thelper = (struct loc_eng_dmn_conn_thelper *) data;
+
+ if (thelper->thread_proc_init) {
+ result = thelper->thread_proc_init(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ thelper_signal_ready(thelper);
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ thelper_signal_ready(thelper);
+
+ if (thelper->thread_proc_pre) {
+ result = thelper->thread_proc_pre(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ do {
+ if (thelper->thread_proc) {
+ result = thelper->thread_proc(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ }
+ } while (thelper->thread_exit == 0);
+
+ if (thelper->thread_proc_post) {
+ result = thelper->thread_proc_post(thelper->thread_context);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ return NULL;
+}
+
+static void thelper_main_2(void *data)
+{
+ thelper_main(data);
+ return;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_launch_thelper
+
+DESCRIPTION
+ This function will initialize the thread context and launch the thelper_main
+
+ thelper - pointer to thelper instance
+ thread_proc_init - The initialization function pointer
+ thread_proc_pre - The function to call before task loop and after initialization
+ thread_proc - The task loop
+ thread_proc_post - The function to call after the task loop
+ context - the context for the above four functions
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context)
+{
+ int result;
+
+ thelper_signal_init(thelper);
+
+ if (context) {
+ thelper->thread_context = context;
+ }
+
+ thelper->thread_proc_init = thread_proc_init;
+ thelper->thread_proc_pre = thread_proc_pre;
+ thelper->thread_proc = thread_proc;
+ thelper->thread_proc_post = thread_proc_post;
+
+ LOC_LOGD("%s:%d] 0x%lx call pthread_create\n", __func__, __LINE__, (long) thelper);
+ if (create_thread_cb) {
+ result = 0;
+ thelper->thread_id = create_thread_cb("loc_eng_dmn_conn",
+ thelper_main_2, (void *)thelper);
+ } else {
+ result = pthread_create(&thelper->thread_id, NULL,
+ thelper_main, (void *)thelper);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] 0x%lx pthread_create done\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_wait(thelper);
+
+ LOC_LOGD("%s:%d] 0x%lx pthread ready\n", __func__, __LINE__, (long) thelper);
+ return thelper->thread_exit;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_unblock_thelper
+
+DESCRIPTION
+ This function unblocks thelper_main to release the thread
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ thelper->thread_exit = 1;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_join_thelper
+
+ thelper - pointer to thelper instance
+
+DESCRIPTION
+ This function will wait for the thread of thelper_main to finish
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ result = pthread_join(thelper->thread_id, NULL);
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_destroy(thelper);
+
+ return result;
+}
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
new file mode 100644
index 0000000..89e598b
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+#define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+
+struct loc_eng_dmn_conn_thelper {
+ unsigned char thread_exit;
+ unsigned char thread_ready;
+ pthread_cond_t thread_cond;
+ pthread_mutex_t thread_mutex;
+ pthread_t thread_id;
+ void * thread_context;
+ int (*thread_proc_init) (void * context);
+ int (*thread_proc_pre) (void * context);
+ int (*thread_proc) (void * context);
+ int (*thread_proc_post) (void * context);
+};
+
+typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg);
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context);
+
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+
+/* if only need to use signal */
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_log.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_log.cpp
new file mode 100644
index 0000000..3a34167
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_log.cpp
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include "loc_log.h"
+#include "loc_eng_log.h"
+
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_log.h b/msm8909/loc_api/libloc_api_50001/loc_eng_log.h
new file mode 100644
index 0000000..a68bd84
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_log.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h b/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h
new file mode 100644
index 0000000..00ed48e
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -0,0 +1,306 @@
+/* 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_ENG_MSG_H
+#define LOC_ENG_MSG_H
+
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <stdlib.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_eng_log.h>
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include <LocEngAdapter.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+#ifdef USE_GLIB
+
+#include <glib.h>
+
+#endif /* USE_GLIB */
+#include "platform_lib_includes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+using namespace loc_core;
+
+struct LocEngPositionMode : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const LocPosMode mPosMode;
+ LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
+ virtual void proc() const;
+ virtual void log() const;
+ void send() const;
+};
+
+
+struct LocEngStartFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStartFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngStopFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStopFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportPosition : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const UlpLocation mLocation;
+ const GpsLocationExtended mLocationExtended;
+ const void* mLocationExt;
+ const enum loc_sess_status mStatus;
+ const LocPosTechMask mTechMask;
+ LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportSv : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GnssSvStatus mSvStatus;
+ const GpsLocationExtended mLocationExtended;
+ const void* mSvExt;
+ LocEngReportSv(LocAdapterBase* adapter,
+ GnssSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExtended);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportStatus : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsStatusValue mStatus;
+ LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportNmea : public LocMsg {
+ void* mLocEng;
+ char* const mNmea;
+ const int mLen;
+ LocEngReportNmea(void* locEng,
+ const char* data, int len);
+ inline virtual ~LocEngReportNmea()
+ {
+ delete[] mNmea;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportXtraServer : public LocMsg {
+ void* mLocEng;
+ int mMaxLen;
+ char *mServers;
+ LocEngReportXtraServer(void* locEng,
+ const char *url1, const char *url2,
+ const char *url3, const int maxlength);
+ inline virtual ~LocEngReportXtraServer()
+ {
+ delete[] mServers;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsOpened : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsOpened(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsClosed : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsClosed(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestSuplEs : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngRequestSuplEs(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ const AGpsExtType mType;
+ LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReleaseATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngReleaseATL(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReqRelBIT : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const int mIPv4Addr;
+ char* const mIPv6Addr;
+ const bool mIsReq;
+ LocEngReqRelBIT(void* instance, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq);
+ virtual ~LocEngReqRelBIT();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReqRelWifi : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const loc_if_req_sender_id_e_type mSenderId;
+ char* const mSSID;
+ char* const mPassword;
+ const bool mIsReq;
+ LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq);
+ virtual ~LocEngReqRelWifi();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngRequestXtra : public LocMsg {
+ void* mLocEng;
+ LocEngRequestXtra(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestTime : public LocMsg {
+ void* mLocEng;
+ LocEngRequestTime(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestNi : public LocMsg {
+ void* mLocEng;
+ const GpsNiNotification mNotify;
+ const void *mPayload;
+ LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngDown : public LocMsg {
+ void* mLocEng;
+ LocEngDown(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngUp : public LocMsg {
+ void* mLocEng;
+ LocEngUp(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngGetZpp : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngGetZpp(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportGnssMeasurement : public LocMsg {
+ void* mLocEng;
+ const GnssData mGnssData;
+ LocEngReportGnssMeasurement(void* locEng,
+ GnssData &gnssData);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_MSG_H */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_ni.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_ni.cpp
new file mode 100644
index 0000000..4597b98
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -0,0 +1,414 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <MsgTask.h>
+
+#include <loc_eng.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+static void* ni_thread_proc(void *args);
+
+struct LocEngInformNiResponse : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUserResponseType mResponse;
+ const void *mPayload;
+ inline LocEngInformNiResponse(LocEngAdapter* adapter,
+ GpsUserResponseType resp,
+ const void* data) :
+ LocMsg(), mAdapter(adapter),
+ mResponse(resp), mPayload(data)
+ {
+ locallog();
+ }
+ inline ~LocEngInformNiResponse()
+ {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const
+ {
+ mAdapter->informNiResponse(mResponse, mPayload);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInformNiResponse - "
+ "response: %s\n mPayload: %p",
+ loc_get_ni_response_name(mResponse),
+ mPayload);
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough)
+{
+ ENTRY_LOG();
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) {
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ }
+ } else {
+ if (NULL != loc_eng_ni_data_p->session.rawRequest ||
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+ }
+
+
+ if (pSession) {
+ /* Save request */
+ pSession->rawRequest = (void*)passThrough;
+ pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter;
+ pSession->adapter = loc_eng_data.adapter;
+
+ /* Fill in notification */
+ ((GpsNiNotification*)notif)->notification_id = pSession->reqID;
+
+ if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session(loc_eng_data);
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif->ni_type, notif->timeout, notif->default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif->requestor_id, notif->requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif->text, notif->text_encoding);
+ if (notif->extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif->extras);
+ }
+
+ /* 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 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft);
+
+ int rc = 0;
+ rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(pSession->thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+
+ CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
+ loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION ni_thread_proc
+
+===========================================================================*/
+static void* ni_thread_proc(void *args)
+{
+ ENTRY_LOG();
+
+ loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n",
+ (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 = GPS_NI_RESPONSE_NORESP;
+ LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/
+
+ LOC_LOGD("pSession->resp is %d\n",pSession->resp);
+
+ // 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()
+ LocEngAdapter* adapter = pSession->adapter;
+ LocEngInformNiResponse *msg = NULL;
+
+ if (NULL != pSession->rawRequest) {
+ if (pSession->resp != GPS_NI_RESPONSE_IGNORE) {
+ LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n");
+ msg = new LocEngInformNiResponse(adapter,
+ pSession->resp,
+ pSession->rawRequest);
+ } else {
+ LOC_LOGD("this is the ignore reply for SUPL ES\n");
+ free(pSession->rawRequest);
+ }
+ pSession->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&pSession->tLock);
+
+ pSession->respTimeLeft = 0;
+ pSession->reqID = 0;
+
+ if (NULL != msg) {
+ LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n");
+ adapter->sendMsg(msg);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+ return NULL;
+}
+
+void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ // only if modem has requested but then died.
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ free(loc_eng_ni_data_p->sessionEs.rawRequest);
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->sessionEs.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock);
+ }
+
+ if (NULL != loc_eng_ni_data_p->session.rawRequest) {
+ free(loc_eng_ni_data_p->session.rawRequest);
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if(callbacks == NULL)
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
+ else if (NULL == callbacks->notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
+ } else if (NULL != loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
+ } else {
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_data_p->sessionEs.respTimeLeft = 0;
+ loc_eng_ni_data_p->sessionEs.respRecvd = FALSE;
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+ loc_eng_ni_data_p->sessionEs.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL);
+
+ loc_eng_ni_data_p->session.respTimeLeft = 0;
+ loc_eng_ni_data_p->session.respRecvd = FALSE;
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+ loc_eng_ni_data_p->session.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL);
+
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ EXIT_LOG(%s, VOID_RET);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function receives user response from upper layer framework
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG_CALLFLOW();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif_id == loc_eng_ni_data_p->sessionEs.reqID &&
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (user_response == GPS_NI_RESPONSE_ACCEPT &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE;
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+ } else if (notif_id == loc_eng_ni_data_p->session.reqID &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+
+ if (pSession) {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ pthread_mutex_lock(&pSession->tLock);
+ pSession->resp = user_response;
+ pSession->respRecvd = TRUE;
+ pthread_cond_signal(&pSession->tCond);
+ pthread_mutex_unlock(&pSession->tLock);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_ni.h b/msm8909/loc_api/libloc_api_50001/loc_eng_ni.h
new file mode 100644
index 0000000..068f5cd
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_ni.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009,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 LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <stdbool.h>
+#include <LocEngAdapter.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+#define GPS_NI_RESPONSE_IGNORE 4
+
+typedef struct {
+ pthread_t thread; /* NI thread */
+ int respTimeLeft; /* examine time for NI response */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ int reqID; /* ID to check against response */
+ GpsUserResponseType resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+ LocEngAdapter* adapter;
+} loc_eng_ni_session_s_type;
+
+typedef struct {
+ loc_eng_ni_session_s_type session; /* SUPL NI Session */
+ loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */
+ int reqIDCounter;
+} loc_eng_ni_data_s_type;
+
+
+#endif /* LOC_ENG_NI_H */
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp
new file mode 100644
index 0000000..700f325
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -0,0 +1,808 @@
+/* Copyright (c) 2012,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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng_nmea"
+#include <loc_eng.h>
+#include <loc_eng_nmea.h>
+#include <math.h>
+#include "log_util.h"
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_send
+
+DESCRIPTION
+ send out NMEA sentence
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
+{
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ if (loc_eng_data_p->nmea_cb != NULL)
+ loc_eng_data_p->nmea_cb(now, pNmea, length);
+ LOC_LOGD("NMEA <%s", pNmea);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_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
+
+===========================================================================*/
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 0;
+
+ pNmea++; //skip the $
+ while (*pNmea != '\0')
+ {
+ checksum ^= *pNmea++;
+ length++;
+ }
+
+ int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
+ return (length + checksumLength);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ unsigned char generate_nmea)
+{
+ ENTRY_LOG();
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ if (NULL == pTm) {
+ LOC_LOGE("gmtime failed");
+ return;
+ }
+
+ char sentence[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;
+
+ if (generate_nmea) {
+ // ------------------
+ // ------$GPGSA------
+ // ------------------
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+ uint32_t mask = loc_eng_data_p->sv_used_mask;
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i;
+ mask = mask >> 1;
+ }
+ // clear the cache so they can't be used again
+ loc_eng_data_p->sv_used_mask = 0;
+
+ char fixType;
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ {
+ 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;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPVTG------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & 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, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPRMC------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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 & 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 & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPGGA------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ gpsQuality = '1'; // 1 means GPS fix
+ else
+ gpsQuality = '2'; // 2 means DGPS fix
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, loc_eng_data_p->hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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 & GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ // clear the dop cache so they can't be used again
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
+ const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int svCount = svStatus.num_svs;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+ int gpsCount = 0;
+ int glnCount = 0;
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+ loc_eng_data_p->sv_used_mask = 0;
+ for(svNumber=1; svNumber <= svCount; svNumber++) {
+ if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX))
+ {
+ loc_eng_data_p->sv_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
+ }
+ gpsCount++;
+ }
+ else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ glnCount++;
+ }
+ }
+
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ if (gpsCount <= 0)
+ {
+ // no svs in view, so just send a blank $GPGSV sentence
+ strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = gpsCount/4 + (gpsCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, gpsCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.gnss_sv_list[svNumber-1].svid,
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ } //if
+
+ // ------------------
+ // ------$GLGSV------
+ // ------------------
+
+ if (glnCount <= 0)
+ {
+ // no svs in view, so just send a blank $GLGSV sentence
+ strlcpy(sentence, "$GLGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = glnCount/4 + (glnCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GLGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, glnCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.gnss_sv_list[svNumber - 1].svid,
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ }//if
+
+ // For RPC, the DOP are sent during sv report, so cache them
+ // now to be sent during position report.
+ // For QMI, the DOP will be in position report.
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ loc_eng_data_p->pdop = locationExtended.pdop;
+ loc_eng_data_p->hdop = locationExtended.hdop;
+ loc_eng_data_p->vdop = locationExtended.vdop;
+ }
+ else
+ {
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+ }
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h
new file mode 100644
index 0000000..86dc439
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012,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_ENG_NMEA_H
+#define LOC_ENG_NMEA_H
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
+
+#endif // LOC_ENG_NMEA_H
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp
new file mode 100644
index 0000000..b2f0e9b
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -0,0 +1,220 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+struct LocEngRequestXtraServer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngRequestXtraServer(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->requestXtraServer();
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngRequestXtraServer");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInjectXtraData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ char* mData;
+ const int mLen;
+ inline LocEngInjectXtraData(LocEngAdapter* adapter,
+ char* data, int len):
+ LocMsg(), mAdapter(adapter),
+ mData(new char[len]), mLen(len)
+ {
+ memcpy((void*)mData, (void*)data, len);
+ locallog();
+ }
+ inline ~LocEngInjectXtraData()
+ {
+ delete[] mData;
+ }
+ inline virtual void proc() const {
+ mAdapter->setXtraData(mData, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("length: %d\n data: %p", mLen, mData);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSetXtraVersionCheck : public LocMsg {
+ LocEngAdapter *mAdapter;
+ int mCheck;
+ inline LocEngSetXtraVersionCheck(LocEngAdapter* adapter,
+ int check):
+ mAdapter(adapter), mCheck(check) {}
+ inline virtual void proc() const {
+ locallog();
+ mAdapter->setXtraVersionCheck(mCheck);
+ }
+ inline void locallog() const {
+ LOC_LOGD("%s:%d]: mCheck: %d",
+ __func__, __LINE__, mCheck);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks)
+{
+ int ret_val = -1;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+ ENTRY_LOG();
+
+ if(!loc_eng_data.adapter->mSupportsTimeInjection
+ || loc_eng_data.adapter->hasNativeXtraClient()) {
+ LOC_LOGD("XTRA is already supported. disable it here.\n");
+ EXIT_LOG(%d, 1); // return 1 denote failure
+ return 1;
+ }
+
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
+ } else {
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr->report_xtra_server_cb = callbacks->report_xtra_server_cb;
+
+ ret_val = 0;
+ }
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_inject_data
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_request_server
+
+DESCRIPTION
+ Request the Xtra server url from the modem
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngRequestXtraServer(adapter));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_version_check
+
+DESCRIPTION
+ Injects the enable/disable value for checking XTRA version
+ that is specified in gps.conf
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data,
+ int check)
+{
+ ENTRY_LOG();
+ LocEngAdapter *adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngSetXtraVersionCheck(adapter, check));
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.h b/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.h
new file mode 100644
index 0000000..175f497
--- /dev/null
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2009,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 LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ report_xtra_server report_xtra_server_cb;
+
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H
diff --git a/msm8909/utils/Android.mk b/msm8909/utils/Android.mk
new file mode 100644
index 0000000..289926c
--- /dev/null
+++ b/msm8909/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 := \
+ libutils \
+ libcutils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp
+
+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_C_INCLUDES:= \
+ $(LOCAL_PATH)/platform_lib_abstractions
+
+LOCAL_COPY_HEADERS_TO:= gps.utils/
+LOCAL_COPY_HEADERS:= \
+ loc_log.h \
+ loc_cfg.h \
+ log_util.h \
+ linked_list.h \
+ msg_q.h \
+ MsgTask.h \
+ LocHeap.h \
+ LocThread.h \
+ LocTimer.h \
+ loc_target.h \
+ loc_timer.h \
+ LocSharedLock.h \
+ platform_lib_abstractions/platform_lib_includes.h \
+ platform_lib_abstractions/platform_lib_time.h \
+ platform_lib_abstractions/platform_lib_macros.h \
+ loc_misc_utils.h
+
+LOCAL_MODULE := libgps.utils
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/utils/LocHeap.cpp b/msm8909/utils/LocHeap.cpp
similarity index 100%
copy from utils/LocHeap.cpp
copy to msm8909/utils/LocHeap.cpp
diff --git a/utils/LocHeap.h b/msm8909/utils/LocHeap.h
similarity index 100%
copy from utils/LocHeap.h
copy to msm8909/utils/LocHeap.h
diff --git a/utils/LocSharedLock.h b/msm8909/utils/LocSharedLock.h
similarity index 100%
copy from utils/LocSharedLock.h
copy to msm8909/utils/LocSharedLock.h
diff --git a/msm8909/utils/LocThread.cpp b/msm8909/utils/LocThread.cpp
new file mode 100644
index 0000000..19bf101
--- /dev/null
+++ b/msm8909/utils/LocThread.cpp
@@ -0,0 +1,264 @@
+/* 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>
+
+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(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 = NULL;
+ }
+
+ if (mThandle) {
+ // set thread name
+ char lname[16];
+ int len = 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/utils/LocThread.h b/msm8909/utils/LocThread.h
similarity index 100%
copy from utils/LocThread.h
copy to msm8909/utils/LocThread.h
diff --git a/msm8909/utils/LocTimer.cpp b/msm8909/utils/LocTimer.cpp
new file mode 100644
index 0000000..f59aa7d
--- /dev/null
+++ b/msm8909/utils/LocTimer.cpp
@@ -0,0 +1,739 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <errno.h>
+#include <loc_timer.h>
+#include <sys/timerfd.h>
+#include <sys/epoll.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, bool wakeOnExpire);
+ 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, bool wakeOnExpire)
+ : mClient(&client),
+ mLock(mClient->mLock->share()),
+ mFutureTime(futureTime),
+ mContainer(LocTimerContainer::get(wakeOnExpire)) {
+ // 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, this obj outRanks higher
+ rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec;
+ }
+ 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;
+ }
+ mTimer = new LocTimerDelegate(*this, futureTime, wakeOnExpire);
+ // 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/msm8909/utils/LocTimer.h b/msm8909/utils/LocTimer.h
new file mode 100644
index 0000000..c146852
--- /dev/null
+++ b/msm8909/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 <log_util.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/msm8909/utils/Makefile.am b/msm8909/utils/Makefile.am
new file mode 100644
index 0000000..e5935f0
--- /dev/null
+++ b/msm8909/utils/Makefile.am
@@ -0,0 +1,44 @@
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I../platform_lib_abstractions
+
+libgps_utils_so_la_h_sources = log_util.h \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
+
+libgps_utils_so_la_c_sources = linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
+
+library_includedir = $(pkgincludedir)/utils
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lstdc++ -lcutils
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
diff --git a/msm8909/utils/MsgTask.cpp b/msm8909/utils/MsgTask.cpp
new file mode 100644
index 0000000..0e7a3a2
--- /dev/null
+++ b/msm8909/utils/MsgTask.cpp
@@ -0,0 +1,102 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.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 {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void MsgTask::prerun() {
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+}
+
+bool MsgTask::run() {
+ LOC_LOGV("MsgTask::loop() listening ...\n");
+ 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/utils/MsgTask.h b/msm8909/utils/MsgTask.h
similarity index 100%
copy from utils/MsgTask.h
copy to msm8909/utils/MsgTask.h
diff --git a/msm8909/utils/linked_list.c b/msm8909/utils/linked_list.c
new file mode 100644
index 0000000..3cd2e64
--- /dev/null
+++ b/msm8909/utils/linked_list.c
@@ -0,0 +1,328 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include <stdlib.h>
+#include <stdint.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*))
+{
+ LOC_LOGV("%s: Adding to list data_obj = 0x%p\n", __FUNCTION__, 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;
+ 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)
+{
+ LOC_LOGV("%s: Removing from list\n", __FUNCTION__);
+ 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)
+{
+ LOC_LOGV("%s: Search the list\n", __FUNCTION__);
+ 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/msm8909/utils/linked_list.h b/msm8909/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/msm8909/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/msm8909/utils/loc_cfg.cpp b/msm8909/utils/loc_cfg.cpp
new file mode 100644
index 0000000..967d2f3
--- /dev/null
+++ b/msm8909/utils/loc_cfg.cpp
@@ -0,0 +1,400 @@
+/* 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 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_NDDEBUG 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 <loc_cfg.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint32_t DEBUG_LEVEL = 0xff;
+static uint32_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, 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;
+
+/*===========================================================================
+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 + 1);
+ }
+ /* 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, "=", &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;
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ 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);
+}
diff --git a/msm8909/utils/loc_cfg.h b/msm8909/utils/loc_cfg.h
new file mode 100644
index 0000000..9045e1d
--- /dev/null
+++ b/msm8909/utils/loc_cfg.h
@@ -0,0 +1,91 @@
+/* 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 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>
+
+#define LOC_MAX_PARAM_NAME 80
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING)
+
+#define 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;
+ uint8_t *param_set; /* was this value set by config file? */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for float */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/msm8909/utils/loc_log.cpp b/msm8909/utils/loc_log.cpp
new file mode 100644
index 0000000..6601d0d
--- /dev/null
+++ b/msm8909/utils/loc_log.cpp
@@ -0,0 +1,243 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#ifdef USE_GLIB
+#include <time.h>
+#endif /* USE_GLIB */
+#include "log_util.h"
+#include "platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+static const loc_name_val_s_type target_name[] =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_QCA1530),
+ NAME_VAL(GNSS_AUTO),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+static const size_t target_name_num = LOC_TABLE_SIZE(target_name);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ static char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index < 0 || (unsigned)index >= target_name_num )
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ snprintf(ret, sizeof(ret), " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ snprintf(ret, sizeof(ret), " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/msm8909/utils/loc_log.h b/msm8909/utils/loc_log.h
new file mode 100644
index 0000000..be492b1
--- /dev/null
+++ b/msm8909/utils/loc_log.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#ifndef LOC_LOG_H
+#define LOC_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ const char *name;
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#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]))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask);
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, size_t buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/msm8909/utils/loc_misc_utils.cpp b/msm8909/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..7e96313
--- /dev/null
+++ b/msm8909/utils/loc_misc_utils.cpp
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#include <ctype.h>
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+
+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;
+}
diff --git a/msm8909/utils/loc_misc_utils.h b/msm8909/utils/loc_misc_utils.h
new file mode 100644
index 0000000..7d66d84
--- /dev/null
+++ b/msm8909/utils/loc_misc_utils.h
@@ -0,0 +1,99 @@
+/* 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/msm8909/utils/loc_target.cpp b/msm8909/utils/loc_target.cpp
new file mode 100644
index 0000000..b5ec639
--- /dev/null
+++ b/msm8909/utils/loc_target.cpp
@@ -0,0 +1,269 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <hardware/gps.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include "log_util.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_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
+/* When system server is started, it uses 20 seconds as ActivityManager
+ * timeout. After that it sends SIGSTOP signal to process.
+ */
+#define QCA1530_DETECT_TIMEOUT 15
+#define QCA1530_DETECT_PRESENT "yes"
+#define QCA1530_DETECT_PROGRESS "detect"
+
+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);
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+/*!
+ * \brief Checks if QCA1530 is avalable.
+ *
+ * Function verifies if qca1530 SoC is configured on the device. The test is
+ * based on property value. For 1530 scenario, the value shall be one of the
+ * following: "yes", "no", "detect". All other values are treated equally to
+ * "no". When the value is "detect" the system waits for SoC detection to
+ * finish before returning result.
+ *
+ * \retval true - QCA1530 is available.
+ * \retval false - QCA1530 is not available.
+ */
+static bool is_qca1530(void)
+{
+ static const char qca1530_property_name[] = "sys.qca1530";
+ bool res = false;
+ int ret, i;
+ char buf[PROPERTY_VALUE_MAX];
+
+ memset(buf, 0, sizeof(buf));
+
+ for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
+ {
+ ret = property_get(qca1530_property_name, buf, NULL);
+ if (ret < 0)
+ {
+ LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
+ qca1530_property_name,
+ ret);
+
+ break;
+ }
+
+ LOC_LOGV( "qca1530: property %s is set to %s",
+ qca1530_property_name,
+ buf);
+
+ if (!memcmp(buf, QCA1530_DETECT_PRESENT,
+ sizeof(QCA1530_DETECT_PRESENT)))
+ {
+ res = true;
+ break;
+ }
+ if (!memcmp(buf, QCA1530_DETECT_PROGRESS,
+ sizeof(QCA1530_DETECT_PROGRESS)))
+ {
+ LOC_LOGV("qca1530: SoC detection is in progress.");
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+
+ LOC_LOGD("qca1530: detected=%s", res ? "true" : "false");
+ return res;
+}
+
+/*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__);
+ }
+}
+
+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 id[] = "/sys/devices/soc0/soc_id";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
+ static const char mdm[] = "/dev/mdm"; // No such file or directory
+
+ char rd_hw_platform[LINE_LEN];
+ char rd_id[LINE_LEN];
+ char rd_mdm[LINE_LEN];
+ char baseband[LINE_LEN];
+
+ if (is_qca1530()) {
+ gTarget = TARGET_QCA1530;
+ goto detected;
+ }
+
+ 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);
+ }
+ if (!access(id, F_OK)) {
+ read_a_line(id, rd_id, LINE_LEN);
+ } else {
+ read_a_line(id_dep, rd_id, LINE_LEN);
+ }
+ if( !memcmp(baseband, 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)) ){
+
+ 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)]))) {
+
+ if (!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
+ gTarget = TARGET_UNKNOWN;
+ }
+
+detected:
+ LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
+ return gTarget;
+}
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target
+*/
+int loc_identify_lean_target()
+{
+ int ret = 0;
+ char lean_target[PROPERTY_VALUE_MAX];
+ property_get("ro.lean", lean_target, "");
+ LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
+ return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
+}
diff --git a/msm8909/utils/loc_target.h b/msm8909/utils/loc_target.h
new file mode 100644
index 0000000..4ad0678
--- /dev/null
+++ b/msm8909/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_QCA1530 TARGET_SET(GNSS_QCA1530, 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);
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target*/
+int loc_identify_lean_target();
+
+/* Please remember to update 'target_name' in loc_log.cpp,
+ if do any changes to this enum. */
+typedef enum {
+ GNSS_NONE = 0,
+ GNSS_MSM,
+ GNSS_GSS,
+ GNSS_MDM,
+ GNSS_QCA1530,
+ 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/msm8909/utils/loc_timer.h b/msm8909/utils/loc_timer.h
new file mode 100644
index 0000000..2967858
--- /dev/null
+++ b/msm8909/utils/loc_timer.h
@@ -0,0 +1,73 @@
+/* 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>
+
+/*
+ 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/msm8909/utils/log_util.h b/msm8909/utils/log_util.h
new file mode 100644
index 0000000..2a89241
--- /dev/null
+++ b/msm8909/utils/log_util.h
@@ -0,0 +1,195 @@
+/* Copyright (c) 2011-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 __LOG_UTIL_H__
+#define __LOG_UTIL_H__
+
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#endif /* USE_GLIB */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+extern const char EXIT_ERROR_TAG[];
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) \
+IF_LOC_LOGE { ALOGE("E/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/" __VA_ARGS__); }
+
+#define LOC_LOGW(...) \
+IF_LOC_LOGW { ALOGE("W/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); }
+
+#define LOC_LOGI(...) \
+IF_LOC_LOGI { ALOGE("I/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); }
+
+#define LOC_LOGD(...) \
+IF_LOC_LOGD { ALOGE("D/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); }
+
+#define LOC_LOGV(...) \
+IF_LOC_LOGV { ALOGE("V/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE("E/" __VA_ARGS__)
+
+#define LOC_LOGW(...) ALOGW("W/" __VA_ARGS__)
+
+#define LOC_LOGI(...) ALOGI("I/" __VA_ARGS__)
+
+#define LOC_LOGD(...) ALOGD("D/" __VA_ARGS__)
+
+#define LOC_LOGV(...) ALOGV("V/" __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(tag,fmt) "%s:%d][" tag "] " fmt "\n"
+#define LOC_LOGv(tag,fmt,...) LOC_LOGV(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(tag,fmt,...) LOC_LOGW(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(tag,fmt,...) LOC_LOGD(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(tag,fmt,...) LOC_LOGE(LOC_LOG_HEAD(tag,fmt), __func__, __LINE__, ##__VA_ARGS__)
+
+#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
+#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
+#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
+
+#define ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL)
+#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
+ if (VAL != 0) { \
+ LOG_E(EXIT_ERROR_TAG, __func__, SPEC, VAL); \
+ } else { \
+ LOG_V(EXIT_TAG, __func__, SPEC, VAL); \
+ }
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __func__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __func__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __func__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __func__, 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/msm8909/utils/msg_q.c b/msm8909/utils/msg_q.c
new file mode 100644
index 0000000..5be8547
--- /dev/null
+++ b/msm8909/utils/msg_q.c
@@ -0,0 +1,336 @@
+/* Copyright (c) 2011-2012, 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 "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.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 = 0x%08X\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 = 0x%08X\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;
+
+ LOC_LOGV("%s: Waiting on message\n", __FUNCTION__);
+
+ 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 0x%08X 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/msm8909/utils/msg_q.h b/msm8909/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/msm8909/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/msm8909/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/msm8909/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/msm8909/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/msm8909/utils/platform_lib_abstractions/platform_lib_includes.h b/msm8909/utils/platform_lib_abstractions/platform_lib_includes.h
new file mode 100644
index 0000000..5858674
--- /dev/null
+++ b/msm8909/utils/platform_lib_abstractions/platform_lib_includes.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_INCLUDES_H_
+#define _PLATFORM_LIB_INCLUDES_H_
+
+#include "platform_lib_time.h"
+#include "platform_lib_macros.h"
+
+#endif
diff --git a/msm8909/utils/platform_lib_abstractions/platform_lib_macros.h b/msm8909/utils/platform_lib_abstractions/platform_lib_macros.h
new file mode 100644
index 0000000..bc48dd9
--- /dev/null
+++ b/msm8909/utils/platform_lib_abstractions/platform_lib_macros.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#include <sys/time.h>
+
+#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); \
+}
+
+
+#ifdef USE_GLIB
+
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+
+#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)
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
+
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
+
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+pid_t gettid(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
+
+#endif
+
+#endif
diff --git a/msm8909/utils/platform_lib_abstractions/platform_lib_time.h b/msm8909/utils/platform_lib_abstractions/platform_lib_time.h
new file mode 100644
index 0000000..ce013af
--- /dev/null
+++ b/msm8909/utils/platform_lib_abstractions/platform_lib_time.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_TIME_H_
+#define _PLATFORM_LIB_TIME_H_
+
+int64_t systemTime(int clock);
+int64_t elapsedMillisSinceBoot();
+
+#endif
diff --git a/msm8960/Android.mk b/msm8960/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/msm8960/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/msm8960/core/Android.mk b/msm8960/core/Android.mk
new file mode 100644
index 0000000..3144313
--- /dev/null
+++ b/msm8960/core/Android.mk
@@ -0,0 +1,48 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_core
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ liblog \
+ libcutils \
+ libgps.utils \
+ libdl
+
+LOCAL_SRC_FILES += \
+ MsgTask.cpp \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils
+
+LOCAL_COPY_HEADERS_TO:= libloc_core/
+LOCAL_COPY_HEADERS:= \
+ MsgTask.h \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ IzatProxyBase.h \
+ UlpProxyBase.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_core_log.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/msm8960/core/ContextBase.cpp b/msm8960/core/ContextBase.cpp
new file mode 100644
index 0000000..d632a9b
--- /dev/null
+++ b/msm8960/core/ContextBase.cpp
@@ -0,0 +1,112 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+
+IzatProxyBase* ContextBase::getIzatProxy(const char* libName)
+{
+ IzatProxyBase* proxy = NULL;
+ void* lib = dlopen(libName, RTLD_NOW);
+
+ if ((void*)NULL != lib) {
+ getIzatProxy_t* getter = (getIzatProxy_t*)dlsym(lib, "getIzatProxy");
+ if (NULL != getter) {
+ proxy = (*getter)();
+ }
+ }
+ if (NULL == proxy) {
+ proxy = new IzatProxyBase();
+ }
+ return proxy;
+}
+
+LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
+{
+ LocApiBase* locApi = NULL;
+
+ // first if can not be MPQ
+ if (TARGET_MPQ != get_target()) {
+ if (NULL == (locApi = mIzatProxy->getLocApi(mMsgTask, exMask))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask,exMask);
+ }
+ }
+ // 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)(mMsgTask, exMask);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, exMask);
+ }
+
+ return locApi;
+}
+
+ContextBase::ContextBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ const char* libName) :
+ mIzatProxy(getIzatProxy(libName)),
+ mMsgTask(msgTask),
+ mLocApi(createLocApi(exMask))
+{
+}
+
+}
diff --git a/msm8960/core/ContextBase.h b/msm8960/core/ContextBase.h
new file mode 100644
index 0000000..fc60db4
--- /dev/null
+++ b/msm8960/core/ContextBase.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __LOC_CONTEXT_BASE__
+#define __LOC_CONTEXT_BASE__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <MsgTask.h>
+#include <LocApiBase.h>
+#include <IzatProxyBase.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class ContextBase {
+ static IzatProxyBase* getIzatProxy(const char* libName);
+ LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
+protected:
+ const IzatProxyBase* mIzatProxy;
+ const MsgTask* mMsgTask;
+ LocApiBase* mLocApi;
+
+public:
+ ContextBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ const char* libName);
+ inline virtual ~ContextBase() { delete mLocApi; delete mIzatProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline bool hasAgpsExt() { return mIzatProxy->hasAgpsExt(); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mIzatProxy->requestUlp(adapter, capabilities);
+ }
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/msm8960/core/IzatProxyBase.h b/msm8960/core/IzatProxyBase.h
new file mode 100644
index 0000000..e7e3d3f
--- /dev/null
+++ b/msm8960/core/IzatProxyBase.h
@@ -0,0 +1,60 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef IZAT_PROXY_BASE_H
+#define IZAT_PROXY_BASE_H
+
+#include <gps_extended.h>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+
+class IzatProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) const {
+ return NULL;
+ }
+protected:
+ inline IzatProxyBase() {}
+public:
+ inline virtual ~IzatProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {}
+ inline virtual bool hasAgpsExt() const { return false; }
+};
+
+typedef IzatProxyBase* (getIzatProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/msm8960/core/LocAdapterBase.cpp b/msm8960/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..48d179f
--- /dev/null
+++ b/msm8960/core/LocAdapterBase.cpp
@@ -0,0 +1,139 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocAdapterBase"
+
+#include <dlfcn.h>
+#include <LocAdapterBase.h>
+#include <loc_target.h>
+#include <log_util.h>
+
+namespace loc_core {
+
+struct LocOpenMsg : public LocMsg {
+ LocAdapterBase* mLocAdapter;
+ LocApiBase* mLocApi;
+ inline LocOpenMsg(LocAdapterBase* locAdapter,
+ LocApiBase* locApi) :
+ LocMsg(), mLocAdapter(locAdapter), mLocApi(locApi)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->addAdapter(mLocAdapter);
+ }
+ inline void locallog() {
+ LOC_LOGV("LocOpen");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+// 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) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mMsgTask(context->getMsgTask())
+{
+ sendMsg(new LocOpenMsg(this, mLocApi));
+}
+
+void LocAdapterBase::
+ handleEngineDownEvent()
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportStatus(GpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmea(const char* nmea, int length)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestXtraData()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestTime()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestLocation()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestATL(int connHandle, AGpsType agps_type)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotify(GpsNiNotification ¬ify, const void* data)
+DEFAULT_IMPL(false)
+} // namespace loc_core
diff --git a/msm8960/core/LocAdapterBase.h b/msm8960/core/LocAdapterBase.h
new file mode 100644
index 0000000..f279f9f
--- /dev/null
+++ b/msm8960/core/LocAdapterBase.h
@@ -0,0 +1,105 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocAdapterBase {
+protected:
+ const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ const MsgTask* mMsgTask;
+
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL), mMsgTask(msgTask) {}
+
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context);
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+
+public:
+ 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);
+ }
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
+ inline virtual void handleEngineUpEvent() {}
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeInt(LocPosMode& posMode) {}
+ virtual void startFixInt() {}
+ virtual void stopFixInt() {}
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotify(GpsNiNotification ¬ify,
+ const void* data);
+ inline virtual bool isInSession() { return false; }
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/msm8960/core/LocApiBase.cpp b/msm8960/core/LocApiBase.cpp
new file mode 100644
index 0000000..f50d3e1
--- /dev/null
+++ b/msm8960/core/LocApiBase.cpp
@@ -0,0 +1,429 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <log_util.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ TO_ALL_LOCADAPTERS(inSession = mLocAdapters[i]->isInSession());
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ open(mMask | (adapter->getEvtMask() & ~mExcludedMask));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ open(getEvtMask() & ~mExcludedMask);
+ }
+ }
+ }
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
+}
+
+void LocApiBase::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask)
+ );
+}
+
+void LocApiBase::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSv(svStatus,
+ locationExtended,
+ svExt)
+ );
+}
+
+void LocApiBase::reportStatus(GpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+void LocApiBase::reportNmea(const char* nmea, int length)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmea(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::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, AGpsType agps_type)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ deleteAidingData(GpsAidingData f)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int enable)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* apn, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double latitude, double longitude, float accuracy)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, AGpsType agpsType)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int handle, int is_succ)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(const char* url, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSUPLVersion(uint32_t version)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setLPPConfig(uint32_t profile)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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)
+
+enum loc_api_adapter_err LocApiBase::
+ setExtPowerConfig(int isBatteryCharging)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ initDataServiceClient()
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+
+} // namespace loc_core
diff --git a/msm8960/core/LocApiBase.h b/msm8960/core/LocApiBase.h
new file mode 100644
index 0000000..87facf1
--- /dev/null
+++ b/msm8960/core/LocApiBase.h
@@ -0,0 +1,190 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_API_BASE_H
+#define LOC_API_BASE_H
+
+#include <stddef.h>
+#include <ctype.h>
+#include <gps_extended.h>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+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 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++);
+
+
+class LocAdapterBase;
+struct LocSsrMsg;
+
+class LocApiBase {
+ friend struct LocSsrMsg;
+ friend class ContextBase;
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+ const MsgTask* mMsgTask;
+
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+
+public:
+ inline virtual void* getSibling() { return NULL; }
+
+ void addAdapter(LocAdapterBase* adapter);
+ void removeAdapter(LocAdapterBase* adapter);
+
+ // upward calls
+ void handleEngineUpEvent();
+ void handleEngineDownEvent();
+ void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask =
+ LOC_POS_TECH_MASK_DEFAULT);
+ void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ void reportStatus(GpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, AGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GpsNiNotification ¬ify, const void* data);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging);
+ virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol);
+ virtual int initDataServiceClient();
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+
+ inline virtual void setInSession(bool inSession) {}
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/msm8960/core/LocDualContext.cpp b/msm8960/core/LocDualContext.cpp
new file mode 100644
index 0000000..381743d
--- /dev/null
+++ b/msm8960/core/LocDualContext.cpp
@@ -0,0 +1,131 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+const char* LocDualContext::mIzatLibName = "libizat_core.so";
+
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name);
+ }
+ return mMsgTask;
+}
+
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tAssociate, name);
+ }
+ return mMsgTask;
+}
+
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mFgContext) {
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mFgContext) {
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ return mFgContext;
+
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mBgContext) {
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ return mBgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mBgContext) {
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ return mBgContext;
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mIzatLibName)
+{
+}
+
+}
diff --git a/msm8960/core/LocDualContext.h b/msm8960/core/LocDualContext.h
new file mode 100644
index 0000000..e761e76
--- /dev/null
+++ b/msm8960/core/LocDualContext.h
@@ -0,0 +1,72 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __LOC_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+
+ static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
+ const char* name);
+ static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name);
+
+protected:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mIzatLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/msm8960/core/MsgTask.cpp b/msm8960/core/MsgTask.cpp
new file mode 100644
index 0000000..e61ce1c
--- /dev/null
+++ b/msm8960/core/MsgTask.cpp
@@ -0,0 +1,132 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+#define MAX_TASK_COMM_LEN 15
+
+static void LocMsgDestroy(void* msg) {
+ delete (LocMsg*)msg;
+}
+
+MsgTask::MsgTask(tCreate tCreator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(NULL){
+ if (tCreator) {
+ tCreator(threadName, loopMain,
+ (void*)new MsgTask(mQ, mAssociator));
+ } else {
+ createPThread(threadName);
+ }
+}
+
+MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(tAssociator){
+ createPThread(threadName);
+}
+
+inline
+MsgTask::MsgTask(const void* q, tAssociate associator) :
+ mQ(q), mAssociator(associator){
+}
+
+MsgTask::~MsgTask() {
+ msg_q_unblock((void*)mQ);
+}
+
+void MsgTask::createPThread(const char* threadName) {
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ pthread_t tid;
+ // create the thread here, then if successful
+ // and a name is given, we set the thread name
+ if (!pthread_create(&tid, &attr, loopMain,
+ (void*)new MsgTask(mQ, mAssociator)) &&
+ NULL != threadName) {
+ char lname[MAX_TASK_COMM_LEN+1];
+ memcpy(lname, threadName, MAX_TASK_COMM_LEN);
+ lname[MAX_TASK_COMM_LEN] = 0;
+ pthread_setname_np(tid, lname);
+ }
+}
+
+void MsgTask::sendMsg(const LocMsg* msg) const {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void* MsgTask::loopMain(void* arg) {
+ MsgTask* copy = (MsgTask*)arg;
+
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+
+ if (NULL != copy->mAssociator) {
+ copy->mAssociator();
+ }
+
+ LocMsg* msg;
+ int cnt = 0;
+
+ while (1) {
+ LOC_LOGD("MsgTask::loop() %d listening ...\n", cnt++);
+
+ msq_q_err_type result = msg_q_rcv((void*)copy->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));
+ // destroy the Q and exit
+ msg_q_destroy((void**)&(copy->mQ));
+ delete copy;
+ return NULL;
+ }
+
+ msg->log();
+ // there is where each individual msg handling is invoked
+ msg->proc();
+
+ delete msg;
+ }
+
+ delete copy;
+
+ return NULL;
+}
+
+}
diff --git a/msm8960/core/MsgTask.h b/msm8960/core/MsgTask.h
new file mode 100644
index 0000000..d09de73
--- /dev/null
+++ b/msm8960/core/MsgTask.h
@@ -0,0 +1,66 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __MSG_TASK__
+#define __MSG_TASK__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <pthread.h>
+
+namespace loc_core {
+
+struct LocMsg {
+ inline LocMsg() {}
+ inline virtual ~LocMsg() {}
+ virtual void proc() const = 0;
+ inline virtual void log() const {}
+};
+
+class MsgTask {
+public:
+ typedef void* (*tStart)(void*);
+ typedef pthread_t (*tCreate)(const char* name, tStart start, void* arg);
+ typedef int (*tAssociate)();
+ MsgTask(tCreate tCreator, const char* threadName);
+ MsgTask(tAssociate tAssociator, const char* threadName);
+ ~MsgTask();
+ void sendMsg(const LocMsg* msg) const;
+
+private:
+ const void* mQ;
+ tAssociate mAssociator;
+ MsgTask(const void* q, tAssociate associator);
+ static void* loopMain(void* copy);
+ void createPThread(const char* name);
+};
+
+} // namespace loc_core
+
+#endif //__MSG_TASK__
diff --git a/msm8960/core/UlpProxyBase.h b/msm8960/core/UlpProxyBase.h
new file mode 100644
index 0000000..02ba167
--- /dev/null
+++ b/msm8960/core/UlpProxyBase.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ inline UlpProxyBase() {}
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { return false;}
+ inline virtual bool sendStopFix() { return false;}
+ inline virtual bool sendFixMode(LocPosMode ¶ms) { return false;}
+ inline virtual bool reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
+ }
+ inline virtual bool reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt) {
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* adapter) {}
+ inline virtual void setCapabilities(unsigned long capabilities) {}
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/msm8960/core/gps_extended.h b/msm8960/core/gps_extended.h
new file mode 100644
index 0000000..88b0415
--- /dev/null
+++ b/msm8960/core/gps_extended.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gps_extended_c.h>
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ GpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ char credentials[14];
+ char provider[8];
+ LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ const char* cred, const char* prov) :
+ mode(m), recurrence(recr),
+ min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
+ preferred_accuracy(accu), preferred_time(time) {
+ 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(GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(MIN_POSSIBLE_FIX_INTERVAL),
+ preferred_accuracy(50), preferred_time(120000) {
+ 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 &&
+ !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/msm8960/core/gps_extended_c.h b/msm8960/core/gps_extended_c.h
new file mode 100644
index 0000000..429eb2d
--- /dev/null
+++ b/msm8960/core/gps_extended_c.h
@@ -0,0 +1,329 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <hardware/gps.h>
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** GpsLocation has valid "is indoor?" flag */
+#define GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** GpsLocation has valid floor number */
+#define GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** GpsLocation has valid map URL*/
+#define GPS_LOCATION_HAS_MAP_URL 0x0100
+/** GpsLocation has valid map index */
+#define GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+/** 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
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ GpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+/** AGPS type */
+typedef int16_t AGpsExtType;
+#define AGPS_TYPE_INVALID -1
+#define AGPS_TYPE_ANY 0
+#define AGPS_TYPE_SUPL 1
+#define AGPS_TYPE_C2K 2
+#define AGPS_TYPE_WWAN_ANY 3
+#define AGPS_TYPE_WIFI 4
+#define AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+#define GPS_DELETE_ALMANAC_CORR 0x00001000
+#define GPS_DELETE_FREQ_BIAS_EST 0x00002000
+#define GPS_DELETE_EPHEMERIS_GLO 0x00004000
+#define GPS_DELETE_ALMANAC_GLO 0x00008000
+#define GPS_DELETE_SVDIR_GLO 0x00010000
+#define GPS_DELETE_SVSTEER_GLO 0x00020000
+#define GPS_DELETE_ALMANAC_CORR_GLO 0x00040000
+#define GPS_DELETE_TIME_GPS 0x00080000
+#define GPS_DELETE_TIME_GLO 0x00100000
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(GpsCallbacks) */
+ size_t size;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ 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 {
+ gps_xtra_download_request download_request_cb;
+ 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) */
+ size_t size;
+
+ AGpsExtType type;
+ AGpsStatusValue status;
+ uint32_t ipv4_addr;
+ char ipv6_addr[16];
+ 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;
+ gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ gps_ni_notify_callback notify_cb;
+ gps_create_thread create_thread_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
+} LocServerType;
+
+typedef enum loc_position_mode_type {
+ LOC_POSITION_MODE_STANDALONE,
+ 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;
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint16_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
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+} GpsLocationExtended;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+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)
+
+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_ENGINE_DOWN = 100,
+ LOC_API_ADAPTER_ERR_FAILURE,
+ 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_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_PEDOMETER_CTRL (1<<LOC_API_ADAPTER_PEDOMETER_CTRL)
+#define LOC_API_ADAPTER_BIT_MOTION_CTRL (1<<LOC_API_ADAPTER_MOTION_CTRL)
+
+typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
+
diff --git a/msm8960/core/loc_core_log.cpp b/msm8960/core/loc_core_log.cpp
new file mode 100644
index 0000000..f67dfe0
--- /dev/null
+++ b/msm8960/core/loc_core_log.cpp
@@ -0,0 +1,250 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_core_log.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static loc_name_val_s_type gps_status_name[] =
+{
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
+};
+static int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(GpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
+};
+static int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( GPS_DELETE_ALMANAC ),
+ NAME_VAL( GPS_DELETE_POSITION ),
+ NAME_VAL( GPS_DELETE_TIME ),
+ NAME_VAL( GPS_DELETE_IONO ),
+ NAME_VAL( GPS_DELETE_UTC ),
+ NAME_VAL( GPS_DELETE_HEALTH ),
+ NAME_VAL( GPS_DELETE_SVDIR ),
+ NAME_VAL( GPS_DELETE_SVSTEER ),
+ NAME_VAL( GPS_DELETE_SADATA ),
+ NAME_VAL( GPS_DELETE_RTI ),
+ NAME_VAL( GPS_DELETE_CELLDB_INFO ),
+ NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
+ NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
+ NAME_VAL( GPS_DELETE_EPHEMERIS_GLO ),
+ NAME_VAL( GPS_DELETE_ALMANAC_GLO ),
+ NAME_VAL( GPS_DELETE_SVDIR_GLO ),
+ NAME_VAL( GPS_DELETE_SVSTEER_GLO ),
+ NAME_VAL( GPS_DELETE_ALMANAC_CORR_GLO ),
+ NAME_VAL( GPS_DELETE_TIME_GPS ),
+ NAME_VAL( GPS_DELETE_TIME_GLO )
+};
+static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(GpsAidingData data)
+{
+ return NULL;
+}
+
+
+static loc_name_val_s_type loc_eng_agps_types[] =
+{
+ NAME_VAL( AGPS_TYPE_INVALID ),
+ NAME_VAL( AGPS_TYPE_ANY ),
+ NAME_VAL( AGPS_TYPE_SUPL ),
+ NAME_VAL( AGPS_TYPE_C2K ),
+ NAME_VAL( AGPS_TYPE_WWAN_ANY )
+};
+static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(AGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_types[] =
+{
+ NAME_VAL( GPS_NI_TYPE_VOICE ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE )
+};
+static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(GpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_responses[] =
+{
+ NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY )
+};
+static int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(GpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_encodings[] =
+{
+ NAME_VAL( GPS_ENC_NONE ),
+ NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( GPS_ENC_UNKNOWN )
+};
+static int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static loc_name_val_s_type loc_eng_agps_bears[] =
+{
+ NAME_VAL( AGPS_APN_BEARER_INVALID ),
+ NAME_VAL( AGPS_APN_BEARER_IPV4 ),
+ NAME_VAL( AGPS_APN_BEARER_IPV4 ),
+ NAME_VAL( AGPS_APN_BEARER_IPV4V6 )
+};
+static int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static loc_name_val_s_type loc_eng_agps_status_names[] =
+{
+ NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
+};
+static int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(AGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/msm8960/core/loc_core_log.h b/msm8960/core/loc_core_log.h
new file mode 100644
index 0000000..8a1825a
--- /dev/null
+++ b/msm8960/core/loc_core_log.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_CORE_LOG_H
+#define LOC_CORE_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <gps_extended.h>
+
+const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+const char* loc_get_position_mode_name(GpsPositionMode mode);
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(GpsAidingData data);
+const char* loc_get_agps_type_name(AGpsType type);
+const char* loc_get_ni_type_name(GpsNiType type);
+const char* loc_get_ni_response_name(GpsUserResponseType response);
+const char* loc_get_ni_encoding_name(GpsNiEncodingType 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(AGpsStatusValue status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CORE_LOG_H */
diff --git a/msm8960/etc/Android.mk b/msm8960/etc/Android.mk
new file mode 100644
index 0000000..427b5c8
--- /dev/null
+++ b/msm8960/etc/Android.mk
@@ -0,0 +1,14 @@
+
+LOCAL_PATH := $(call my-dir)
+
+ifeq ($(filter flo deb,$(TARGET_DEVICE)),)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/
+LOCAL_SRC_FILES := gps.conf
+
+include $(BUILD_PREBUILT)
+endif
diff --git a/msm8960/etc/gps.conf b/msm8960/etc/gps.conf
new file mode 100755
index 0000000..6aa1901
--- /dev/null
+++ b/msm8960/etc/gps.conf
@@ -0,0 +1,92 @@
+# XTRA_SERVER_QUERY (1=on, 0=off)
+# If XTRA_SERVER_QUERY is on, the XTRA_SERVERs listed
+# below will be ignored, and instead the servers will
+# be queried from the modem.
+XTRA_SERVER_QUERY=0
+# XTRA_SERVERs below are used only if XTRA_SERVER_QUERY
+# is off.
+XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra2.bin
+XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra2.bin
+XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra2.bin
+
+# Error Estimate
+# _SET = 1
+# _CLEAR = 0
+ERR_ESTIMATE=0
+
+#Test
+NTP_SERVER=time.gpsonextra.net
+#Asia
+# NTP_SERVER=asia.pool.ntp.org
+#Europe
+# NTP_SERVER=europe.pool.ntp.org
+#North America
+# NTP_SERVER=north-america.pool.ntp.org
+
+# 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 = 2
+
+# Intermediate position report, 1=enable, 0=disable
+INTERMEDIATE_POS=0
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# GPS Capabilities bit mask
+# SCHEDULING = 0x01
+# MSB = 0x02
+# MSA = 0x04
+# ON_DEMAND_TIME = 0x10
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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
+SUPL_HOST=supl.google.com
+SUPL_PORT=7276
+
+# FOR C2K PDE SUPPORT, set the following
+# C2K_HOST=c2k.pde.com or IP
+# C2K_PORT=1234
+
+####################################
+# 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 = 0
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=0
+
+##################################################
+# Select Positioning Protocol on A-GLONASS system
+##################################################
+# 0x1: RRC CPlane
+# 0x2: RRLP UPlane
+# 0x4: LLP Uplane
+A_GLONASS_POS_PROTOCOL_SELECT = 0
diff --git a/msm8960/loc_api/Android.mk b/msm8960/loc_api/Android.mk
new file mode 100644
index 0000000..13f18f6
--- /dev/null
+++ b/msm8960/loc_api/Android.mk
@@ -0,0 +1,7 @@
+
+LOCAL_PATH := $(call my-dir)
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
+
+#call the subfolders
+include $(addsuffix Android.mk, $(GPS_DIR_LIST))
diff --git a/msm8960/loc_api/NOTICE b/msm8960/loc_api/NOTICE
new file mode 100644
index 0000000..85b5740
--- /dev/null
+++ b/msm8960/loc_api/NOTICE
@@ -0,0 +1,13 @@
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
diff --git a/msm8960/loc_api/libloc_api_50001/Android.mk b/msm8960/loc_api/libloc_api_50001/Android.mk
new file mode 100644
index 0000000..b9a63b0
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/Android.mk
@@ -0,0 +1,101 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_eng
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_nmea.cpp \
+ LocEngAdapter.cpp
+
+LOCAL_SRC_FILES += \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_COPY_HEADERS_TO:= libloc_eng/
+LOCAL_COPY_HEADERS:= \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+## Libs
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_eng \
+ libloc_core \
+ libgps.utils \
+ libdl
+
+LOCAL_SRC_FILES += \
+ loc.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+
+ifeq ($(TARGET_USES_QCOM_BSP), true)
+LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
+endif
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/msm8960/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msm8960/loc_api/libloc_api_50001/LocEngAdapter.cpp
new file mode 100644
index 0000000..116a8ae
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -0,0 +1,260 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_EngAdapter"
+
+#include <LocEngAdapter.h>
+#include "loc_eng_msg.h"
+#include "loc_log.h"
+
+using namespace loc_core;
+
+LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
+ LocAdapterBase(adapter->getMsgTask()),
+ mLocEngAdapter(adapter)
+{
+}
+void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
+ sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
+}
+void LocInternalAdapter::startFixInt() {
+ sendMsg(new LocEngStartFix(mLocEngAdapter));
+}
+void LocInternalAdapter::stopFixInt() {
+ sendMsg(new LocEngStopFix(mLocEngAdapter));
+}
+void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
+ struct LocSetUlpProxy : public LocMsg {
+ LocAdapterBase* mAdapter;
+ UlpProxyBase* mUlp;
+ inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
+ LocMsg(), mAdapter(adapter), mUlp(ulp) {
+ }
+ virtual void proc() const {
+ LOC_LOGV("%s] ulp %p adapter %p", __func__,
+ mUlp, mAdapter);
+ mAdapter->setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
+}
+
+LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner,
+ MsgTask::tCreate tCreator) :
+ LocAdapterBase(mask,
+ LocDualContext::getLocFgContext(
+ tCreator,
+ LocDualContext::mLocationHalName)),
+ mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
+ mUlp(new UlpProxyBase()), mNavigating(false),
+ mAgpsEnabled(false)
+{
+ memset(&mFixCriteria, 0, sizeof(mFixCriteria));
+ LOC_LOGD("LocEngAdapter created");
+}
+
+inline
+LocEngAdapter::~LocEngAdapter()
+{
+ delete mInternalAdapter;
+ LOC_LOGV("LocEngAdapter deleted");
+}
+
+void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ delete mUlp;
+ LOC_LOGV("%s] %p", __func__, ulp);
+ if (NULL == ulp) {
+ ulp = new UlpProxyBase();
+ }
+ mUlp = ulp;
+}
+
+void LocInternalAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ sendMsg(new LocEngReportPosition(mLocEngAdapter,
+ location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask));
+}
+
+
+void LocEngAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ if (! mUlp->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask )) {
+ mInternalAdapter->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask);
+ }
+}
+
+void LocInternalAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt){
+ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
+ locationExtended, svExt));
+}
+
+void LocEngAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+
+ // We want to send SV info to ULP to help it in determining GNSS
+ // signal strength ULP will forward the SV reports to HAL without
+ // any modifications
+ if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
+ mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
+ }
+}
+
+inline
+void LocEngAdapter::reportStatus(GpsStatusValue status)
+{
+ sendMsg(new LocEngReportStatus(mOwner, status));
+}
+
+inline
+void LocEngAdapter::reportNmea(const char* nmea, int length)
+{
+ sendMsg(new LocEngReportNmea(mOwner, nmea, length));
+}
+
+inline
+bool LocEngAdapter::reportXtraServer(const char* url1,
+ const char* url2,
+ const char* url3,
+ const int maxlength)
+{
+ if (mAgpsEnabled) {
+ sendMsg(new LocEngReportXtraServer(mOwner, url1,
+ url2, url3, maxlength));
+ }
+ return mAgpsEnabled;
+}
+
+inline
+bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type)
+{
+ if (mAgpsEnabled) {
+ sendMsg(new LocEngRequestATL(mOwner,
+ connHandle, agps_type));
+ }
+ return mAgpsEnabled;
+}
+
+inline
+bool LocEngAdapter::releaseATL(int connHandle)
+{
+ if (mAgpsEnabled) {
+ sendMsg(new LocEngReleaseATL(mOwner, connHandle));
+ }
+ return mAgpsEnabled;
+}
+
+inline
+bool LocEngAdapter::requestXtraData()
+{
+ if (mAgpsEnabled) {
+ sendMsg(new LocEngRequestXtra(mOwner));
+ }
+ return mAgpsEnabled;
+}
+
+inline
+bool LocEngAdapter::requestTime()
+{
+ if (mAgpsEnabled) {
+ sendMsg(new LocEngRequestTime(mOwner));
+ }
+ return mAgpsEnabled;
+}
+
+inline
+bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data)
+{
+ if (mAgpsEnabled) {
+ notif.size = sizeof(notif);
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ sendMsg(new LocEngRequestNi(mOwner, notif, data));
+ }
+ return mAgpsEnabled;
+}
+
+inline
+bool LocEngAdapter::requestSuplES(int connHandle)
+{
+ sendMsg(new LocEngRequestSuplEs(mOwner, connHandle));
+ return true;
+}
+
+inline
+bool LocEngAdapter::reportDataCallOpened()
+{
+ sendMsg(new LocEngSuplEsOpened(mOwner));
+ return true;
+}
+
+inline
+bool LocEngAdapter::reportDataCallClosed()
+{
+ sendMsg(new LocEngSuplEsClosed(mOwner));
+ return true;
+}
+
+inline
+void LocEngAdapter::handleEngineDownEvent()
+{
+ sendMsg(new LocEngDown(mOwner));
+}
+
+inline
+void LocEngAdapter::handleEngineUpEvent()
+{
+ sendMsg(new LocEngUp(mOwner));
+}
diff --git a/msm8960/loc_api/libloc_api_50001/LocEngAdapter.h b/msm8960/loc_api/libloc_api_50001/LocEngAdapter.h
new file mode 100644
index 0000000..6ad3ba9
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -0,0 +1,271 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_API_ENG_ADAPTER_H
+#define LOC_API_ENG_ADAPTER_H
+
+#include <ctype.h>
+#include <hardware/gps.h>
+#include <loc.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <platform_lib_includes.h>
+
+#define MAX_URL_LEN 256
+
+using namespace loc_core;
+
+class LocEngAdapter;
+
+class LocInternalAdapter : public LocAdapterBase {
+ LocEngAdapter* mLocEngAdapter;
+public:
+ LocInternalAdapter(LocEngAdapter* adapter);
+
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void setPositionModeInt(LocPosMode& posMode);
+ virtual void startFixInt();
+ virtual void stopFixInt();
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+};
+
+typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
+
+class LocEngAdapter : public LocAdapterBase {
+ void* mOwner;
+ LocInternalAdapter* mInternalAdapter;
+ UlpProxyBase* mUlp;
+ LocPosMode mFixCriteria;
+ bool mNavigating;
+
+public:
+ bool mAgpsEnabled;
+
+ LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner,
+ MsgTask::tCreate tCreator);
+ virtual ~LocEngAdapter();
+
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ inline void requestUlp(unsigned long capabilities) {
+ mContext->requestUlp(mInternalAdapter, capabilities);
+ }
+ inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
+ inline UlpProxyBase* getUlpProxy() { return mUlp; }
+ inline void* getOwner() { return mOwner; }
+ inline bool hasAgpsExt() { return mContext->hasAgpsExt(); }
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+
+ inline enum loc_api_adapter_err
+ startFix()
+ {
+ return mLocApi->startFix(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ stopFix()
+ {
+ return mLocApi->stopFix();
+ }
+ inline enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f)
+ {
+ return mLocApi->deleteAidingData(f);
+ }
+ inline enum loc_api_adapter_err
+ enableData(int enable)
+ {
+ return mLocApi->enableData(enable);
+ }
+ inline enum loc_api_adapter_err
+ setAPN(char* apn, int len)
+ {
+ return mLocApi->setAPN(apn, len);
+ }
+ inline enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy)
+ {
+ return mLocApi->injectPosition(latitude, longitude, accuracy);
+ }
+ inline enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+ {
+ return mLocApi->setTime(time, timeReference, uncertainty);
+ }
+ inline enum loc_api_adapter_err
+ setXtraData(char* data, int length)
+ {
+ return mLocApi->setXtraData(data, length);
+ }
+ inline enum loc_api_adapter_err
+ requestXtraServer()
+ {
+ return mLocApi->requestXtraServer();
+ }
+ inline enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+ {
+ return mLocApi->atlOpenStatus(handle, is_succ, apn, bearer, agpsType);
+ }
+ inline enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ)
+ {
+ return mLocApi->atlCloseStatus(handle, is_succ);
+ }
+ inline enum loc_api_adapter_err
+ setPositionMode(const LocPosMode *posMode)
+ {
+ if (NULL != posMode) {
+ mFixCriteria = *posMode;
+ }
+ return mLocApi->setPositionMode(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ setServer(const char* url, int len)
+ {
+ return mLocApi->setServer(url, len);
+ }
+ inline enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+ {
+ return mLocApi->setServer(ip, port, type);
+ }
+ inline enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData)
+ {
+ return mLocApi->informNiResponse(userResponse, passThroughData);
+ }
+ inline enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version)
+ {
+ return mLocApi->setSUPLVersion(version);
+ }
+ inline enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile)
+ {
+ return mLocApi->setLPPConfig(profile);
+ }
+ inline enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage)
+ {
+ return mLocApi->setSensorControlConfig(sensorUsage);
+ }
+ inline enum loc_api_adapter_err
+ setSensorProperties(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)
+ {
+ return mLocApi->setSensorProperties(gyroBiasVarianceRandomWalk_valid, gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid, angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid, rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid, velocityBiasVarianceRandomWalk);
+ }
+ inline virtual enum loc_api_adapter_err
+ setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
+ {
+ return mLocApi->setSensorPerfControlConfig(controlMode, accelSamplesPerBatch, accelBatchesPerSec,
+ gyroSamplesPerBatch, gyroBatchesPerSec,
+ accelSamplesPerBatchHigh, accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
+ algorithmConfig);
+ }
+ inline virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging)
+ {
+ return mLocApi->setExtPowerConfig(isBatteryCharging);
+ }
+ inline virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+ {
+ return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
+ }
+ inline virtual int initDataServiceClient()
+ {
+ return mLocApi->initDataServiceClient();
+ }
+ inline virtual int openAndStartDataCall()
+ {
+ return mLocApi->openAndStartDataCall();
+ }
+ inline virtual void stopDataCall()
+ {
+ mLocApi->stopDataCall();
+ }
+ inline virtual void closeDataCall()
+ {
+ mLocApi->closeDataCall();
+ }
+
+ virtual void handleEngineDownEvent();
+ virtual void handleEngineUpEvent();
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+
+ inline const LocPosMode& getPositionMode() const
+ {return mFixCriteria;}
+ inline virtual bool isInSession()
+ { return mNavigating; }
+ inline void setInSession(bool inSession)
+ { mNavigating = inSession; mLocApi->setInSession(inSession); }
+};
+
+#endif //LOC_API_ENG_ADAPTER_H
diff --git a/msm8960/loc_api/libloc_api_50001/Makefile.am b/msm8960/loc_api/libloc_api_50001/Makefile.am
new file mode 100644
index 0000000..2374357
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/Makefile.am
@@ -0,0 +1,76 @@
+AM_CFLAGS = \
+ -I../../utils \
+ -I../../platform_lib_abstractions \
+ -fno-short-enums \
+ -DFEATURE_GNSS_BIT_API
+
+libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp
+
+if USE_GLIB
+libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la
+
+
+libloc_eng_so_la_SOURCES = \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+
+if USE_GLIB
+libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_eng_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la
+
+
+libgps_default_so_la_SOURCES = \
+ loc.cpp \
+ gps.c
+
+if USE_GLIB
+libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_default_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la
+
+library_include_HEADERS = \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+library_includedir = $(pkgincludedir)/libloc_api_50001
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la
diff --git a/msm8960/loc_api/libloc_api_50001/gps.c b/msm8960/loc_api/libloc_api_50001/gps.c
new file mode 100644
index 0000000..79a9f7e
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/gps.c
@@ -0,0 +1,69 @@
+/* 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.
+ *
+ */
+
+#include <hardware/gps.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = 1,
+ .hal_api_version = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/msm8960/loc_api/libloc_api_50001/loc.cpp b/msm8960/loc_api/libloc_api_50001/loc.cpp
new file mode 100644
index 0000000..6e06e6d
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc.cpp
@@ -0,0 +1,912 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_afw"
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_eng.h>
+#include <loc_target.h>
+#include <loc_log.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <LocDualContext.h>
+#include <cutils/properties.h>
+
+using namespace loc_core;
+
+//Globals defns
+static gps_location_callback gps_loc_cb = NULL;
+static gps_sv_status_callback gps_sv_cb = NULL;
+
+static void local_loc_cb(UlpLocation* location, void* locExt);
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
+
+static const GpsGeofencingInterface* get_geofence_interface(void);
+
+// Function declarations for sLocEngInterface
+static int loc_init(GpsCallbacks* callbacks);
+static int loc_start();
+static int loc_stop();
+static void loc_cleanup();
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_inject_location(double latitude, double longitude, float accuracy);
+static void loc_delete_aiding_data(GpsAidingData f);
+static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy,
+ uint32_t preferred_time);
+static const void* loc_get_extension(const char* name);
+
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_init,
+ loc_start,
+ loc_stop,
+ loc_cleanup,
+ loc_inject_time,
+ loc_inject_location,
+ loc_delete_aiding_data,
+ loc_set_position_mode,
+ loc_get_extension
+};
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_agps_init(AGpsCallbacks* callbacks);
+static int loc_agps_open(const char* apn);
+static int loc_agps_closed();
+static int loc_agps_open_failed();
+static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+
+static const AGpsInterface_v1 sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface_v1),
+ loc_agps_init,
+ loc_agps_open,
+ loc_agps_closed,
+ loc_agps_open_failed,
+ loc_agps_set_server
+};
+
+static int loc_xtra_init(GpsXtraCallbacks* callbacks);
+static int loc_xtra_inject_data(char* data, int length);
+
+static const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ loc_xtra_init,
+ loc_xtra_inject_data
+};
+
+static void loc_ni_init(GpsNiCallbacks *callbacks);
+static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_ni_init,
+ loc_ni_respond,
+};
+
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
+static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
+
+static const AGpsRilInterface sLocEngAGpsRilInterface =
+{
+ sizeof(AGpsRilInterface),
+ loc_agps_ril_init,
+ loc_agps_ril_set_ref_location,
+ loc_agps_ril_set_set_id,
+ loc_agps_ril_ni_message,
+ loc_agps_ril_update_network_state,
+ loc_agps_ril_update_network_availability
+};
+
+static loc_eng_data_s_type loc_afw_data;
+static int gss_fd = 0;
+
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ ENTRY_LOG_CALLFLOW();
+ const GpsInterface* ret_val;
+
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ loc_eng_read_config();
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ ret_val = NULL;
+ } else {
+ ret_val = &sLocEngInterface;
+ }
+
+ loc_eng_read_config();
+
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ unsigned int target = TARGET_DEFAULT;
+ loc_eng_read_config();
+
+ target = get_target();
+ LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
+ //APQ8064
+ if( getTargetGnssType(target) == GNSS_GSS ) {
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ gss_fd = open("/dev/gss", O_RDONLY);
+ if (gss_fd < 0) {
+ LOC_LOGE("GSS open failed: %s\n", strerror(errno));
+ }
+ else {
+ LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
+ gps_conf.CAPABILITIES);
+ }
+ }
+ //MPQ8064
+ else if( getTargetGnssType(target) == GNSS_NONE) {
+ LOC_LOGE("No GPS HW on this target (MPQ8064). Not returning interface");
+ return NULL;
+ }
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/Ax
+
+===========================================================================*/
+static int loc_init(GpsCallbacks* callbacks)
+{
+ int retVal = -1;
+ ENTRY_LOG();
+ LOC_API_ADAPTER_EVENT_MASK_T event;
+
+ if (NULL == callbacks) {
+ LOC_LOGE("loc_init failed. cb = NULL\n");
+ EXIT_LOG(%d, retVal);
+ return retVal;
+ }
+
+ event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
+ callbacks->status_cb, /* status_cb */
+ local_sv_cb, /* sv_status_cb */
+ callbacks->nmea_cb, /* nmea_cb */
+ callbacks->set_capabilities_cb, /* set_capabilities_cb */
+ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
+ callbacks->release_wakelock_cb, /* release_wakelock_cb */
+ callbacks->create_thread_cb, /* create_thread_cb */
+ NULL, /* location_ext_parser */
+ NULL, /* sv_ext_parser */
+ callbacks->request_utc_time_cb /* request_utc_time_cb */};
+
+ gps_loc_cb = callbacks->location_cb;
+ gps_sv_cb = callbacks->sv_status_cb;
+
+ retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event);
+ loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES);
+ loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt();
+
+
+ EXIT_LOG(%d, retVal);
+ return retVal;
+}
+
+/*===========================================================================
+FUNCTION loc_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_cleanup()
+{
+ ENTRY_LOG();
+ loc_eng_cleanup(loc_afw_data);
+ gps_loc_cb = NULL;
+ gps_sv_cb = NULL;
+
+ /*
+ * if (get_target() == TARGET_NAME_APQ8064_STANDALONE)
+ * {
+ * close(gss_fd);
+ * LOC_LOGD("GSS shutdown.\n");
+ * }
+ */
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_start()
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_start(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_stop()
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ ret_val = loc_eng_stop(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_set_position_mode(GpsPositionMode mode,
+ GpsPositionRecurrence recurrence,
+ uint32_t min_interval,
+ uint32_t preferred_accuracy,
+ uint32_t preferred_time)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ LocPositionMode locMode;
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ locMode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ locMode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ locMode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+
+ LocPosMode params(locMode, recurrence, min_interval,
+ preferred_accuracy, preferred_time, NULL, NULL);
+ ret_val = loc_eng_set_position_mode(loc_afw_data, params);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG();
+ int ret_val = 0;
+
+ ret_val = loc_eng_inject_time(loc_afw_data, time,
+ timeReference, uncertainty);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_inject_location(double latitude, double longitude, float accuracy)
+{
+ static bool initialized = false;
+ static bool enable_cpi = true;
+ ENTRY_LOG();
+
+ if(!initialized)
+ {
+ char value[PROPERTY_VALUE_MAX];
+ memset(value, 0, sizeof(value));
+ (void)property_get("persist.gps.qc_nlp_in_use", value, "0");
+ if(0 == strcmp(value, "1"))
+ {
+ enable_cpi = false;
+ LOC_LOGI("GPS HAL coarse position injection disabled");
+ }
+ else
+ {
+ LOC_LOGI("GPS HAL coarse position injection enabled");
+ }
+ initialized = true;
+ }
+
+ int ret_val = 0;
+ if(enable_cpi)
+ {
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+ }
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_delete_aiding_data(GpsAidingData f)
+{
+ ENTRY_LOG();
+ loc_eng_delete_aiding_data(loc_afw_data, f);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+const GpsGeofencingInterface* get_geofence_interface(void)
+{
+ ENTRY_LOG();
+ void *handle;
+ const char *error;
+ typedef const GpsGeofencingInterface* (*get_gps_geofence_interface_function) (void);
+ get_gps_geofence_interface_function get_gps_geofence_interface;
+ static const GpsGeofencingInterface* geofence_interface = NULL;
+
+ dlerror(); /* Clear any existing error */
+
+ handle = dlopen ("libgeofence.so", RTLD_NOW);
+
+ if (!handle)
+ {
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlopen for libgeofence.so failed, error = %s\n", __func__, error);
+ }
+ goto exit;
+ }
+ dlerror(); /* Clear any existing error */
+ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
+ goto exit;
+ }
+
+ geofence_interface = get_gps_geofence_interface();
+
+exit:
+ EXIT_LOG(%d, geofence_interface == NULL);
+ return geofence_interface;
+}
+/*===========================================================================
+FUNCTION loc_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* loc_get_extension(const char* name)
+{
+ ENTRY_LOG();
+ const void* ret_val = NULL;
+
+ LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ //Return an interface to AGPS only if MSA or MSB capabilities
+ //are present. If the target is an APQ, these masks are
+ //cleared in get_gps_interface() and the below logic will
+ //return NULL as the interface for AGPS
+ if((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
+ (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) ) {
+ LOC_LOGD("%s:%d]: AGPS capabilities found\n", __func__, __LINE__);
+ ret_val = &sLocEngAGpsInterface;
+ }
+ else {
+ LOC_LOGD("%s:%d]: Returning NULL AgpsInterface\n", __func__, __LINE__);
+ ret_val = NULL;
+ }
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngNiInterface;
+ }
+ else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
+ {
+ char baseband[PROPERTY_VALUE_MAX];
+ property_get("ro.baseband", baseband, "msm");
+ if (strcmp(baseband, "csfb") == 0)
+ {
+ ret_val = &sLocEngAGpsRilInterface;
+ }
+ }
+ else if (strcmp(name, GPS_GEOFENCING_INTERFACE) == 0)
+ {
+ if ((gps_conf.CAPABILITIES | GPS_CAPABILITY_GEOFENCING) == gps_conf.CAPABILITIES ){
+ ret_val = get_geofence_interface();
+ }
+ }
+ else
+ {
+ LOC_LOGE ("get_extension: Invalid interface passed in\n");
+ }
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_init(AGpsCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_agps_init(loc_afw_data, (AGpsExtCallbacks*)callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open(const char* apn)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType = AGPS_APN_BEARER_IPV4;
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_closed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_agps_open_failed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_set_server
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ LocServerType serverType;
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ break;
+ case AGPS_TYPE_C2K:
+ serverType = LOC_AGPS_CDMA_PDE_SERVER;
+ break;
+ default:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ }
+ int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTIONf571
+ loc_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_xtra_init(loc_afw_data, (GpsXtraExtCallbacks*)callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_xtra_inject_data
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_inject_data(char* data, int length)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE))
+ ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
+ else
+ LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d",
+ __func__, data, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_init(GpsNiCallbacks *callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG();
+ loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+// Below stub functions are members of sLocEngAGpsRilInterface
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {}
+
+/*===========================================================================
+FUNCTION loc_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_ril_update_network_availability(int available, const char* apn)
+{
+ ENTRY_LOG();
+ loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_loc_cb(UlpLocation* location, void* locExt)
+{
+ ENTRY_LOG();
+ if (NULL != location) {
+ CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
+
+ if (NULL != gps_loc_cb) {
+ gps_loc_cb(&location->gpsLocation);
+ }
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
+{
+ ENTRY_LOG();
+ if (NULL != gps_sv_cb) {
+ CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
+ gps_sv_cb(sv_status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc.h b/msm8960/loc_api/libloc_api_50001/loc.h
new file mode 100644
index 0000000..ea02497
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc.h
@@ -0,0 +1,66 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_H__
+#define __LOC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/
+
+typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
+typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
+typedef void* (*loc_ext_parser)(void* data);
+
+typedef struct {
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ gps_request_utc_time request_utc_time_cb;
+} LocCallbacks;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_H__
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng.cpp
new file mode 100644
index 0000000..ade891e
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng.cpp
@@ -0,0 +1,2495 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <time.h>
+
+#include <LocEngAdapter.h>
+
+#include <cutils/sched_policy.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+#include <glib.h>
+#include <sys/syscall.h>
+#endif /* USE_GLIB */
+
+#include <string.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_dmn_conn.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_msg.h>
+#include <loc_eng_nmea.h>
+#include <msg_q.h>
+#include <loc.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_core_log.h"
+#include "loc_eng_log.h"
+
+#define SUCCESS TRUE
+#define FAILURE FALSE
+
+#ifndef GPS_CONF_FILE
+#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
+#endif
+
+#ifndef SAP_CONF_FILE
+#define SAP_CONF_FILE "/etc/sap.conf"
+#endif
+
+using namespace loc_core;
+
+boolean configAlreadyRead = false;
+unsigned int agpsStatus = 0;
+loc_gps_cfg_s_type gps_conf;
+loc_sap_cfg_s_type sap_conf;
+
+/* Parameter spec table */
+static loc_param_s_type loc_parameter_table[] =
+{
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"ENABLE_WIPER", &gps_conf.ENABLE_WIPER, NULL, 'n'},
+ {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
+ {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
+ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'},
+ {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+};
+
+static void loc_default_parameters(void)
+{
+ /* defaults */
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.ENABLE_WIPER = 0;
+ gps_conf.NMEA_PROVIDER = 0;
+ gps_conf.SUPL_VER = 0x10000;
+ gps_conf.CAPABILITIES = 0x7;
+
+ sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ sap_conf.SENSOR_USAGE = 0; /* Enabled */
+ sap_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 */
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+
+ /* LTE Positioning Profile configuration is disable by default*/
+ gps_conf.LPP_PROFILE = 0;
+
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+}
+
+// 2nd half of init(), singled out for
+// modem restart to use.
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
+
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+// Internal functions
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_report_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_process_conn_request(loc_eng_data_s_type &loc_eng_data,
+ int connHandle, AGpsType agps_type);
+static void loc_eng_agps_close_status(loc_eng_data_s_type &loc_eng_data, int is_succ);
+static void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data) ;
+static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
+
+static void deleteAidingData(loc_eng_data_s_type &logEng);
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
+
+static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ loc_eng_data.adapter->deleteAidingData(loc_eng_data.aiding_data_for_deletion);
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+}
+
+static void* noProc(void* data)
+{
+ return NULL;
+}
+
+
+/*********************************************************************
+ * definitions of the static messages used in the file
+ *********************************************************************/
+// case LOC_ENG_MSG_REQUEST_NI:
+LocEngRequestNi::LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data) :
+ LocMsg(), mLocEng(locEng), mNotify(notif), mPayload(data) {
+ locallog();
+}
+void LocEngRequestNi::proc() const {
+ loc_eng_ni_request_handler(*((loc_eng_data_s_type*)mLocEng),
+ &mNotify, mPayload);
+}
+void LocEngRequestNi::locallog() const
+{
+ LOC_LOGV("id: %d\n type: %s\n flags: %d\n time out: %d\n "
+ "default response: %s\n requestor id encoding: %s\n"
+ " text encoding: %s\n passThroughData: %p",
+ mNotify.notification_id,
+ loc_get_ni_type_name(mNotify.ni_type),
+ mNotify.notify_flags,
+ mNotify.timeout,
+ loc_get_ni_response_name(mNotify.default_response),
+ loc_get_ni_encoding_name(mNotify.requestor_id_encoding),
+ loc_get_ni_encoding_name(mNotify.text_encoding),
+ mPayload);
+}
+inline void LocEngRequestNi::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_INFORM_NI_RESPONSE:
+// in loc_eng_ni.cpp
+
+// case LOC_ENG_MSG_START_FIX:
+LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStartFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_start_handler(*locEng);
+}
+inline void LocEngStartFix::locallog() const
+{
+ LOC_LOGV("LocEngStartFix");
+}
+inline void LocEngStartFix::log() const
+{
+ locallog();
+}
+void LocEngStartFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_STOP_FIX:
+LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStopFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_stop_handler(*locEng);
+}
+inline void LocEngStopFix::locallog() const
+{
+ LOC_LOGV("LocEngStopFix");
+}
+inline void LocEngStopFix::log() const
+{
+ locallog();
+}
+void LocEngStopFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_POSITION_MODE:
+LocEngPositionMode::LocEngPositionMode(LocEngAdapter* adapter,
+ LocPosMode &mode) :
+ LocMsg(), mAdapter(adapter), mPosMode(mode)
+{
+ mPosMode.logv();
+}
+inline void LocEngPositionMode::proc() const {
+ mAdapter->setPositionMode(&mPosMode);
+}
+inline void LocEngPositionMode::log() const {
+ mPosMode.logv();
+}
+void LocEngPositionMode::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_TIME:
+struct LocEngSetTime : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUtcTime mTime;
+ const int64_t mTimeReference;
+ const int mUncertainty;
+ inline LocEngSetTime(LocEngAdapter* adapter,
+ GpsUtcTime t, int64_t tf, int unc) :
+ LocMsg(), mAdapter(adapter),
+ mTime(t), mTimeReference(tf), mUncertainty(unc)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setTime(mTime, mTimeReference, mUncertainty);
+ }
+ inline void locallog() const {
+ LOC_LOGV("time: %lld\n timeReference: %lld\n uncertainty: %d",
+ mTime, mTimeReference, mUncertainty);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+ // case LOC_ENG_MSG_INJECT_LOCATION:
+struct LocEngInjectLocation : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const double mLatitude;
+ const double mLongitude;
+ const float mAccuracy;
+ inline LocEngInjectLocation(LocEngAdapter* adapter,
+ double lat, double lon, float accur) :
+ LocMsg(), mAdapter(adapter),
+ mLatitude(lat), mLongitude(lon), mAccuracy(accur)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ inline void locallog() const {
+ LOC_LOGV("latitude: %f\n longitude: %f\n accuracy: %f",
+ mLatitude, mLongitude, mAccuracy);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_IPV4:
+struct LocEngSetServerIpv4 : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned int mNlAddr;
+ const int mPort;
+ const LocServerType mServerType;
+ inline LocEngSetServerIpv4(LocEngAdapter* adapter,
+ unsigned int ip,
+ int port,
+ LocServerType type) :
+ LocMsg(), mAdapter(adapter),
+ mNlAddr(ip), mPort(port), mServerType(type)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mNlAddr, mPort, mServerType);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s",
+ mNlAddr, mPort, loc_get_server_type_name(mServerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_URL:
+struct LocEngSetServerUrl : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLen;
+ char* mUrl;
+ inline LocEngSetServerUrl(LocEngAdapter* adapter,
+ char* urlString,
+ int url_len) :
+ LocMsg(), mAdapter(adapter),
+ mLen(url_len), mUrl(new char[mLen+1])
+ {
+ memcpy((void*)mUrl, (void*)urlString, url_len);
+ mUrl[mLen] = 0;
+ locallog();
+ }
+ inline ~LocEngSetServerUrl()
+ {
+ delete[] mUrl;
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mUrl, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
+struct LocEngAGlonassProtocol : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned long mAGlonassProtocl;
+ inline LocEngAGlonassProtocol(LocEngAdapter* adapter,
+ unsigned long protocol) :
+ LocMsg(), mAdapter(adapter), mAGlonassProtocl(protocol)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setAGLONASSProtocol(mAGlonassProtocl);
+ }
+ inline void locallog() const {
+ LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SUPL_VERSION:
+struct LocEngSuplVer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSuplVer;
+ inline LocEngSuplVer(LocEngAdapter* adapter,
+ int suplVer) :
+ LocMsg(), mAdapter(adapter), mSuplVer(suplVer)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSUPLVersion(mSuplVer);
+ }
+ inline void locallog() const {
+ LOC_LOGV("SUPL Version: %d", mSuplVer);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LPP_CONFIG:
+struct LocEngLppConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLppConfig;
+ inline LocEngLppConfig(LocEngAdapter* adapter,
+ int lppConfig) :
+ LocMsg(), mAdapter(adapter), mLppConfig(lppConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setLPPConfig(mLppConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG:
+struct LocEngSensorControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSensorsDisabled;
+ inline LocEngSensorControlConfig(LocEngAdapter* adapter,
+ int sensorsDisabled) :
+ LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorControlConfig(mSensorsDisabled);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d",
+ mSensorsDisabled);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PROPERTIES:
+struct LocEngSensorProperties : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const bool mGyroBiasVarianceRandomWalkValid;
+ const float mGyroBiasVarianceRandomWalk;
+ const bool mAccelRandomWalkValid;
+ const float mAccelRandomWalk;
+ const bool mAngleRandomWalkValid;
+ const float mAngleRandomWalk;
+ const bool mRateRandomWalkValid;
+ const float mRateRandomWalk;
+ const bool mVelocityRandomWalkValid;
+ const float mVelocityRandomWalk;
+ inline LocEngSensorProperties(LocEngAdapter* adapter,
+ bool gyroBiasRandomWalk_valid,
+ float gyroBiasRandomWalk,
+ bool accelRandomWalk_valid,
+ float accelRandomWalk,
+ bool angleRandomWalk_valid,
+ float angleRandomWalk,
+ bool rateRandomWalk_valid,
+ float rateRandomWalk,
+ bool velocityRandomWalk_valid,
+ float velocityRandomWalk) :
+ LocMsg(), mAdapter(adapter),
+ mGyroBiasVarianceRandomWalkValid(gyroBiasRandomWalk_valid),
+ mGyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
+ mAccelRandomWalkValid(accelRandomWalk_valid),
+ mAccelRandomWalk(accelRandomWalk),
+ mAngleRandomWalkValid(angleRandomWalk_valid),
+ mAngleRandomWalk(angleRandomWalk),
+ mRateRandomWalkValid(rateRandomWalk_valid),
+ mRateRandomWalk(rateRandomWalk),
+ mVelocityRandomWalkValid(velocityRandomWalk_valid),
+ mVelocityRandomWalk(velocityRandomWalk)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorProperties(mGyroBiasVarianceRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalkValid,
+ mAccelRandomWalk,
+ mAngleRandomWalkValid,
+ mAngleRandomWalk,
+ mRateRandomWalkValid,
+ mRateRandomWalk,
+ mVelocityRandomWalkValid,
+ mVelocityRandomWalk);
+ }
+ inline void locallog() const {
+ LOC_LOGV("Sensor properties validity, Gyro Random walk: %d "
+ "Accel Random Walk: %d "
+ "Angle Random Walk: %d Rate Random Walk: %d "
+ "Velocity Random Walk: %d\n"
+ "Sensor properties, Gyro Random walk: %f "
+ "Accel Random Walk: %f "
+ "Angle Random Walk: %f Rate Random Walk: %f "
+ "Velocity Random Walk: %f",
+ mGyroBiasVarianceRandomWalkValid,
+ mAccelRandomWalkValid,
+ mAngleRandomWalkValid,
+ mRateRandomWalkValid,
+ mVelocityRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalk,
+ mAngleRandomWalk,
+ mRateRandomWalk,
+ mVelocityRandomWalk
+ );
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG:
+struct LocEngSensorPerfControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mControlMode;
+ const int mAccelSamplesPerBatch;
+ const int mAccelBatchesPerSec;
+ const int mGyroSamplesPerBatch;
+ const int mGyroBatchesPerSec;
+ const int mAccelSamplesPerBatchHigh;
+ const int mAccelBatchesPerSecHigh;
+ const int mGyroSamplesPerBatchHigh;
+ const int mGyroBatchesPerSecHigh;
+ const int mAlgorithmConfig;
+ inline LocEngSensorPerfControlConfig(LocEngAdapter* adapter,
+ int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig) :
+ LocMsg(), mAdapter(adapter),
+ mControlMode(controlMode),
+ mAccelSamplesPerBatch(accelSamplesPerBatch),
+ mAccelBatchesPerSec(accelBatchesPerSec),
+ mGyroSamplesPerBatch(gyroSamplesPerBatch),
+ mGyroBatchesPerSec(gyroBatchesPerSec),
+ mAccelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
+ mAccelBatchesPerSecHigh(accelBatchesPerSecHigh),
+ mGyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
+ mGyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
+ mAlgorithmConfig(algorithmConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorPerfControlConfig(mControlMode,
+ mAccelSamplesPerBatch,
+ mAccelBatchesPerSec,
+ mGyroSamplesPerBatch,
+ mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh,
+ mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh,
+ mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("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",
+ mControlMode,
+ mAccelSamplesPerBatch, mAccelBatchesPerSec,
+ mGyroSamplesPerBatch, mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh, mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh, mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_EXT_POWER_CONFIG:
+struct LocEngExtPowerConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mIsBatteryCharging;
+ inline LocEngExtPowerConfig(LocEngAdapter* adapter,
+ int isBatteryCharging) :
+ LocMsg(), mAdapter(adapter),
+ mIsBatteryCharging(isBatteryCharging)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setExtPowerConfig(mIsBatteryCharging);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
+ mIsBatteryCharging);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_POSITION:
+LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology) :
+ LocMsg(), mAdapter(adapter), mLocation(loc),
+ mLocationExtended(locExtended),
+ mLocationExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->location_ext_parser(locExt)),
+ mStatus(st), mTechMask(technology)
+{
+ locallog();
+}
+void LocEngReportPosition::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
+ bool reported = false;
+ if (locEng->location_cb != NULL) {
+ if (LOC_SESS_FAILURE == mStatus) {
+ // in case we want to handle the failure case
+ locEng->location_cb(NULL, NULL);
+ reported = true;
+ }
+ // what's in the else if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ else if ((LOC_SESS_SUCCESS == mStatus &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS) &
+ mTechMask)) ||
+ (LOC_SESS_INTERMEDIATE == locEng->intermediateFix &&
+ !((mLocation.gpsLocation.flags &
+ GPS_LOCATION_HAS_ACCURACY) &&
+ (gps_conf.ACCURACY_THRES != 0) &&
+ (mLocation.gpsLocation.accuracy >
+ gps_conf.ACCURACY_THRES)))) {
+ locEng->location_cb((UlpLocation*)&(mLocation),
+ (void*)mLocationExt);
+ reported = true;
+ }
+ }
+
+ // if we have reported this fix
+ if (reported &&
+ // and if this is a singleshot
+ GPS_POSITION_RECURRENCE_SINGLE ==
+ locEng->adapter->getPositionMode().recurrence) {
+ if (LOC_SESS_INTERMEDIATE == mStatus) {
+ // modem could be still working for a final fix,
+ // although we no longer need it. So stopFix().
+ locEng->adapter->stopFix();
+ }
+ // turn off the session flag.
+ locEng->adapter->setInSession(false);
+ }
+
+ if (locEng->generateNmea &&
+ mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS)
+ {
+ unsigned char generate_nmea = reported &&
+ (mStatus != LOC_SESS_FAILURE);
+ loc_eng_nmea_generate_pos(locEng, mLocation, mLocationExtended,
+ generate_nmea);
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(mLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+ }
+}
+void LocEngReportPosition::locallog() const {
+ LOC_LOGV("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: %lld\n rawDataSize: %d\n rawData: %p\n Session"
+ " status: %d\n Technology mask: %u",
+ mLocation.gpsLocation.flags, mLocation.position_source,
+ mLocation.gpsLocation.latitude, mLocation.gpsLocation.longitude,
+ mLocation.gpsLocation.altitude, mLocation.gpsLocation.speed,
+ mLocation.gpsLocation.bearing, mLocation.gpsLocation.accuracy,
+ mLocation.gpsLocation.timestamp, mLocation.rawDataSize,
+ mLocation.rawData, mStatus, mTechMask);
+}
+void LocEngReportPosition::log() const {
+ locallog();
+}
+void LocEngReportPosition::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+// case LOC_ENG_MSG_REPORT_SV:
+LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExt) :
+ LocMsg(), mAdapter(adapter), mSvStatus(sv),
+ mLocationExtended(locExtended),
+ mSvExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->sv_ext_parser(svExt))
+{
+ locallog();
+}
+void LocEngReportSv::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->sv_status_cb != NULL) {
+ locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
+ (void*)mSvExt);
+ }
+
+ if (locEng->generateNmea)
+ {
+ loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
+ }
+ }
+}
+void LocEngReportSv::locallog() const {
+ LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n "
+ "used in fix mask: %x\n sv: prn snr "
+ "elevation azimuth",
+ mSvStatus.num_svs, mSvStatus.ephemeris_mask,
+ mSvStatus.almanac_mask, mSvStatus.used_in_fix_mask);
+ for (int i = 0; i < mSvStatus.num_svs && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" %d: %d %f %f %f\n ",
+ i,
+ mSvStatus.sv_list[i].prn,
+ mSvStatus.sv_list[i].snr,
+ mSvStatus.sv_list[i].elevation,
+ mSvStatus.sv_list[i].azimuth);
+ }
+}
+inline void LocEngReportSv::log() const {
+ locallog();
+}
+void LocEngReportSv::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REPORT_STATUS:
+LocEngReportStatus::LocEngReportStatus(void* locEng,
+ GpsStatusValue engineStatus) :
+ LocMsg(), mLocEng(locEng), mStatus(engineStatus)
+{
+ locallog();
+}
+inline void LocEngReportStatus::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ loc_eng_report_status(*locEng, mStatus);
+ update_aiding_data_for_deletion(*locEng);
+}
+inline void LocEngReportStatus::locallog() const {
+ LOC_LOGV("LocEngReportStatus");
+}
+inline void LocEngReportStatus::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_NMEA:
+LocEngReportNmea::LocEngReportNmea(void* locEng,
+ const char* data, int len) :
+ LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
+{
+ memcpy((void*)mNmea, (void*)data, len);
+ locallog();
+}
+void LocEngReportNmea::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ locEng->nmea_cb(now, mNmea, mLen);
+}
+inline void LocEngReportNmea::locallog() const {
+ LOC_LOGV("LocEngReportNmea");
+}
+inline void LocEngReportNmea::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_XTRA_SERVER:
+LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
+ const char *url1,
+ const char *url2,
+ const char *url3,
+ const int maxlength) :
+ LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
+ mServers(new char[3*(mMaxLen+1)])
+{
+ strlcpy(mServers, url1, mMaxLen);
+ strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen);
+ strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen);
+ locallog();
+}
+void LocEngReportXtraServer::proc() const {
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->report_xtra_server_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("report_xtra_server_cb", %s, mServers);
+ locEngXtra->report_xtra_server_cb(mServers,
+ &(mServers[mMaxLen+1]),
+ &(mServers[(mMaxLen+1)<<1]));
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngReportXtraServer::locallog() const {
+ LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n"
+ " server3: %s\n",
+ mServers, &mServers[mMaxLen], &mServers[mMaxLen<<1]);
+}
+inline void LocEngReportXtraServer::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_BIT:
+// case LOC_ENG_MSG_RELEASE_BIT:
+LocEngReqRelBIT::LocEngReqRelBIT(void* locEng, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mIPv4Addr(ipv4),
+ mIPv6Addr(ipv6 ? new char[16] : NULL), mIsReq(isReq) {
+ if (NULL != ipv6)
+ memcpy(mIPv6Addr, ipv6, 16);
+ locallog();
+}
+inline LocEngReqRelBIT::~LocEngReqRelBIT() {
+ if (mIPv6Addr) {
+ delete[] mIPv6Addr;
+ }
+}
+void LocEngReqRelBIT::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ BITSubscriber s(getAgpsStateMachine(*locEng, mType),
+ mIPv4Addr, mIPv6Addr);
+ AgpsStateMachine* sm = (AgpsStateMachine*)s.mStateMachine;
+
+ if (mIsReq) {
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ sm->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelBIT::locallog() const {
+ LOC_LOGV("LocEngRequestBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mIPv4Addr>>24),
+ (unsigned char)(mIPv4Addr>>16),
+ (unsigned char)(mIPv4Addr>>8),
+ (unsigned char)mIPv4Addr,
+ NULL != mIPv6Addr ? mIPv6Addr : "");
+}
+inline void LocEngReqRelBIT::log() const {
+ locallog();
+}
+void LocEngReqRelBIT::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_RELEASE_BIT:
+struct LocEngReleaseBIT : public LocMsg {
+ const BITSubscriber mSubscriber;
+ inline LocEngReleaseBIT(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ LocMsg(),
+ mSubscriber(stateMachine, ipv4, ipv6)
+ {
+ locallog();
+ }
+ inline virtual void proc() const
+ {
+ AgpsStateMachine* sm = (AgpsStateMachine*)mSubscriber.mStateMachine;
+ sm->unsubscribeRsrc((Subscriber*)&mSubscriber);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngReleaseBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mSubscriber.ID>>24),
+ (unsigned char)(mSubscriber.ID>>16),
+ (unsigned char)(mSubscriber.ID>>8),
+ (unsigned char)mSubscriber.ID,
+ NULL != mSubscriber.mIPv6Addr ? mSubscriber.mIPv6Addr : "");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// LocEngSuplEsOpened
+LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsOpened::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_GRANTED);
+}
+void LocEngSuplEsOpened::locallog() const {
+ LOC_LOGV("LocEngSuplEsOpened");
+}
+void LocEngSuplEsOpened::log() const {
+ locallog();
+}
+
+// LocEngSuplEsClosed
+LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsClosed::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_RELEASED);
+}
+void LocEngSuplEsClosed::locallog() const {
+ LOC_LOGV("LocEngSuplEsClosed");
+}
+void LocEngSuplEsClosed::log() const {
+ locallog();
+}
+
+
+// case LOC_ENG_MSG_REQUEST_SUPL_ES:
+LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngRequestSuplEs::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = locEng->ds_nif;
+ DSSubscriber s(sm, mID);
+ sm->subscribeRsrc((Subscriber*)&s);
+}
+inline void LocEngRequestSuplEs::locallog() const {
+ LOC_LOGV("LocEngRequestSuplEs");
+}
+inline void LocEngRequestSuplEs::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_ATL:
+LocEngRequestATL::LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type) :
+ LocMsg(), mLocEng(locEng), mID(id), mType(agps_type) {
+ locallog();
+}
+void LocEngRequestATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = (AgpsStateMachine*)
+ getAgpsStateMachine(*locEng, mType);
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ AGPS_TYPE_INVALID == mType);
+ sm->subscribeRsrc((Subscriber*)&s);
+}
+inline void LocEngRequestATL::locallog() const {
+ LOC_LOGV("LocEngRequestATL");
+}
+inline void LocEngRequestATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_RELEASE_ATL:
+LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngReleaseATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false);
+ if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif",
+ __func__, __LINE__);
+ } else {
+ ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false);
+ if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from internet_nif",
+ __func__, __LINE__);
+ } else {
+ DSSubscriber s3(locEng->ds_nif, mID);
+ if(locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from ds_nif",
+ __func__, __LINE__);
+ } else {
+ LOC_LOGW("%s:%d]: Could not release ATL. "
+ "No subscribers found\n",
+ __func__, __LINE__);
+ locEng->adapter->atlCloseStatus(mID, 0);
+ }
+ }
+ }
+}
+inline void LocEngReleaseATL::locallog() const {
+ LOC_LOGV("LocEngReleaseATL");
+}
+inline void LocEngReleaseATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_WIFI:
+// case LOC_ENG_MSG_RELEASE_WIFI:
+LocEngReqRelWifi::LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mSenderId(sender_id),
+ mSSID(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == p ? NULL : new char[SSID_BUF_SIZE]),
+ mIsReq(isReq) {
+ if (NULL != s)
+ strlcpy(mSSID, s, SSID_BUF_SIZE);
+ if (NULL != p)
+ strlcpy(mPassword, p, SSID_BUF_SIZE);
+ locallog();
+}
+LocEngReqRelWifi::~LocEngReqRelWifi() {
+ if (NULL != mSSID) {
+ delete[] mSSID;
+ }
+ if (NULL != mPassword) {
+ delete[] mPassword;
+ }
+}
+void LocEngReqRelWifi::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
+ if (mIsReq) {
+ locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelWifi::locallog() const {
+ LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
+ mIsReq ? "LocEngRequestWifi" : "LocEngReleaseWifi",
+ mSenderId,
+ NULL != mSSID ? mSSID : "",
+ NULL != mPassword ? mPassword : "");
+}
+inline void LocEngReqRelWifi::log() const {
+ locallog();
+}
+void LocEngReqRelWifi::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REQUEST_XTRA_DATA:
+LocEngRequestXtra::LocEngRequestXtra(void* locEng) :
+ mLocEng(locEng) {
+ locallog();
+}
+void LocEngRequestXtra::proc() const
+{
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->download_request_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("download_request_cb", %p, mLocEng);
+ locEngXtra->download_request_cb();
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngRequestXtra::locallog() const {
+ LOC_LOGV("LocEngReqXtra");
+}
+inline void LocEngRequestXtra::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_TIME:
+LocEngRequestTime::LocEngRequestTime(void* locEng) :
+ LocMsg(), mLocEng(locEng)
+{
+ locallog();
+}
+void LocEngRequestTime::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->request_utc_time_cb != NULL) {
+ locEng->request_utc_time_cb();
+ } else {
+ LOC_LOGE("Callback function for request time is NULL");
+ }
+}
+inline void LocEngRequestTime::locallog() const {
+ LOC_LOGV("LocEngReqTime");
+}
+inline void LocEngRequestTime::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_DELETE_AIDING_DATA:
+struct LocEngDelAidData : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ const GpsAidingData mType;
+ inline LocEngDelAidData(loc_eng_data_s_type* locEng,
+ GpsAidingData f) :
+ LocMsg(), mLocEng(locEng), mType(f)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocEng->aiding_data_for_deletion = mType;
+ update_aiding_data_for_deletion(*mLocEng);
+ }
+ inline void locallog() const {
+ LOC_LOGV("aiding data msak %d", mType);
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENABLE_DATA:
+struct LocEngEnableData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mEnable;
+ char* mAPN;
+ const int mLen;
+ inline LocEngEnableData(LocEngAdapter* adapter,
+ const char* name, int len, int enable) :
+ LocMsg(), mAdapter(adapter),
+ mEnable(enable), mAPN(NULL), mLen(len)
+ {
+ if (NULL != name) {
+ mAPN = new char[len+1];
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ }
+ locallog();
+ }
+ inline ~LocEngEnableData() {
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter->enableData(mEnable);
+ if (NULL != mAPN) {
+ mAdapter->setAPN(mAPN, mLen);
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("apn: %s\n enable: %d",
+ (NULL == mAPN) ? "NULL" : mAPN, mEnable);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_INJECT_XTRA_DATA:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_LOC_INIT:
+struct LocEngInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_reinit(*mLocEng);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInit");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REQUEST_XTRA_SERVER:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
+struct LocEngAtlOpenSuccess : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ const int mLen;
+ char* mAPN;
+ const AGpsBearerType mBearerType;
+ inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
+ const char* name,
+ int len,
+ AGpsBearerType btype) :
+ LocMsg(),
+ mStateMachine(statemachine), mLen(len),
+ mAPN(new char[len+1]), mBearerType(btype)
+ {
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ locallog();
+ }
+ inline ~LocEngAtlOpenSuccess()
+ {
+ delete[] mAPN;
+ }
+ inline virtual void proc() const {
+ mStateMachine->setBearer(mBearerType);
+ mStateMachine->setAPN(mAPN, mLen);
+ mStateMachine->onRsrcEvent(RSRC_GRANTED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed agps type: %s\n apn: %s\n"
+ " bearer type: %s",
+ loc_get_agps_type_name(mStateMachine->getType()),
+ mAPN,
+ loc_get_agps_bear_name(mBearerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_CLOSED:
+struct LocEngAtlClosed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_RELEASED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_OPEN_FAILED:
+struct LocEngAtlOpenFailed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_DENIED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenFailed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENGINE_DOWN:
+LocEngDown::LocEngDown(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngDown::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_down(*locEng);
+}
+inline void LocEngDown::locallog() const {
+ LOC_LOGV("LocEngDown");
+}
+inline void LocEngDown::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_ENGINE_UP:
+LocEngUp::LocEngUp(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngUp::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_up(*locEng);
+}
+inline void LocEngUp::locallog() const {
+ LOC_LOGV("LocEngUp");
+}
+inline void LocEngUp::log() const {
+ locallog();
+}
+
+/*********************************************************************
+ * Initialization checking macros
+ *********************************************************************/
+#define STATE_CHECK(ctx, x, ret) \
+ if (!(ctx)) \
+ { \
+ /* Not intialized, abort */\
+ LOC_LOGE("%s: log_eng state error: %s", __func__, x); \
+ EXIT_LOG(%s, x); \
+ ret; \
+ }
+#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event)
+
+{
+ int ret_val = 0;
+
+ ENTRY_LOG_CALLFLOW();
+ if (NULL == callbacks || 0 == event) {
+ LOC_LOGE("loc_eng_init: bad parameters cb %p eMask %d", callbacks, event);
+ ret_val = -1;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+ }
+
+ STATE_CHECK((NULL == loc_eng_data.adapter),
+ "instance already initialized", return 0);
+
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data));
+
+ if (NULL != callbacks->set_capabilities_cb) {
+ callbacks->set_capabilities_cb(gps_conf.CAPABILITIES);
+ }
+
+ // Save callbacks
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+ loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+ loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
+ callbacks->location_ext_parser : noProc;
+ loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
+ callbacks->sv_ext_parser : noProc;
+ loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
+
+ // initial states taken care of by the memset above
+ // loc_eng_data.engine_status -- GPS_STATUS_NONE;
+ // loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
+ // loc_eng_data.mute_session_state -- LOC_MUTE_SESS_NONE;
+
+ if ((event & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) && (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_AP))
+ {
+ event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
+ loc_eng_data.generateNmea = true;
+ }
+ else
+ {
+ loc_eng_data.generateNmea = false;
+ }
+
+ //Disable AGPS if capabilities are not present
+ if(!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
+ !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) {
+ event &= ~(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST);
+ }
+
+ loc_eng_data.adapter =
+ new LocEngAdapter(event, &loc_eng_data,
+ (MsgTask::tCreate)callbacks->create_thread_cb);
+
+ LOC_LOGD("loc_eng_init created client, id = %p\n",
+ loc_eng_data.adapter);
+
+ loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS == ret_val) {
+ LOC_LOGD("loc_eng_reinit reinit() successful");
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE));
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+
+ /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
+ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID )
+ {
+ adapter->sendMsg(new LocEngSensorProperties(adapter,
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sap_conf.GYRO_BIAS_RANDOM_WALK,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY));
+ }
+
+ adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter,
+ sap_conf.SENSOR_CONTROL_MODE,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK));
+
+ adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0)));
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // XTRA has no state, so we are fine with it.
+
+ // we need to check and clear NI
+#if 0
+ // we need to check and clear ATL
+ if (NULL != loc_eng_data.agnss_nif) {
+ delete loc_eng_data.agnss_nif;
+ loc_eng_data.agnss_nif = NULL;
+ }
+ if (NULL != loc_eng_data.internet_nif) {
+ delete loc_eng_data.internet_nif;
+ loc_eng_data.internet_nif = NULL;
+ }
+#endif
+ if (loc_eng_data.adapter->isInSession())
+ {
+ LOC_LOGD("loc_eng_cleanup: fix not stopped. stop it now.");
+ loc_eng_stop(loc_eng_data);
+ }
+
+#if 0 // can't afford to actually clean up, for many reason.
+
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ delete loc_eng_data.adapter;
+ loc_eng_data.adapter = NULL;
+
+ loc_eng_dmn_conn_loc_api_server_unblock();
+ loc_eng_dmn_conn_loc_api_server_join();
+
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (!loc_eng_data.adapter->isInSession()) {
+ ret_val = loc_eng_data.adapter->startFix();
+
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS ||
+ ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN)
+ {
+ loc_eng_data.adapter->setInSession(TRUE);
+ loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_BEGIN);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_stop_wrapper
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (loc_eng_data.adapter->isInSession()) {
+
+ ret_val = loc_eng_data.adapter->stopFix();
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS)
+ {
+ loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END);
+ }
+
+ loc_eng_data.adapter->setInSession(FALSE);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
+
+DESCRIPTION
+ Mutes one session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: Success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
+ {
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngPositionMode(adapter, params));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
+ int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ if (adapter->mAgpsEnabled) {
+ adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
+ uncertainty));
+ }
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
+ double longitude, float accuracy)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
+ accuracy));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData f)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+
+ if (loc_eng_data.status_cb)
+ {
+ GpsStatus gs = { sizeof(gs),status };
+ CALLBACK_LOG_CALLFLOW("status_cb", %s,
+ loc_get_gps_status_name(gs.status));
+ loc_eng_data.status_cb(&gs);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*
+ Callback function passed to Data Services State Machine
+ This becomes part of the state machine's servicer and
+ is used to send requests to the data services client
+*/
+static int dataCallCb(void *cb_data)
+{
+ LOC_LOGD("Enter dataCallCb\n");
+ int ret=0;
+ if(cb_data != NULL) {
+ dsCbData *cbData = (dsCbData *)cb_data;
+ LocEngAdapter *locAdapter = (LocEngAdapter *)cbData->mAdapter;
+ if(cbData->action == GPS_REQUEST_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_REQUEST_AGPS_DATA_CONN\n");
+ ret = locAdapter->openAndStartDataCall();
+ }
+ else if(cbData->action == GPS_RELEASE_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_RELEASE_AGPS_DATA_CONN\n");
+ locAdapter->stopDataCall();
+ }
+ }
+ else {
+ LOC_LOGE("NULL argument received. Failing.\n");
+ ret = -1;
+ goto err;
+ }
+
+err:
+ LOC_LOGD("Exit dataCallCb ret = %d\n", ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_reinit
+
+DESCRIPTION
+ 2nd half of loc_eng_agps_init(), singled out for modem restart to use.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+
+ // Set server addresses which came before init
+ if (loc_eng_data.supl_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_SUPL_SERVER,
+ loc_eng_data.supl_host_buf,
+ loc_eng_data.supl_port_buf);
+ }
+
+ if (loc_eng_data.c2k_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_CDMA_PDE_SERVER,
+ loc_eng_data.c2k_host_buf,
+ loc_eng_data.c2k_port_buf);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+ STATE_CHECK((NULL == loc_eng_data.agps_status_cb),
+ "agps instance already initialized",
+ return);
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks);
+ EXIT_LOG(%s, VOID_RET);
+ return;
+ }
+
+ //Proceed to create AGPS framework only if MSA or MSB capabilities
+ //are present. If the target is an APQ, these masks are
+ //cleared in get_gps_interface()
+ if(!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
+ !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) ) {
+ LOC_LOGD("%s:%d]: No AGPS capabilities found. Returning\n",
+ __func__, __LINE__);
+ return;
+ }
+
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_SUPL,
+ false);
+ loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WWAN_ANY,
+ false);
+ loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WIFI,
+ true);
+ if(!loc_eng_data.adapter->initDataServiceClient()) {
+ LOC_LOGD("%s:%d]: Creating new ds state machine\n", __func__, __LINE__);
+ loc_eng_data.ds_nif = new DSStateMachine(servicerTypeExt,
+ (void *)dataCallCb,
+ loc_eng_data.adapter);
+ LOC_LOGD("%s:%d]: Created new ds state machine\n", __func__, __LINE__);
+ }
+
+ //loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
+ // NULL, NULL, &loc_eng_data);
+
+ loc_eng_agps_reinit(loc_eng_data);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void deleteAidingData(loc_eng_data_s_type &logEng) {
+ if (logEng.engine_status != GPS_STATUS_ENGINE_ON &&
+ logEng.aiding_data_for_deletion != 0) {
+ logEng.adapter->deleteAidingData(logEng.aiding_data_for_deletion);
+ logEng.aiding_data_for_deletion = 0;
+ }
+}
+
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
+ AgpsStateMachine* stateMachine;
+ switch (agpsType) {
+ case AGPS_TYPE_WIFI: {
+ stateMachine = locEng.wifi_nif;
+ break;
+ }
+ case AGPS_TYPE_INVALID:
+ case AGPS_TYPE_SUPL: {
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ case AGPS_TYPE_SUPL_ES: {
+ stateMachine = locEng.ds_nif;
+ break;
+ }
+ default:
+ stateMachine = locEng.internet_nif;
+ }
+ return stateMachine;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ if (apn == NULL)
+ {
+ LOC_LOGE("APN Name NULL\n");
+ return 0;
+ }
+
+ LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
+
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+
+ loc_eng_data.adapter->sendMsg(
+ new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform engine about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION resolve_in_addr
+
+DESCRIPTION
+ Translates a hostname to in_addr struct
+
+DEPENDENCIES
+ n/a
+
+RETURN VALUE
+ TRUE if successful
+
+SIDE EFFECTS
+ n/a
+
+===========================================================================*/
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
+{
+ ENTRY_LOG();
+ boolean ret_val = TRUE;
+
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ ret_val = FALSE;
+ }
+ }
+
+ EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server
+
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ int ret = 0;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ char url[MAX_URL_LEN];
+ unsigned int len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port);
+
+ if (sizeof(url) > len) {
+ adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len));
+ }
+ } else if (LOC_AGPS_CDMA_PDE_SERVER == type ||
+ LOC_AGPS_CUSTOM_PDE_SERVER == type ||
+ LOC_AGPS_MPC_SERVER == type) {
+ struct in_addr addr;
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ ret = -2;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ adapter->sendMsg(new LocEngSetServerIpv4(adapter, ip, port, type));
+ }
+ } else {
+ LOC_LOGE("loc_eng_set_server, type %d cannot be resolved.\n", type);
+ }
+
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server_proxy
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type,
+ const char* hostname, int port)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = 0;
+
+ if (NULL != loc_eng_data.adapter)
+ {
+ ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port);
+ } else {
+ LOC_LOGW("set_server called before init. save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case LOC_AGPS_SUPL_SERVER:
+ strlcpy(loc_eng_data.supl_host_buf, hostname,
+ sizeof(loc_eng_data.supl_host_buf));
+ loc_eng_data.supl_port_buf = port;
+ loc_eng_data.supl_host_set = 1;
+ break;
+ case LOC_AGPS_CDMA_PDE_SERVER:
+ strlcpy(loc_eng_data.c2k_host_buf, hostname,
+ sizeof(loc_eng_data.c2k_host_buf));
+ loc_eng_data.c2k_port_buf = port;
+ loc_eng_data.c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int available, const char* apn)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ //This is to store the status of data availability over the network.
+ //If GPS is not enabled, the INIT_CHECK will fail and the modem will
+ //not be updated with the network's availability. Since the data status
+ //can change before GPS is enabled the, storing the status will enable
+ //us to inform the modem after GPS is enabled
+ agpsStatus = available;
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+ if (apn != NULL)
+ {
+ LOC_LOGD("loc_eng_agps_ril_update_network_availability: APN Name = [%s]\n", apn);
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngEnableData(adapter, apn, apn_len, available));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+ // Switch from WAIT to MUTE, for "engine on" or "session begin" event
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+
+ // Switch off MUTE session
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION &&
+ (status == GPS_STATUS_SESSION_END || status == GPS_STATUS_ENGINE_OFF))
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+
+ // Session End is not reported during Android navigating state
+ boolean navigating = loc_eng_data.adapter->isInSession();
+ if (status != GPS_STATUS_NONE &&
+ !(status == GPS_STATUS_SESSION_END && navigating) &&
+ !(status == GPS_STATUS_SESSION_BEGIN && !navigating))
+ {
+ if (loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ // Inform GpsLocationProvider about mNavigating status
+ loc_inform_gps_status(loc_eng_data, status);
+ }
+ else {
+ LOC_LOGD("loc_eng_report_status: muting the status report.");
+ }
+ }
+
+ // Only keeps ENGINE ON/OFF in engine_status
+ if (status == GPS_STATUS_ENGINE_ON || status == GPS_STATUS_ENGINE_OFF)
+ {
+ loc_eng_data.engine_status = status;
+ }
+
+ // Only keeps SESSION BEGIN/END in fix_session_status
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = status;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_engine_down
+ loc_eng_handle_engine_up
+
+DESCRIPTION
+ Calls this function when it is detected that modem restart is happening.
+ Either we detected the modem is down or received modem up event.
+ This must be called from the deferred thread to avoid race condition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_reset_on_engine_restart(loc_eng_data);
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_OFF);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_reinit(loc_eng_data);
+
+ if (loc_eng_data.agps_status_cb != NULL) {
+ loc_eng_data.agnss_nif->dropAllSubscribers();
+ loc_eng_data.internet_nif->dropAllSubscribers();
+
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_ON);
+
+ // modem is back up. If we crashed in the middle of navigating, we restart.
+ if (loc_eng_data.adapter->isInSession()) {
+ // This sets the copy in adapter to modem
+ loc_eng_data.adapter->setPositionMode(NULL);
+ loc_eng_data.adapter->setInSession(false);
+ loc_eng_start_handler(loc_eng_data);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+#ifdef USE_GLIB
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+#endif /* USE_GLIB */
+
+/*===========================================================================
+FUNCTION loc_eng_read_config
+
+DESCRIPTION
+ Initiates the reading of the gps config file stored in /etc dir
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_read_config(void)
+{
+ ENTRY_LOG_CALLFLOW();
+ if(configAlreadyRead == false)
+ {
+ // Initialize our defaults before reading of configuration file overwrites them.
+ loc_default_parameters();
+ // We only want to parse the conf file once. This is a good place to ensure that.
+ // In fact one day the conf file should go into context.
+ UTIL_READ_CONF(GPS_CONF_FILE, loc_parameter_table);
+ UTIL_READ_CONF(SAP_CONF_FILE, loc_parameter_table);
+ configAlreadyRead = true;
+ } else {
+ LOC_LOGV("GPS Config file has already been read\n");
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng.h b/msm8960/loc_api/libloc_api_50001/loc_eng.h
new file mode 100644
index 0000000..6f9fd09
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng.h
@@ -0,0 +1,246 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_H
+#define LOC_ENG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+#define MAX_NUM_ATL_CONNECTIONS 2
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc.h>
+#include <loc_eng_xtra.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_agps.h>
+#include <loc_cfg.h>
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_eng_agps.h>
+#include <LocEngAdapter.h>
+
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+#define SUCCESS TRUE
+#define FAILURE FALSE
+#define INVALID_ATL_CONNECTION_HANDLE -1
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+enum loc_nmea_provider_e_type {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+};
+
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE = 0,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
+// Module data
+typedef struct loc_eng_data_s
+{
+ LocEngAdapter *adapter;
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ agps_status_extended agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_request_utc_time request_utc_time_cb;
+ boolean intermediateFix;
+ AGpsStatusValue agps_status;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ loc_eng_ni_data_s_type loc_eng_ni_data;
+
+ // AGPS state machines
+ AgpsStateMachine* agnss_nif;
+ AgpsStateMachine* internet_nif;
+ AgpsStateMachine* wifi_nif;
+ //State machine for Data Services
+ AgpsStateMachine* ds_nif;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // For muting session broadcast
+ loc_mute_session_e_type mute_session_state;
+
+ // For nmea generation
+ boolean generateNmea;
+ uint32_t sv_used_mask;
+ float hdop;
+ float pdop;
+ float vdop;
+
+ // Address buffers, for addressing setting before init
+ int supl_host_set;
+ char supl_host_buf[101];
+ int supl_port_buf;
+ int c2k_host_set;
+ char c2k_host_buf[101];
+ int c2k_port_buf;
+ int mpc_host_set;
+ char mpc_host_buf[101];
+ int mpc_port_buf;
+
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+} loc_eng_data_s_type;
+
+/* GPS.conf support */
+typedef struct loc_gps_cfg_s
+{
+ unsigned long INTERMEDIATE_POS;
+ unsigned long ACCURACY_THRES;
+ unsigned long ENABLE_WIPER;
+ unsigned long SUPL_VER;
+ unsigned long CAPABILITIES;
+ unsigned long QUIPC_ENABLED;
+ unsigned long LPP_PROFILE;
+ uint8_t NMEA_PROVIDER;
+ unsigned long A_GLONASS_POS_PROTOCOL_SELECT;
+ char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+} loc_gps_cfg_s_type;
+
+typedef struct
+{
+ uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
+ double GYRO_BIAS_RANDOM_WALK;
+ unsigned long SENSOR_ACCEL_BATCHES_PER_SEC;
+ unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH;
+ unsigned long SENSOR_GYRO_BATCHES_PER_SEC;
+ unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH;
+ unsigned long SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
+ unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
+ unsigned long SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
+ unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
+ unsigned long SENSOR_CONTROL_MODE;
+ unsigned long SENSOR_USAGE;
+ unsigned long 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;
+
+extern loc_gps_cfg_s_type gps_conf;
+extern loc_sap_cfg_s_type sap_conf;
+
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
+ LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event);
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data,
+ GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
+ double latitude, double longitude,
+ float accuracy);
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
+ GpsAidingData f);
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms);
+const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
+ const char* name);
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
+ AGpsExtCallbacks* callbacks);
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType);
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+
+
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int avaiable, const char* apn);
+
+
+bool loc_eng_inject_raw_command(loc_eng_data_s_type &loc_eng_data,
+ char* command, int length);
+
+
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data);
+
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks);
+
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length);
+
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data);
+
+extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data,
+ GpsNiExtCallbacks *callbacks);
+extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response);
+extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough);
+extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_read_config(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // LOC_ENG_H
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_agps.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_agps.cpp
new file mode 100644
index 0000000..d6cc136
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -0,0 +1,970 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng_agps.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <platform_lib_includes.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_dmn_conn.h>
+#include <sys/time.h>
+
+//======================================================================
+// C callbacks
+//======================================================================
+
+// This is given to linked_list_add as the dealloc callback
+// data -- an instance of Subscriber
+static void deleteObj(void* data)
+{
+ delete (Subscriber*)data;
+}
+
+// This is given to linked_list_search() as the comparison callback
+// when the state manchine needs to process for particular subscriber
+// fromCaller -- caller provides this obj
+// fromList -- linked_list_search() function take this one from list
+static bool hasSubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ return s1->forMe(*notification);
+}
+
+// This is gvien to linked_list_search() to notify subscriber objs
+// when the state machine needs to inform all subscribers of resource
+// status changes, e.g. when resource is GRANTED.
+// fromCaller -- caller provides this ptr to a Notification obj.
+// fromList -- linked_list_search() function take this one from list
+static bool notifySubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ // we notify every subscriber indiscriminatively
+ // each subscriber decides if this notification is interesting.
+ return s1->notifyRsrcStatus(*notification) &&
+ // if we do not want to delete the subscriber from the
+ // the list, we must set this to false so this function
+ // returns false
+ notification->postNotifyDelete;
+}
+
+//======================================================================
+// Notification
+//======================================================================
+const int Notification::BROADCAST_ALL = 0x80000000;
+const int Notification::BROADCAST_ACTIVE = 0x80000001;
+const int Notification::BROADCAST_INACTIVE = 0x80000002;
+const unsigned char DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const unsigned int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+//======================================================================
+// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
+//======================================================================
+bool Subscriber::forMe(Notification ¬ification)
+{
+ if (NULL != notification.rcver) {
+ return equals(notification.rcver);
+ } else {
+ return Notification::BROADCAST_ALL == notification.groupID ||
+ (Notification::BROADCAST_ACTIVE == notification.groupID &&
+ !isInactive()) ||
+ (Notification::BROADCAST_INACTIVE == notification.groupID &&
+ isInactive());
+ }
+}
+bool BITSubscriber::equals(const Subscriber *s) const
+{
+ BITSubscriber* bitS = (BITSubscriber*)s;
+
+ return (ID == bitS->ID &&
+ (INADDR_NONE != (unsigned int)ID ||
+ 0 == strncmp(mIPv6Addr, bitS->mIPv6Addr, sizeof(mIPv6Addr))));
+}
+
+bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ ((LocEngAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_DENIED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ case RSRC_GRANTED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ break;
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+bool DSSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+ LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
+ if(notify) {
+ switch(notification.rsrcStatus) {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ case RSRC_GRANTED:
+ ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
+ break;
+ default:
+ notify = false;
+ }
+ }
+ return notify;
+}
+void DSSubscriber :: setInactive()
+{
+ mIsInactive = true;
+ ((DSStateMachine *)mStateMachine)->informStatus(RSRC_UNSUBSCRIBE, ID);
+}
+//======================================================================
+// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
+//======================================================================
+
+// AgpsReleasedState
+class AgpsReleasedState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasedState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasedState = this; }
+
+ inline ~AgpsReleasedState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasedState";}
+};
+
+AgpsState* AgpsReleasedState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ LOC_LOGD("AgpsReleasedState::onRsrcEvent; event:%d\n", (int)event);
+ if (mStateMachine->hasSubscribers()) {
+ LOC_LOGE("Error: %s subscriber list not empty!!!", whoami());
+ // I don't know how to recover from it. I am adding this rather
+ // for debugging purpose.
+ }
+
+ AgpsState* nextState = this;
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // no notification until we get RSRC_GRANTED
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // request from connecivity service for NIF
+ //The if condition is added so that if the data call setup fails
+ //for DS State Machine, we want to retry in released state.
+ //for AGps State Machine, sendRsrcRequest() will always return success
+ if(!mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN)) {
+ // move the state to PENDING
+ nextState = mPendingState;
+ }
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ // the list should really be empty, nothing to remove.
+ // but we might as well just tell the client it is
+ // unsubscribed. False tolerance, right?
+ Subscriber* subscriber = (Subscriber*) data;
+ Notification notification(subscriber, event, false);
+ subscriber->notifyRsrcStatus(notification);
+ }
+ // break;
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ default:
+ LOC_LOGW("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ break;
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsPendingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsPendingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mPendingState = this; }
+
+ inline ~AgpsPendingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsPendingState";}
+};
+
+AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsPendingState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_ACTIVE, event, false);
+ // notify all subscribers NIF resource GRANTED
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_RELEASED:
+ // no state change.
+ // we are expecting either GRANTED or DENIED. Handling RELEASED
+ // may like break our state machine in race conditions.
+ break;
+
+ case RSRC_DENIED:
+ {
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // notify all subscribers NIF resource RELEASED or DENIED
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+
+class AgpsAcquiredState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsAcquiredState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mAcquiredState = this; }
+
+ inline ~AgpsAcquiredState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() { return (char*)"AgpsAcquiredState"; }
+};
+
+
+AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;
+ LOC_LOGD("AgpsAcquiredState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // we already have the NIF resource, simply notify subscriber
+ Subscriber* subscriber = (Subscriber*) data;
+ // we have rsrc in hand, so grant it right away
+ Notification notification(subscriber, RSRC_GRANTED, false);
+ subscriber->notifyRsrcStatus(notification);
+ // add subscriber to the list
+ mStateMachine->addSubscriber(subscriber);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ LOC_LOGW("%s: %d, RSRC_GRANTED already received", whoami(), event);
+ // no state change.
+ break;
+
+ case RSRC_RELEASED:
+ {
+ LOC_LOGW("%s: %d, a force rsrc release", whoami(), event);
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_DENIED:
+ // no state change.
+ // we are expecting RELEASED. Handling DENIED
+ // may like break our state machine in race conditions.
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsReleasingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasingState = this; }
+
+ inline ~AgpsReleasingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasingState";}
+};
+
+AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsReleasingState::onRsrcEvent; event:%d\n", (int)event);
+
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_DENIED:
+ // A race condition subscriber unsubscribes before AFW denies resource.
+ case RSRC_RELEASED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_INACTIVE, event, true);
+ // notify all subscribers that are active NIF resource RELEASE
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+
+ if (mStateMachine->hasActiveSubscribers()) {
+ nextState = mPendingState;
+ // request from connecivity service for NIF
+ mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN);
+ } else {
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+//======================================================================
+//Servicer
+//======================================================================
+Servicer* Servicer :: getServicer(servicerType type, void *cb_func)
+{
+ LOC_LOGD(" Enter getServicer type:%d\n", (int)type);
+ switch(type) {
+ case servicerTypeNoCbParam:
+ return (new Servicer(cb_func));
+ case servicerTypeExt:
+ return (new ExtServicer(cb_func));
+ case servicerTypeAgps:
+ return (new AGpsServicer(cb_func));
+ default:
+ return NULL;
+ }
+}
+
+int Servicer :: requestRsrc(void *cb_data)
+{
+ callback();
+ return 0;
+}
+
+int ExtServicer :: requestRsrc(void *cb_data)
+{
+ int ret=-1;
+ LOC_LOGD("Enter ExtServicer :: requestRsrc\n");
+ ret = callbackExt(cb_data);
+ LOC_LOGD("Exit ExtServicer :: requestRsrc\n");
+ return(ret);
+}
+
+int AGpsServicer :: requestRsrc(void *cb_data)
+{
+ callbackAGps((AGpsStatus *)cb_data);
+ return 0;
+}
+
+//======================================================================
+// AgpsStateMachine
+//======================================================================
+
+AgpsStateMachine::AgpsStateMachine(servicerType servType,
+ void *cb_func,
+ AGpsExtType type,
+ bool enforceSingleSubscriber) :
+ mStatePtr(new AgpsReleasedState(this)),mType(type),
+ mAPN(NULL),
+ mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID),
+ mEnforceSingleSubscriber(enforceSingleSubscriber),
+ mServicer(Servicer :: getServicer(servType, (void *)cb_func))
+{
+ linked_list_init(&mSubscribers);
+
+ // setting up mReleasedState
+ mStatePtr->mPendingState = new AgpsPendingState(this);
+ mStatePtr->mAcquiredState = new AgpsAcquiredState(this);
+ mStatePtr->mReleasingState = new AgpsReleasingState(this);
+
+ // setting up mAcquiredState
+ mStatePtr->mAcquiredState->mReleasedState = mStatePtr;
+ mStatePtr->mAcquiredState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mAcquiredState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mPendingState
+ mStatePtr->mPendingState->mAcquiredState = mStatePtr->mAcquiredState;
+ mStatePtr->mPendingState->mReleasedState = mStatePtr;
+ mStatePtr->mPendingState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mReleasingState
+ mStatePtr->mReleasingState->mReleasedState = mStatePtr;
+ mStatePtr->mReleasingState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mReleasingState->mAcquiredState = mStatePtr->mAcquiredState;
+}
+
+AgpsStateMachine::~AgpsStateMachine()
+{
+ dropAllSubscribers();
+
+ // free the 3 states. We must read out all 3 pointers first.
+ // Otherwise we run the risk of getting pointers from already
+ // freed memory.
+ AgpsState* acquiredState = mStatePtr->mAcquiredState;
+ AgpsState* releasedState = mStatePtr->mReleasedState;
+ AgpsState* pendindState = mStatePtr->mPendingState;
+ AgpsState* releasingState = mStatePtr->mReleasingState;
+
+ delete acquiredState;
+ delete releasedState;
+ delete pendindState;
+ delete releasingState;
+ delete mServicer;
+ linked_list_destroy(&mSubscribers);
+
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ mAPN = NULL;
+ }
+}
+
+void AgpsStateMachine::setAPN(const char* apn, unsigned int len)
+{
+ if (NULL != mAPN) {
+ delete mAPN;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ memcpy(mAPN, apn, len);
+ mAPN[len] = NULL;
+
+ mAPNLen = len;
+ } else {
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+}
+
+void AgpsStateMachine::onRsrcEvent(AgpsRsrcStatus event)
+{
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+}
+
+void AgpsStateMachine::notifySubscribers(Notification& notification) const
+{
+ if (notification.postNotifyDelete) {
+ // just any non NULL value to get started
+ Subscriber* s = (Subscriber*)~0;
+ while (NULL != s) {
+ s = NULL;
+ // if the last param sets to true, _search will delete
+ // the node from the list for us. But the problem is
+ // once that is done, _search returns, leaving the
+ // rest of the list unprocessed. So we need a loop.
+ linked_list_search(mSubscribers, (void**)&s, notifySubscriber,
+ (void*)¬ification, true);
+ delete s;
+ }
+ } else {
+ // no loop needed if it the last param sets to false, which
+ // mean nothing gets deleted from the list.
+ linked_list_search(mSubscribers, NULL, notifySubscriber,
+ (void*)¬ification, false);
+ }
+}
+
+void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL == s) {
+ linked_list_add(mSubscribers, subscriber->clone(), deleteObj);
+ }
+}
+
+int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+
+ if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) {
+ AGpsExtStatus nifRequest;
+ nifRequest.size = sizeof(nifRequest);
+ nifRequest.type = mType;
+ nifRequest.status = action;
+
+ if (s == NULL) {
+ nifRequest.ipv4_addr = INADDR_NONE;
+ nifRequest.ipv6_addr[0] = 0;
+ nifRequest.ssid[0] = '\0';
+ nifRequest.password[0] = '\0';
+ } else {
+ s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr);
+ s->setWifiInfo(nifRequest.ssid, nifRequest.password);
+ }
+
+ CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
+ mServicer->requestRsrc((void *)&nifRequest);
+ }
+ return 0;
+}
+
+void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
+{
+ if (mEnforceSingleSubscriber && hasSubscribers()) {
+ Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
+ notifySubscriber(¬ification, subscriber);
+ } else {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
+ }
+}
+
+bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL != s) {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_UNSUBSCRIBE, (void*)s);
+ return true;
+ }
+ return false;
+}
+
+bool AgpsStateMachine::hasActiveSubscribers() const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+ return NULL != s;
+}
+
+//======================================================================
+// DSStateMachine
+//======================================================================
+void delay_callback(void *callbackData, int result)
+{
+ if(callbackData) {
+ DSStateMachine *DSSMInstance = (DSStateMachine *)callbackData;
+ DSSMInstance->retryCallback();
+ }
+ else {
+ LOC_LOGE(" NULL argument received. Failing.\n");
+ goto err;
+ }
+err:
+ return;
+}
+
+DSStateMachine :: DSStateMachine(servicerType type, void *cb_func,
+ LocEngAdapter* adapterHandle):
+ AgpsStateMachine(type, cb_func, AGPS_TYPE_INVALID,false),
+ mLocAdapter(adapterHandle)
+{
+ LOC_LOGD("%s:%d]: New DSStateMachine\n", __func__, __LINE__);
+ mRetries = 0;
+}
+
+void DSStateMachine :: retryCallback(void)
+{
+ DSSubscriber *subscriber = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&subscriber, hasSubscriber,
+ (void*)¬ification, false);
+ if(subscriber)
+ mLocAdapter->requestSuplES(subscriber->ID);
+ else
+ LOC_LOGE("DSStateMachine :: retryCallback: No subscriber found." \
+ "Cannot retry data call\n");
+ return;
+}
+
+int DSStateMachine :: sendRsrcRequest(AGpsStatusValue action) const
+{
+ DSSubscriber* s = NULL;
+ dsCbData cbData;
+ int ret=-1;
+ int connHandle=-1;
+ LOC_LOGD("Enter DSStateMachine :: sendRsrcRequest\n");
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+ if(s) {
+ connHandle = s->ID;
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - subscriber found\n");
+ }
+ else
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - No subscriber found\n");
+
+ cbData.action = action;
+ cbData.mAdapter = mLocAdapter;
+ ret = mServicer->requestRsrc((void *)&cbData);
+ //Only the request to start data call returns a success/failure
+ //The request to stop data call will always succeed
+ //Hence, the below block will only be executed when the
+ //request to start the data call fails
+ switch(ret) {
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - Failure returned: %d\n",ret);
+ ((DSStateMachine *)this)->incRetries();
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+ LOC_LOGE(" Failed to start Data call. Fallback to normal ATL SUPL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ }
+ else {
+ if(loc_timer_start(DATA_CALL_RETRY_DELAY_MSEC, delay_callback, (void *)this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ ret = -1;
+ goto err;
+ }
+ }
+ break;
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No profile found for emergency call. Fallback to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("%s:%d]: Request to start data call sent\n", __func__, __LINE__);
+ break;
+ case -1:
+ //One of the ways this case can be encountered is if the callback function
+ //receives a null argument, it just exits with -1 error
+ LOC_LOGE("Error: Something went wrong somewhere. Falling back to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Unrecognized return value\n", __func__, __LINE__);
+ }
+err:
+ LOC_LOGD("EXIT DSStateMachine :: sendRsrcRequest; ret = %d\n", ret);
+ return ret;
+}
+
+void DSStateMachine :: onRsrcEvent(AgpsRsrcStatus event)
+{
+ void* currState = (void *)mStatePtr;
+ LOC_LOGD("Enter DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_GRANTED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ case RSRC_RELEASED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_RELEASED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ //To handle the case where we get a RSRC_RELEASED in
+ //pending state, we translate that to a RSRC_DENIED state
+ //since the callback from DSI is either RSRC_GRANTED or RSRC_RELEASED
+ //for when the call is connected or disconnected respectively.
+ if((void *)mStatePtr != currState)
+ break;
+ else {
+ event = RSRC_DENIED;
+ LOC_LOGE(" Switching event to RSRC_DENIED\n");
+ }
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+ LOC_LOGD("Exit DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+}
+
+void DSStateMachine :: informStatus(AgpsRsrcStatus status, int ID) const
+{
+ LOC_LOGD("DSStateMachine :: informStatus. Status=%d\n",(int)status);
+ switch(status) {
+ case RSRC_UNSUBSCRIBE:
+ mLocAdapter->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_RELEASED:
+ mLocAdapter->closeDataCall();
+ break;
+ case RSRC_DENIED:
+ ((DSStateMachine *)this)->mRetries = 0;
+ mLocAdapter->requestATL(ID, AGPS_TYPE_SUPL);
+ break;
+ case RSRC_GRANTED:
+ mLocAdapter->atlOpenStatus(ID, 1,
+ NULL,
+ AGPS_APN_BEARER_INVALID,
+ AGPS_TYPE_INVALID);
+ break;
+ default:
+ LOC_LOGW("DSStateMachine :: informStatus - unknown status");
+ }
+ return;
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_agps.h b/msm8960/loc_api/libloc_api_50001/loc_eng_agps.h
new file mode 100644
index 0000000..055d955
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -0,0 +1,419 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_ENG_AGPS_H__
+#define __LOC_ENG_AGPS_H__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_core_log.h>
+#include <linked_list.h>
+#include <loc_timer.h>
+#include <LocEngAdapter.h>
+
+// forward declaration
+class AgpsStateMachine;
+class Subscriber;
+
+// NIF resource events
+typedef enum {
+ RSRC_SUBSCRIBE,
+ RSRC_UNSUBSCRIBE,
+ RSRC_GRANTED,
+ RSRC_RELEASED,
+ RSRC_DENIED,
+ RSRC_STATUS_MAX
+} AgpsRsrcStatus;
+
+typedef enum {
+ servicerTypeNoCbParam,
+ servicerTypeAgps,
+ servicerTypeExt
+}servicerType;
+
+//DS Callback struct
+typedef struct {
+ LocEngAdapter *mAdapter;
+ AGpsStatusValue action;
+}dsCbData;
+
+// information bundle for subscribers
+struct Notification {
+ // goes to every subscriber
+ static const int BROADCAST_ALL;
+ // goes to every ACTIVE subscriber
+ static const int BROADCAST_ACTIVE;
+ // goes to every INACTIVE subscriber
+ static const int BROADCAST_INACTIVE;
+
+ // go to a specific subscriber
+ const Subscriber* rcver;
+ // broadcast
+ const int groupID;
+ // the new resource status event
+ const AgpsRsrcStatus rsrcStatus;
+ // should the subscriber be deleted after the notification
+ const bool postNotifyDelete;
+
+ // convenient constructor
+ inline Notification(const int broadcast,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(subscriber), groupID(-1), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const int broadcast) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber) :
+ rcver(subscriber), groupID(-1), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+};
+
+class AgpsState {
+ // allows AgpsStateMachine to access private data
+ // no class members are public. We don't want
+ // anyone but state machine to use state.
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+ // state transitions are done here.
+ // Each state implements its own transitions (of course).
+ inline virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data) = 0;
+
+protected:
+ // handle back to state machine
+ const AgpsStateMachine* mStateMachine;
+ // each state has pointers to all 3 states
+ // one of which is to itself.
+ AgpsState* mReleasedState;
+ AgpsState* mAcquiredState;
+ AgpsState* mPendingState;
+ AgpsState* mReleasingState;
+
+ inline AgpsState(const AgpsStateMachine *stateMachine) :
+ mStateMachine(stateMachine),
+ mReleasedState(NULL),
+ mAcquiredState(NULL),
+ mPendingState(NULL),
+ mReleasingState(NULL) {}
+ virtual ~AgpsState() {}
+
+public:
+ // for logging purpose
+ inline virtual char* whoami() = 0;
+};
+
+class Servicer {
+ void (*callback)(void);
+public:
+ static Servicer* getServicer(servicerType type, void *cb_func);
+ virtual int requestRsrc(void *cb_data);
+ Servicer() {}
+ Servicer(void *cb_func)
+ { callback = (void(*)(void))(cb_func); }
+ virtual ~Servicer(){}
+ inline virtual char *whoami() {return (char*)"Servicer";}
+};
+
+class ExtServicer : public Servicer {
+ int (*callbackExt)(void *cb_data);
+public:
+ int requestRsrc(void *cb_data);
+ ExtServicer() {}
+ ExtServicer(void *cb_func)
+ { callbackExt = (int(*)(void *))(cb_func); }
+ virtual ~ExtServicer(){}
+ inline virtual char *whoami() {return (char*)"ExtServicer";}
+};
+
+class AGpsServicer : public Servicer {
+ void (*callbackAGps)(AGpsStatus* status);
+public:
+ int requestRsrc(void *cb_data);
+ AGpsServicer() {}
+ AGpsServicer(void *cb_func)
+ { callbackAGps = (void(*)(AGpsStatus *))(cb_func); }
+ virtual ~AGpsServicer(){}
+ inline virtual char *whoami() {return (char*)"AGpsServicer";}
+};
+
+class AgpsStateMachine {
+protected:
+ // a linked list of subscribers.
+ void* mSubscribers;
+ //handle to whoever provides the service
+ Servicer *mServicer;
+ // allows AgpsState to access private data
+ // each state is really internal data to the
+ // state machine, so it should be able to
+ // access anything within the state machine.
+ friend class AgpsState;
+ // pointer to the current state.
+ AgpsState* mStatePtr;
+private:
+ // NIF type: AGNSS or INTERNET.
+ const AGpsExtType mType;
+ // apn to the NIF. Each state machine tracks
+ // resource state of a particular NIF. For each
+ // NIF, there is also an active APN.
+ char* mAPN;
+ // for convenience, we don't do strlen each time.
+ unsigned int mAPNLen;
+ // bear
+ AGpsBearerType mBearer;
+ // ipv4 address for routing
+ bool mEnforceSingleSubscriber;
+
+public:
+ AgpsStateMachine(servicerType servType, void *cb_func,
+ AGpsExtType type, bool enforceSingleSubscriber);
+ virtual ~AgpsStateMachine();
+
+ // self explanatory methods below
+ void setAPN(const char* apn, unsigned int len);
+ inline const char* getAPN() const { return (const char*)mAPN; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return (AGpsExtType)mType; }
+
+ // someone, a ATL client or BIT, is asking for NIF
+ void subscribeRsrc(Subscriber *subscriber);
+
+ // someone, a ATL client or BIT, is done with NIF
+ bool unsubscribeRsrc(Subscriber *subscriber);
+
+ // add a subscriber in the linked list, if not already there.
+ void addSubscriber(Subscriber* subscriber) const;
+
+ virtual void onRsrcEvent(AgpsRsrcStatus event);
+
+ // put the data together and send the FW
+ virtual int sendRsrcRequest(AGpsStatusValue action) const;
+
+ //if list is empty, linked_list_empty returns 1
+ //else if list is not empty, returns 0
+ //so hasSubscribers() returns 1 if list is not empty
+ //and returns 0 if list is empty
+ inline bool hasSubscribers() const
+ { return !linked_list_empty(mSubscribers); }
+
+ bool hasActiveSubscribers() const;
+
+ inline void dropAllSubscribers() const
+ { linked_list_flush(mSubscribers); }
+
+ // private. Only a state gets to call this.
+ void notifySubscribers(Notification& notification) const;
+
+};
+
+class DSStateMachine : public AgpsStateMachine {
+ static const unsigned char MAX_START_DATA_CALL_RETRIES;
+ static const unsigned int DATA_CALL_RETRY_DELAY_MSEC;
+ LocEngAdapter* mLocAdapter;
+ unsigned char mRetries;
+public:
+ DSStateMachine(servicerType type,
+ void *cb_func,
+ LocEngAdapter* adapterHandle);
+ int sendRsrcRequest(AGpsStatusValue action) const;
+ void onRsrcEvent(AgpsRsrcStatus event);
+ void retryCallback();
+ void informStatus(AgpsRsrcStatus status, int ID) const;
+ inline void incRetries() {mRetries++;}
+ inline virtual char *whoami() {return (char*)"DSStateMachine";}
+};
+
+// each subscriber is a AGPS client. In the case of ATL, there could be
+// multiple clients from modem. In the case of BIT, there is only one
+// cilent from BIT daemon.
+struct Subscriber {
+ const uint32_t ID;
+ const AgpsStateMachine* mStateMachine;
+ inline Subscriber(const int id,
+ const AgpsStateMachine* stateMachine) :
+ ID(id), mStateMachine(stateMachine) {}
+ inline virtual ~Subscriber() {}
+
+ virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ { ssid[0] = 0; password[0] = 0; }
+
+ inline virtual bool equals(const Subscriber *s) const
+ { return ID == s->ID; }
+
+ // notifies a subscriber a new NIF resource status, usually
+ // either GRANTE, DENIED, or RELEASED
+ virtual bool notifyRsrcStatus(Notification ¬ification) = 0;
+
+ virtual bool waitForCloseComplete() { return false; }
+ virtual void setInactive() {}
+ virtual bool isInactive() { return false; }
+
+ virtual Subscriber* clone() = 0;
+ // checks if this notification is for me, i.e.
+ // either has my id, or has a broadcast id.
+ bool forMe(Notification ¬ification);
+};
+
+// BITSubscriber, created with requests from BIT daemon
+struct BITSubscriber : public Subscriber {
+ char mIPv6Addr[16];
+
+ inline BITSubscriber(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ Subscriber(ipv4, stateMachine)
+ {
+ if (NULL == ipv6) {
+ mIPv6Addr[0] = 0;
+ } else {
+ memcpy(mIPv6Addr, ipv6, sizeof(mIPv6Addr));
+ }
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+
+ virtual Subscriber* clone()
+ {
+ return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
+ }
+
+ virtual bool equals(const Subscriber *s) const;
+ inline virtual ~BITSubscriber(){}
+};
+
+// ATLSubscriber, created with requests from ATL
+struct ATLSubscriber : public Subscriber {
+ const LocEngAdapter* mLocAdapter;
+ const bool mBackwardCompatibleMode;
+ inline ATLSubscriber(const int id,
+ const AgpsStateMachine* stateMachine,
+ const LocEngAdapter* adapter,
+ const bool compatibleMode) :
+ Subscriber(id, stateMachine), mLocAdapter(adapter),
+ mBackwardCompatibleMode(compatibleMode){}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = INADDR_NONE; v6[0] = 0; }
+
+ inline virtual Subscriber* clone()
+ {
+ return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
+ mBackwardCompatibleMode);
+ }
+ inline virtual ~ATLSubscriber(){}
+};
+
+// WIFISubscriber, created with requests from MSAPM or QuIPC
+struct WIFISubscriber : public Subscriber {
+ char * mSSID;
+ char * mPassword;
+ loc_if_req_sender_id_e_type senderId;
+ bool mIsInactive;
+ inline WIFISubscriber(const AgpsStateMachine* stateMachine,
+ char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
+ Subscriber(sender_id, stateMachine),
+ mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
+ senderId(sender_id)
+ {
+ if (NULL != mSSID)
+ strlcpy(mSSID, ssid, SSID_BUF_SIZE);
+ if (NULL != mPassword)
+ strlcpy(mPassword, password, SSID_BUF_SIZE);
+ mIsInactive = false;
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ {
+ if (NULL != mSSID)
+ strlcpy(ssid, mSSID, SSID_BUF_SIZE);
+ else
+ ssid[0] = '\0';
+ if (NULL != mPassword)
+ strlcpy(password, mPassword, SSID_BUF_SIZE);
+ else
+ password[0] = '\0';
+ }
+
+ inline virtual bool waitForCloseComplete() { return true; }
+
+ inline virtual void setInactive() { mIsInactive = true; }
+ inline virtual bool isInactive() { return mIsInactive; }
+
+ virtual Subscriber* clone()
+ {
+ return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
+ }
+ inline virtual ~WIFISubscriber(){}
+};
+
+struct DSSubscriber : public Subscriber {
+ bool mIsInactive;
+ inline DSSubscriber(const AgpsStateMachine *stateMachine,
+ const int id) :
+ Subscriber(id, stateMachine)
+ {
+ mIsInactive = false;
+ }
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ virtual Subscriber* clone()
+ {return new DSSubscriber(mStateMachine, ID);}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+ inline virtual bool waitForCloseComplete() { return true; }
+ virtual void setInactive();
+ inline virtual bool isInactive()
+ { return mIsInactive; }
+ inline virtual ~DSSubscriber(){}
+ inline virtual char *whoami() {return (char*)"DSSubscriber";}
+};
+
+#endif //__LOC_ENG_AGPS_H__
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
new file mode 100644
index 0000000..918ae22
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2011-2012, 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 <linux/stat.h>
+#include <fcntl.h>
+#include <linux/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <grp.h>
+#include <sys/stat.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_msg.h"
+
+static int loc_api_server_msgqid;
+static int loc_api_resp_msgqid;
+static int quipc_msgqid;
+static int msapm_msgqid;
+static int msapu_msgqid;
+
+static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
+static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
+static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
+static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
+static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
+
+static int loc_api_server_proc_init(void *context)
+{
+ loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
+ //change mode/group for the global_loc_api_q_path pipe
+ int result = chmod (global_loc_api_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
+ }
+
+ struct group * gps_group = getgrnam("gps");
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_q_path, gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+ else
+ {
+ LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
+ }
+
+ loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
+
+ //change mode/group for the global_loc_api_resp_q_path pipe
+ result = chmod (global_loc_api_resp_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
+ }
+
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_resp_q_path,
+ gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+
+ quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
+ msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
+ msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
+
+ LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
+ return 0;
+}
+
+static int loc_api_server_proc_pre(void *context)
+{
+ return 0;
+}
+
+static int loc_api_server_proc(void *context)
+{
+ int length, sz;
+ int result = 0;
+ static int cnt = 0;
+ struct ctrl_msgbuf * p_cmsgbuf;
+ struct ctrl_msgbuf cmsg_resp;
+
+ sz = sizeof(struct ctrl_msgbuf) + 256;
+ p_cmsgbuf = (struct ctrl_msgbuf *) malloc(sz);
+
+ if (!p_cmsgbuf) {
+ LOC_LOGE("%s:%d] Out of memory\n", __func__, __LINE__);
+ return -1;
+ }
+
+ cnt ++;
+ LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
+ length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
+ if (length <= 0) {
+ free(p_cmsgbuf);
+ LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
+ usleep(1000);
+ return 0;
+ }
+
+ LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ switch(p_cmsgbuf->ctrl_type) {
+ case GPSONE_LOC_API_IF_REQUEST:
+ result = loc_eng_dmn_conn_loc_api_server_if_request_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_LOC_API_IF_RELEASE:
+ result = loc_eng_dmn_conn_loc_api_server_if_release_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_UNBLOCK:
+ LOC_LOGD("%s:%d] GPSONE_UNBLOCK\n", __func__, __LINE__);
+ break;
+
+ default:
+ LOC_LOGE("%s:%d] unsupported ctrl_type = %d\n",
+ __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ break;
+ }
+
+ free(p_cmsgbuf);
+ return 0;
+}
+
+static int loc_api_server_proc_post(void *context)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
+ return 0;
+}
+
+static int loc_eng_dmn_conn_unblock_proc(void)
+{
+ struct ctrl_msgbuf cmsgbuf;
+ cmsgbuf.ctrl_type = GPSONE_UNBLOCK;
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgsnd(loc_api_server_msgqid, & cmsgbuf, sizeof(cmsgbuf));
+ return 0;
+}
+
+static struct loc_eng_dmn_conn_thelper thelper;
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * resp_q_path, void *agps_handle)
+{
+ int result;
+
+ loc_api_handle = agps_handle;
+
+ if (loc_api_q_path) global_loc_api_q_path = loc_api_q_path;
+ if (resp_q_path) global_loc_api_resp_q_path = resp_q_path;
+
+ result = loc_eng_dmn_conn_launch_thelper( &thelper,
+ loc_api_server_proc_init,
+ loc_api_server_proc_pre,
+ loc_api_server_proc,
+ loc_api_server_proc_post,
+ create_thread_cb,
+ (char *) global_loc_api_q_path);
+ if (result != 0) {
+ LOC_LOGE("%s:%d]\n", __func__, __LINE__);
+ return -1;
+ }
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_unblock(void)
+{
+ loc_eng_dmn_conn_unblock_thelper(&thelper);
+ loc_eng_dmn_conn_unblock_proc();
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_join(void)
+{
+ loc_eng_dmn_conn_join_thelper(&thelper);
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
+ struct ctrl_msgbuf cmsgbuf;
+ LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
+ cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
+ cmsgbuf.cmsg.cmsg_response.result = status;
+ switch (sender_id) {
+ case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapu_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ default: {
+ LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
+ }
+ }
+ return 0;
+}
+
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
new file mode 100644
index 0000000..c7c100b
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_H
+#define LOC_ENG_DATA_SERVER_H
+
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+#ifdef _ANDROID_
+
+#define GPSONE_LOC_API_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/data/misc/gpsone_d/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/data/misc/gpsone_d/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/data/misc/gpsone_d/msapu_ctrl_q"
+
+#else
+
+#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
+
+#endif
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
+int loc_eng_dmn_conn_loc_api_server_unblock(void);
+int loc_eng_dmn_conn_loc_api_server_join(void);
+int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
+
+#endif /* LOC_ENG_DATA_SERVER_H */
+
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
new file mode 100644
index 0000000..a1076ff
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -0,0 +1,223 @@
+/* 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.
+ *
+ */
+#include <linux/stat.h>
+#include <fcntl.h>
+
+#include <linux/types.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgget
+
+DESCRIPTION
+ This function get a message queue
+
+ q_path - name path of the message queue
+ mode -
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ message queue id
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode)
+{
+ int msgqid;
+ msgqid = loc_eng_dmn_conn_glue_pipeget(q_path, mode);
+ return msgqid;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgremove
+
+DESCRIPTION
+ remove a message queue
+
+ q_path - name path of the message queue
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid)
+{
+ int result;
+ result = loc_eng_dmn_conn_glue_piperemove(q_path, msgqid);
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgsnd
+
+DESCRIPTION
+ Send a message
+
+ msgqid - message queue id
+ msgp - pointer to the message to be sent
+ msgsz - size of the message
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes sent out or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+ pmsg->msgsz = msgsz;
+
+ result = loc_eng_dmn_conn_glue_pipewrite(msgqid, msgp, msgsz);
+ if (result != (int) msgsz) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) msgsz);
+ return -1;
+ }
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgrcv
+
+DESCRIPTION
+ receive a message
+
+ msgqid - message queue id
+ msgp - pointer to the buffer to hold the message
+ msgsz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes received or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgbufsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, &(pmsg->msgsz), sizeof(pmsg->msgsz));
+ if (result != sizeof(pmsg->msgsz)) {
+ LOC_LOGE("%s:%d] pipe broken %d\n", __func__, __LINE__, result);
+ return -1;
+ }
+
+ if (msgbufsz < pmsg->msgsz) {
+ LOC_LOGE("%s:%d] msgbuf is too small %d < %d\n", __func__, __LINE__, (int) msgbufsz, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, (uint8_t *) msgp + sizeof(pmsg->msgsz), pmsg->msgsz - sizeof(pmsg->msgsz));
+ if (result != (int) (pmsg->msgsz - sizeof(pmsg->msgsz))) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ return pmsg->msgsz;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgunblock
+
+DESCRIPTION
+ unblock a message queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid)
+{
+ return loc_eng_dmn_conn_glue_pipeunblock(msgqid);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgflush
+
+DESCRIPTION
+ flush out the message in a queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes that are flushed out.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgflush(int msgqid)
+{
+ int length;
+ char buf[128];
+
+ do {
+ length = loc_eng_dmn_conn_glue_piperead(msgqid, buf, 128);
+ LOC_LOGD("%s:%d] %s\n", __func__, __LINE__, buf);
+ } while(length);
+ return length;
+}
+
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
new file mode 100644
index 0000000..d685c87
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
@@ -0,0 +1,51 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_MSG_H
+#define LOC_ENG_DMN_CONN_GLUE_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#include <linux/types.h>
+#include "loc_eng_dmn_conn_glue_pipe.h"
+
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode);
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid);
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgflush(int msgqid);
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
new file mode 100644
index 0000000..dffcad0
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -0,0 +1,214 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+// #include <linux/stat.h>
+#include <fcntl.h>
+// #include <linux/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "loc_eng_dmn_conn_glue_pipe.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeget
+
+DESCRIPTION
+ create a named pipe.
+
+ pipe_name - pipe name path
+ mode - mode
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
+{
+ int fd;
+ int result;
+
+ LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
+ result = mkfifo(pipe_name, 0660);
+
+ if ((result == -1) && (errno != EEXIST)) {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ return result;
+ }
+
+ // The mode in mkfifo is not honoured and does not provide the
+ // group permissions. Doing chmod to add group permissions.
+ result = chmod (pipe_name, 0660);
+ if (result != 0){
+ LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
+ pipe_name, strerror(errno));
+ }
+
+ fd = open(pipe_name, mode);
+ if (fd <= 0)
+ {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ }
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return fd;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperemove
+
+DESCRIPTION
+ remove a pipe
+
+ pipe_name - pipe name path
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd)
+{
+ close(fd);
+ if (pipe_name) unlink(pipe_name);
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipewrite
+
+DESCRIPTION
+ write to a pipe
+
+ fd - fd of a pipe
+ buf - buffer for the data to write
+ sz - size of the data in buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes written or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz)
+{
+ int result;
+
+ result = write(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, result = %d\n", fd, (long) buf, (int) sz, (int) result); */
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperead
+
+DESCRIPTION
+ read from a pipe
+
+ fd - fd for the pipe
+ buf - buffer to hold the data read from pipe
+ sz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes read from pipe or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz)
+{
+ int len;
+
+ len = read(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, len = %d\n", fd, (long) buf, (int) sz, len); */
+ return len;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeunblock
+
+DESCRIPTION
+ unblock a pipe
+
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 for success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeunblock(int fd)
+{
+ int result;
+ struct flock flock_v;
+ LOC_LOGD("\n");
+// result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY);
+ flock_v.l_type = F_UNLCK;
+ flock_v.l_len = 32;
+ result = fcntl(fd, F_SETLK, &flock_v);
+ if (result < 0) {
+ LOC_LOGE("fcntl failure, %s\n", strerror(errno));
+ }
+
+ return result;
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
new file mode 100644
index 0000000..b2fa3a0
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
@@ -0,0 +1,50 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_PIPE_H
+#define LOC_ENG_DMN_CONN_GLUE_PIPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <linux/types.h>
+
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode);
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd);
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz);
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz);
+
+int loc_eng_dmn_conn_glue_pipeflush(int fd);
+int loc_eng_dmn_conn_glue_pipeunblock(int fd);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
new file mode 100644
index 0000000..edd53f2
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-2012, 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 <string.h>
+#include <unistd.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_msg.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+void* loc_api_handle = NULL;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ if (NULL == loc_api_handle) {
+ LOC_LOGE("%s:%d] NO agps data handle\n", __func__, __LINE__);
+ return 1;
+ }
+
+ if (NULL != loc_api_handle) {
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ true);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+ }
+
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+#endif
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ false);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+#endif
+ return 0;
+}
+
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
new file mode 100644
index 0000000..1c0edd5
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_HANDLER
+#define LOC_ENG_DATA_SERVER_HANDLER
+
+#include <linux/types.h>
+#include <arpa/inet.h>
+
+//for SSID_BUF_SIZE
+#include <hardware/gps.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+
+enum {
+ /* 0x0 - 0xEF is reserved for daemon internal */
+ GPSONE_LOC_API_IF_REQUEST = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE,
+ GPSONE_LOC_API_RESPONSE,
+ GPSONE_UNBLOCK,
+};
+
+enum {
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS,
+ GPSONE_LOC_API_IF_FAILURE,
+};
+
+
+struct ctrl_msg_response {
+ int result;
+};
+
+struct ctrl_msg_unblock {
+ int reserved;
+};
+
+typedef enum {
+ IF_REQUEST_TYPE_SUPL = 0,
+ IF_REQUEST_TYPE_WIFI,
+ IF_REQUEST_TYPE_ANY
+} ctrl_if_req_type_e_type;
+
+typedef enum {
+ IF_REQUEST_SENDER_ID_QUIPC = 0,
+ IF_REQUEST_SENDER_ID_MSAPM,
+ IF_REQUEST_SENDER_ID_MSAPU,
+ IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ IF_REQUEST_SENDER_ID_MODEM
+} ctrl_if_req_sender_id_e_type;
+
+struct ctrl_msg_if_request {
+ ctrl_if_req_type_e_type type;
+ ctrl_if_req_sender_id_e_type sender_id;
+ unsigned long ipv4_addr;
+ unsigned char ipv6_addr[16];
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+};
+
+/* do not change this structure */
+struct ctrl_msgbuf {
+ size_t msgsz;
+ uint16_t reserved1;
+ uint32_t reserved2;
+ uint8_t ctrl_type;
+ union {
+ struct ctrl_msg_response cmsg_response;
+ struct ctrl_msg_unblock cmsg_unblock;
+ struct ctrl_msg_if_request cmsg_if_request;
+ } cmsg;
+};
+
+extern void* loc_api_handle;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
+
+#endif /* LOC_ENG_DATA_SERVER_HANDLER */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
new file mode 100644
index 0000000..9fed9d4
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -0,0 +1,399 @@
+/* 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.
+ *
+ */
+#include <stdio.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+/*===========================================================================
+FUNCTION thelper_signal_init
+
+DESCRIPTION
+ This function will initialize the conditional variable resources.
+
+ thelper - thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+ thelper->thread_exit = 0;
+ thelper->thread_ready = 0;
+ result = pthread_cond_init( &thelper->thread_cond, NULL);
+ if (result) {
+ return result;
+ }
+
+ result = pthread_mutex_init(&thelper->thread_mutex, NULL);
+ if (result) {
+ pthread_cond_destroy(&thelper->thread_cond);
+ }
+ return result;
+}
+
+/*===========================================================================
+FUNCTION
+
+DESCRIPTION
+ This function will destroy the conditional variable resources
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result, ret_result = 0;
+ result = pthread_cond_destroy( &thelper->thread_cond);
+ if (result) {
+ ret_result = result;
+ }
+
+ result = pthread_mutex_destroy(&thelper->thread_mutex);
+ if (result) {
+ ret_result = result;
+ }
+
+ return ret_result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_wait
+
+DESCRIPTION
+ This function will be blocked on the conditional variable until thelper_signal_ready
+ is called
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = 0;
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ if (!thelper->thread_ready && !thelper->thread_exit) {
+ result = pthread_cond_wait(&thelper->thread_cond, &thelper->thread_mutex);
+ }
+
+ if (thelper->thread_exit) {
+ result = -1;
+ }
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_ready
+
+DESCRIPTION
+ This function will wake up the conditional variable
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 1;
+ result = pthread_cond_signal(&thelper->thread_cond);
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_block
+
+DESCRIPTION
+ This function will set the thread ready to 0 to block the thelper_signal_wait
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ if thread_ready is set
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = thelper->thread_ready;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 0;
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_main
+
+DESCRIPTION
+ This function is the main thread. It will be launched as a child thread
+
+ data - pointer to the instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ NULL
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void * thelper_main(void *data)
+{
+ int result = 0;
+ struct loc_eng_dmn_conn_thelper * thelper = (struct loc_eng_dmn_conn_thelper *) data;
+
+ if (thelper->thread_proc_init) {
+ result = thelper->thread_proc_init(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ thelper_signal_ready(thelper);
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ thelper_signal_ready(thelper);
+
+ if (thelper->thread_proc_pre) {
+ result = thelper->thread_proc_pre(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ do {
+ if (thelper->thread_proc) {
+ result = thelper->thread_proc(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ }
+ } while (thelper->thread_exit == 0);
+
+ if (thelper->thread_proc_post) {
+ result = thelper->thread_proc_post(thelper->thread_context);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ return NULL;
+}
+
+static void thelper_main_2(void *data)
+{
+ thelper_main(data);
+ return;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_launch_thelper
+
+DESCRIPTION
+ This function will initialize the thread context and launch the thelper_main
+
+ thelper - pointer to thelper instance
+ thread_proc_init - The initialization function pointer
+ thread_proc_pre - The function to call before task loop and after initialization
+ thread_proc - The task loop
+ thread_proc_post - The function to call after the task loop
+ context - the context for the above four functions
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context)
+{
+ int result;
+
+ thelper_signal_init(thelper);
+
+ if (context) {
+ thelper->thread_context = context;
+ }
+
+ thelper->thread_proc_init = thread_proc_init;
+ thelper->thread_proc_pre = thread_proc_pre;
+ thelper->thread_proc = thread_proc;
+ thelper->thread_proc_post = thread_proc_post;
+
+ LOC_LOGD("%s:%d] 0x%lx call pthread_create\n", __func__, __LINE__, (long) thelper);
+ if (create_thread_cb) {
+ result = 0;
+ thelper->thread_id = create_thread_cb("loc_eng_dmn_conn",
+ thelper_main_2, (void *)thelper);
+ } else {
+ result = pthread_create(&thelper->thread_id, NULL,
+ thelper_main, (void *)thelper);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] 0x%lx pthread_create done\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_wait(thelper);
+
+ LOC_LOGD("%s:%d] 0x%lx pthread ready\n", __func__, __LINE__, (long) thelper);
+ return thelper->thread_exit;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_unblock_thelper
+
+DESCRIPTION
+ This function unblocks thelper_main to release the thread
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ thelper->thread_exit = 1;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_join_thelper
+
+ thelper - pointer to thelper instance
+
+DESCRIPTION
+ This function will wait for the thread of thelper_main to finish
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ result = pthread_join(thelper->thread_id, NULL);
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_destroy(thelper);
+
+ return result;
+}
+
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
new file mode 100644
index 0000000..89e598b
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+#define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+
+struct loc_eng_dmn_conn_thelper {
+ unsigned char thread_exit;
+ unsigned char thread_ready;
+ pthread_cond_t thread_cond;
+ pthread_mutex_t thread_mutex;
+ pthread_t thread_id;
+ void * thread_context;
+ int (*thread_proc_init) (void * context);
+ int (*thread_proc_pre) (void * context);
+ int (*thread_proc) (void * context);
+ int (*thread_proc_post) (void * context);
+};
+
+typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg);
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context);
+
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+
+/* if only need to use signal */
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_log.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_log.cpp
new file mode 100644
index 0000000..3a34167
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_log.cpp
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include "loc_log.h"
+#include "loc_eng_log.h"
+
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_log.h b/msm8960/loc_api/libloc_api_50001/loc_eng_log.h
new file mode 100644
index 0000000..a68bd84
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_log.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_msg.h b/msm8960/loc_api/libloc_api_50001/loc_eng_msg.h
new file mode 100644
index 0000000..1a31894
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -0,0 +1,288 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_ENG_MSG_H
+#define LOC_ENG_MSG_H
+
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <stdlib.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_eng_log.h>
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include <LocEngAdapter.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+#ifdef USE_GLIB
+
+#include <glib.h>
+
+#endif /* USE_GLIB */
+#include "platform_lib_includes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+using namespace loc_core;
+
+struct LocEngPositionMode : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const LocPosMode mPosMode;
+ LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
+ virtual void proc() const;
+ virtual void log() const;
+ void send() const;
+};
+
+
+struct LocEngStartFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStartFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngStopFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStopFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportPosition : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const UlpLocation mLocation;
+ const GpsLocationExtended mLocationExtended;
+ const void* mLocationExt;
+ const enum loc_sess_status mStatus;
+ const LocPosTechMask mTechMask;
+ LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportSv : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsSvStatus mSvStatus;
+ const GpsLocationExtended mLocationExtended;
+ const void* mSvExt;
+ LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExtended);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportStatus : public LocMsg {
+ void* mLocEng;
+ const GpsStatusValue mStatus;
+ LocEngReportStatus(void* locEng,
+ GpsStatusValue engineStatus);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportNmea : public LocMsg {
+ void* mLocEng;
+ char* const mNmea;
+ const int mLen;
+ LocEngReportNmea(void* locEng,
+ const char* data, int len);
+ inline virtual ~LocEngReportNmea()
+ {
+ delete[] mNmea;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportXtraServer : public LocMsg {
+ void* mLocEng;
+ int mMaxLen;
+ char *mServers;
+ LocEngReportXtraServer(void* locEng,
+ const char *url1, const char *url2,
+ const char *url3, const int maxlength);
+ inline virtual ~LocEngReportXtraServer()
+ {
+ delete[] mServers;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsOpened : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsOpened(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsClosed : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsClosed(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestSuplEs : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngRequestSuplEs(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ const AGpsExtType mType;
+ LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReleaseATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngReleaseATL(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReqRelBIT : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const int mIPv4Addr;
+ char* const mIPv6Addr;
+ const bool mIsReq;
+ LocEngReqRelBIT(void* instance, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq);
+ virtual ~LocEngReqRelBIT();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReqRelWifi : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const loc_if_req_sender_id_e_type mSenderId;
+ char* const mSSID;
+ char* const mPassword;
+ const bool mIsReq;
+ LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq);
+ virtual ~LocEngReqRelWifi();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngRequestXtra : public LocMsg {
+ void* mLocEng;
+ LocEngRequestXtra(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestTime : public LocMsg {
+ void* mLocEng;
+ LocEngRequestTime(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestNi : public LocMsg {
+ void* mLocEng;
+ const GpsNiNotification mNotify;
+ const void *mPayload;
+ LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngDown : public LocMsg {
+ void* mLocEng;
+ LocEngDown(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngUp : public LocMsg {
+ void* mLocEng;
+ LocEngUp(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_MSG_H */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_ni.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_ni.cpp
new file mode 100644
index 0000000..f017cab
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -0,0 +1,355 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <MsgTask.h>
+
+#include <loc_eng.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+static void* ni_thread_proc(void *args);
+
+struct LocEngInformNiResponse : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUserResponseType mResponse;
+ const void *mPayload;
+ inline LocEngInformNiResponse(LocEngAdapter* adapter,
+ GpsUserResponseType resp,
+ const void* data) :
+ LocMsg(), mAdapter(adapter),
+ mResponse(resp), mPayload(data)
+ {
+ locallog();
+ }
+ inline ~LocEngInformNiResponse()
+ {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const
+ {
+ mAdapter->informNiResponse(mResponse, mPayload);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInformNiResponse - "
+ "response: %s\n mPayload: %p",
+ loc_get_ni_response_name(mResponse),
+ mPayload);
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough)
+{
+ ENTRY_LOG();
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ /* If busy, use default or deny */
+ if (NULL != loc_eng_ni_data_p->rawRequest)
+ {
+ /* XXX Consider sending a NO RESPONSE reply or queue the request */
+ LOC_LOGW("loc_eng_ni_request_handler, notification in progress, new NI request ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ }
+ else {
+ /* Save request */
+ loc_eng_ni_data_p->rawRequest = (void*)passThrough;
+
+ /* Fill in notification */
+ ((GpsNiNotification*)notif)->notification_id = loc_eng_ni_data_p->reqID;
+
+ if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session(loc_eng_data);
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif->ni_type, notif->timeout, notif->default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif->requestor_id, notif->requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif->text, notif->text_encoding);
+ if (notif->extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif->extras);
+ }
+
+ /* 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.
+ **/
+ loc_eng_ni_data_p->respTimeLeft = 5 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data_p->respTimeLeft);
+
+ int rc = 0;
+ rc = pthread_create(&loc_eng_ni_data_p->thread, NULL, ni_thread_proc, &loc_eng_data);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(loc_eng_ni_data_p->thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+
+ CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
+ loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION ni_thread_proc
+
+===========================================================================*/
+static void* ni_thread_proc(void *args)
+{
+ ENTRY_LOG();
+
+ loc_eng_data_s_type* loc_eng_data_p = (loc_eng_data_s_type*)args;
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data_p->loc_eng_ni_data;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&loc_eng_ni_data_p->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + loc_eng_ni_data_p->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n",
+ (long) expire_time.tv_sec, loc_eng_ni_data_p->respTimeLeft );
+
+ while (!loc_eng_ni_data_p->respRecvd)
+ {
+ rc = pthread_cond_timedwait(&loc_eng_ni_data_p->tCond,
+ &loc_eng_ni_data_p->tLock,
+ &expire_time);
+ if (rc == ETIMEDOUT)
+ {
+ loc_eng_ni_data_p->resp = GPS_NI_RESPONSE_NORESP;
+ LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ loc_eng_ni_data_p->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()
+ LocEngAdapter* adapter = loc_eng_data_p->adapter;
+ LocEngInformNiResponse *msg = NULL;
+
+ if (NULL != loc_eng_ni_data_p->rawRequest) {
+ msg = new LocEngInformNiResponse(adapter,
+ loc_eng_ni_data_p->resp,
+ loc_eng_ni_data_p->rawRequest);
+ loc_eng_ni_data_p->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&loc_eng_ni_data_p->tLock);
+
+ loc_eng_ni_data_p->respTimeLeft = 0;
+ loc_eng_ni_data_p->reqID++;
+
+ if (NULL != msg) {
+ adapter->sendMsg(msg);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+ return NULL;
+}
+
+void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ // only if modem has requested but then died.
+ if (NULL != loc_eng_ni_data_p->rawRequest) {
+ free(loc_eng_ni_data_p->rawRequest);
+ loc_eng_ni_data_p->rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->tLock);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if(callbacks == NULL)
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
+ else if (NULL == callbacks->notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
+ } else if (NULL != loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
+ } else {
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_data_p->respTimeLeft = 0;
+ loc_eng_ni_data_p->respRecvd = FALSE;
+ loc_eng_ni_data_p->rawRequest = NULL;
+ loc_eng_ni_data_p->reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->tLock, NULL);
+
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ EXIT_LOG(%s, VOID_RET);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function receives user response from upper layer framework
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG_CALLFLOW();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif_id == loc_eng_ni_data_p->reqID &&
+ NULL != loc_eng_ni_data_p->rawRequest)
+ {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ pthread_mutex_lock(&loc_eng_ni_data_p->tLock);
+ loc_eng_ni_data_p->resp = user_response;
+ loc_eng_ni_data_p->respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->tLock);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: reqID %d and notif_id %d mismatch or rawRequest %p, response: %d",
+ loc_eng_ni_data_p->reqID, notif_id, loc_eng_ni_data_p->rawRequest, user_response);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_ni.h b/msm8960/loc_api/libloc_api_50001/loc_eng_ni.h
new file mode 100644
index 0000000..9cbc57d
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_ni.h
@@ -0,0 +1,50 @@
+/* Copyright (c) 2009,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 LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <stdbool.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+typedef struct {
+ pthread_t thread; /* NI thread */
+ int respTimeLeft; /* examine time for NI response */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ int reqID; /* ID to check against response */
+ GpsUserResponseType resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+} loc_eng_ni_data_s_type;
+
+
+#endif /* LOC_ENG_NI_H */
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_nmea.cpp
new file mode 100644
index 0000000..3ac722f
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -0,0 +1,724 @@
+/* Copyright (c) 2012, 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng_nmea"
+
+#include <loc_eng.h>
+#include <loc_eng_nmea.h>
+#include <math.h>
+#include "log_util.h"
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_send
+
+DESCRIPTION
+ send out NMEA sentence
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
+{
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ loc_eng_data_p->nmea_cb(now, pNmea, length);
+ LOC_LOGD("NMEA <%s", pNmea);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_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
+
+===========================================================================*/
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 0;
+
+ pNmea++; //skip the $
+ while (*pNmea != '\0')
+ {
+ checksum ^= *pNmea++;
+ length++;
+ }
+
+ int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
+ return (length + checksumLength);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ unsigned char generate_nmea)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ 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;
+
+ if (generate_nmea) {
+ // ------------------
+ // ------$GPGSA------
+ // ------------------
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+ uint32_t mask = loc_eng_data_p->sv_used_mask;
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i;
+ mask = mask >> 1;
+ }
+ // clear the cache so they can't be used again
+ loc_eng_data_p->sv_used_mask = 0;
+
+ char fixType;
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ {
+ 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;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPVTG------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & 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, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPRMC------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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 & 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 & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPGGA------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ gpsQuality = '1'; // 1 means GPS fix
+ else
+ gpsQuality = '2'; // 2 means DGPS fix
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, loc_eng_data_p->hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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 & GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ // clear the dop cache so they can't be used again
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
+ const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ if (svStatus.num_svs <= 0)
+ {
+ // no svs in view, so just send a blank $GPGSV sentence
+ strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ int svCount = svStatus.num_svs;
+ int sentenceCount = svCount / 4;
+ if (svStatus.num_svs % 4)
+ sentenceCount++;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
+ 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 <= svCount) && (i < 4); i++, svNumber++)
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ }
+ }
+
+ if (svStatus.used_in_fix_mask == 0)
+ { // No sv used, so there will be no position report, so send
+ // blank NMEA sentences
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ { // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask;
+
+ // For RPC, the DOP are sent during sv report, so cache them
+ // now to be sent during position report.
+ // For QMI, the DOP will be in position report.
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ loc_eng_data_p->pdop = locationExtended.pdop;
+ loc_eng_data_p->hdop = locationExtended.hdop;
+ loc_eng_data_p->vdop = locationExtended.vdop;
+ }
+ else
+ {
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+ }
+
+ }
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_nmea.h b/msm8960/loc_api/libloc_api_50001/loc_eng_nmea.h
new file mode 100644
index 0000000..40c6dbb
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2012, 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 <hardware/gps.h>
+
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
+
+#endif // LOC_ENG_NMEA_H
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/msm8960/loc_api/libloc_api_50001/loc_eng_xtra.cpp
new file mode 100644
index 0000000..4582286
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -0,0 +1,167 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+struct LocEngRequestXtraServer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngRequestXtraServer(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->requestXtraServer();
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngRequestXtraServer");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInjectXtraData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ char* mData;
+ const int mLen;
+ inline LocEngInjectXtraData(LocEngAdapter* adapter,
+ char* data, int len):
+ LocMsg(), mAdapter(adapter),
+ mData(new char[len]), mLen(len)
+ {
+ memcpy((void*)mData, (void*)data, len);
+ locallog();
+ }
+ inline ~LocEngInjectXtraData()
+ {
+ delete[] mData;
+ }
+ inline virtual void proc() const {
+ mAdapter->setXtraData(mData, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("length: %d\n data: %p", mLen, mData);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks)
+{
+ int ret_val = -1;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
+ } else {
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr->report_xtra_server_cb = callbacks->report_xtra_server_cb;
+
+ ret_val = 0;
+ }
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_inject_data
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+ >0: failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length)
+{
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length));
+
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_request_server
+
+DESCRIPTION
+ Request the Xtra server url from the modem
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ length of server string
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data)
+{
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngRequestXtraServer(adapter));
+
+ return 0;
+
+}
diff --git a/msm8960/loc_api/libloc_api_50001/loc_eng_xtra.h b/msm8960/loc_api/libloc_api_50001/loc_eng_xtra.h
new file mode 100644
index 0000000..175f497
--- /dev/null
+++ b/msm8960/loc_api/libloc_api_50001/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2009,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 LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ report_xtra_server report_xtra_server_cb;
+
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H
diff --git a/msm8960/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/msm8960/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/msm8960/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/msm8960/platform_lib_abstractions/platform_lib_includes.h b/msm8960/platform_lib_abstractions/platform_lib_includes.h
new file mode 100644
index 0000000..5858674
--- /dev/null
+++ b/msm8960/platform_lib_abstractions/platform_lib_includes.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_INCLUDES_H_
+#define _PLATFORM_LIB_INCLUDES_H_
+
+#include "platform_lib_time.h"
+#include "platform_lib_macros.h"
+
+#endif
diff --git a/msm8960/platform_lib_abstractions/platform_lib_macros.h b/msm8960/platform_lib_abstractions/platform_lib_macros.h
new file mode 100644
index 0000000..bc48dd9
--- /dev/null
+++ b/msm8960/platform_lib_abstractions/platform_lib_macros.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#include <sys/time.h>
+
+#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); \
+}
+
+
+#ifdef USE_GLIB
+
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+
+#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)
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
+
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
+
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+pid_t gettid(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
+
+#endif
+
+#endif
diff --git a/msm8960/platform_lib_abstractions/platform_lib_time.h b/msm8960/platform_lib_abstractions/platform_lib_time.h
new file mode 100644
index 0000000..ce013af
--- /dev/null
+++ b/msm8960/platform_lib_abstractions/platform_lib_time.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_TIME_H_
+#define _PLATFORM_LIB_TIME_H_
+
+int64_t systemTime(int clock);
+int64_t elapsedMillisSinceBoot();
+
+#endif
diff --git a/msm8960/utils/Android.mk b/msm8960/utils/Android.mk
new file mode 100644
index 0000000..18c7ccc
--- /dev/null
+++ b/msm8960/utils/Android.mk
@@ -0,0 +1,54 @@
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ loc_timer.c \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
+
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+LOCAL_LDFLAGS += -Wl,--export-dynamic
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/../platform_lib_abstractions
+
+LOCAL_COPY_HEADERS_TO:= gps.utils/
+LOCAL_COPY_HEADERS:= \
+ loc_log.h \
+ loc_cfg.h \
+ log_util.h \
+ linked_list.h \
+ msg_q.h \
+ loc_target.h \
+ loc_timer.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
+
+
+LOCAL_MODULE := libgps.utils
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
+include $(BUILD_SHARED_LIBRARY)
diff --git a/msm8960/utils/Makefile.am b/msm8960/utils/Makefile.am
new file mode 100644
index 0000000..e5935f0
--- /dev/null
+++ b/msm8960/utils/Makefile.am
@@ -0,0 +1,44 @@
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I../platform_lib_abstractions
+
+libgps_utils_so_la_h_sources = log_util.h \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
+
+libgps_utils_so_la_c_sources = linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
+
+library_includedir = $(pkgincludedir)/utils
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lstdc++ -lcutils
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
diff --git a/msm8960/utils/linked_list.c b/msm8960/utils/linked_list.c
new file mode 100644
index 0000000..92617fe
--- /dev/null
+++ b/msm8960/utils/linked_list.c
@@ -0,0 +1,328 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include <stdlib.h>
+#include <stdint.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*))
+{
+ LOC_LOGD("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, 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;
+ 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)
+{
+ LOC_LOGD("%s: Removing from list\n", __FUNCTION__);
+ 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)
+{
+ LOC_LOGD("%s: Search the list\n", __FUNCTION__);
+ 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/msm8960/utils/linked_list.h b/msm8960/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/msm8960/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/msm8960/utils/loc_cfg.cpp b/msm8960/utils/loc_cfg.cpp
new file mode 100644
index 0000000..73d1ca4
--- /dev/null
+++ b/msm8960/utils/loc_cfg.cpp
@@ -0,0 +1,286 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 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 <loc_cfg.h>
+#include <log_util.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint8_t DEBUG_LEVEL = 0xff;
+static uint8_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static loc_param_s_type loc_parameter_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
+};
+int loc_param_num = sizeof(loc_parameter_table) / sizeof(loc_param_s_type);
+
+/*===========================================================================
+FUNCTION trim_space
+
+DESCRIPTION
+ Removes leading and trailing spaces of the string
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void trim_space(char *org_string)
+{
+ char *scan_ptr, *write_ptr;
+ char *first_nonspace = NULL, *last_nonspace = NULL;
+
+ scan_ptr = write_ptr = org_string;
+
+ while (*scan_ptr)
+ {
+ if ( !isspace(*scan_ptr) && first_nonspace == NULL)
+ {
+ first_nonspace = scan_ptr;
+ }
+
+ if (first_nonspace != NULL)
+ {
+ *(write_ptr++) = *scan_ptr;
+ if ( !isspace(*scan_ptr))
+ {
+ last_nonspace = write_ptr;
+ }
+ }
+
+ scan_ptr++;
+ }
+
+ if (last_nonspace) { *last_nonspace = '\0'; }
+}
+
+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;
+
+/*===========================================================================
+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
+===========================================================================*/
+void loc_set_config_entry(loc_param_s_type* config_entry, loc_param_v_type* config_value)
+{
+ if(NULL == config_entry || NULL == config_value)
+ {
+ LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__);
+ return;
+ }
+
+ 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 + 1);
+ }
+ /* 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;
+ }
+ 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;
+ }
+ 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;
+ }
+ break;
+ default:
+ LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s", __FUNCTION__, config_entry->param_name);
+ }
+ }
+}
+
+/*===========================================================================
+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, loc_param_s_type* config_table, uint32_t table_length)
+{
+ FILE *gps_conf_fp = NULL;
+ char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ if((gps_conf_fp = fopen(conf_file_name, "r")) != NULL)
+ {
+ LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name);
+ }
+ else
+ {
+ LOC_LOGW("%s: no %s file found", __FUNCTION__, conf_file_name);
+ loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
+ return; /* no parameter file */
+ }
+
+ /* Clear all validity bits */
+ for(i = 0; NULL != config_table && i < table_length; i++)
+ {
+ if(NULL != config_table[i].param_set)
+ {
+ *(config_table[i].param_set) = 0;
+ }
+ }
+
+ while(fgets(input_buf, LOC_MAX_PARAM_LINE, gps_conf_fp) != NULL)
+ {
+ memset(&config_value, 0, sizeof(config_value));
+
+ /* Separate variable and value */
+ config_value.param_name = strtok_r(input_buf, "=", &lasts);
+ if (config_value.param_name == NULL) continue; /* skip lines that do not contain "=" */
+ config_value.param_str_value = strtok_r(NULL, "=", &lasts);
+ if (config_value.param_str_value == NULL) continue; /* skip lines that do not contain two operands */
+
+ /* Trim leading and trailing spaces */
+ trim_space(config_value.param_name);
+ trim_space(config_value.param_str_value);
+
+ /* Parse numerical value */
+ if (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(i = 0; NULL != config_table && i < table_length; i++)
+ {
+ loc_set_config_entry(&config_table[i], &config_value);
+ }
+
+ for(i = 0; i < loc_param_num; i++)
+ {
+ loc_set_config_entry(&loc_parameter_table[i], &config_value);
+ }
+ }
+
+ fclose(gps_conf_fp);
+
+ /* Initialize logging mechanism with parsed data */
+ loc_logger_init(DEBUG_LEVEL, TIMESTAMP);
+}
diff --git a/msm8960/utils/loc_cfg.h b/msm8960/utils/loc_cfg.h
new file mode 100644
index 0000000..df83338
--- /dev/null
+++ b/msm8960/utils/loc_cfg.h
@@ -0,0 +1,83 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_CFG_H
+#define LOC_CFG_H
+
+#include <stdint.h>
+
+#define LOC_MAX_PARAM_NAME 48
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE 80
+
+#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
+{
+ char param_name[LOC_MAX_PARAM_NAME];
+ void *param_ptr;
+ uint8_t *param_set; /* was this value set by config file? */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for float */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_read_conf(const char* conf_file_name,
+ loc_param_s_type* config_table,
+ uint32_t table_length);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/msm8960/utils/loc_log.cpp b/msm8960/utils/loc_log.cpp
new file mode 100644
index 0000000..e7f34e7
--- /dev/null
+++ b/msm8960/utils/loc_log.cpp
@@ -0,0 +1,235 @@
+/* Copyright (c) 2011-2012, 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_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#ifdef USE_GLIB
+#include <time.h>
+#endif /* USE_GLIB */
+#include "log_util.h"
+#include "platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_msg_q_status_num = sizeof(loc_msg_q_status) / sizeof(loc_name_val_s_type);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+loc_name_val_s_type target_name[] =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_GRIFFON),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index >= target_name_num || index < 0)
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ sprintf(ret, " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ sprintf(ret, " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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, unsigned long 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void loc_logger_init(unsigned long debug, unsigned long timestamp)
+{
+ loc_logger.DEBUG_LEVEL = debug;
+ loc_logger.TIMESTAMP = timestamp;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/msm8960/utils/loc_log.h b/msm8960/utils/loc_log.h
new file mode 100644
index 0000000..82dc636
--- /dev/null
+++ b/msm8960/utils/loc_log.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2011-2012, 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
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ char name[128];
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#define CHECK_MASK(type, value, mask_var, mask) \
+ ((mask_var & mask) ? (type) value : (type) (-1))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask);
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, unsigned long buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/msm8960/utils/loc_target.cpp b/msm8960/utils/loc_target.cpp
new file mode 100644
index 0000000..3595b6a
--- /dev/null
+++ b/msm8960/utils/loc_target.cpp
@@ -0,0 +1,127 @@
+/* Copyright (c) 2012, 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 <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <hardware/gps.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include "log_util.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 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 int gss_fd = 0;
+
+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);
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+unsigned int get_target(void)
+{
+ unsigned int target = TARGET_DEFAULT;
+
+ char hw_platform[] = "/sys/devices/system/soc/soc0/hw_platform";
+ char id[] = "/sys/devices/system/soc/soc0/id";
+ char mdm[] = "/dev/mdm"; // No such file or directory
+
+ char rd_hw_platform[LINE_LEN];
+ char rd_id[LINE_LEN];
+ char rd_mdm[LINE_LEN];
+ char baseband[LINE_LEN];
+
+ property_get("ro.baseband", baseband, "");
+ read_a_line(hw_platform, rd_hw_platform, LINE_LEN);
+ read_a_line( id, rd_id, LINE_LEN);
+
+ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
+ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
+ && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
+ target = TARGET_MPQ;
+ else
+ target = 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)]))) {
+
+ if (!read_a_line( mdm, rd_mdm, LINE_LEN))
+ target = 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)])) )
+ target = TARGET_MSM_NO_SSC;
+ }
+ return target;
+}
diff --git a/msm8960/utils/loc_target.h b/msm8960/utils/loc_target.h
new file mode 100644
index 0000000..12cff1d
--- /dev/null
+++ b/msm8960/utils/loc_target.h
@@ -0,0 +1,64 @@
+/* Copyright (c) 2012, 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_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
+#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
+#define getTargetGnssType(target) (target>>1)
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+unsigned int get_target(void);
+
+typedef enum {
+ GNSS_NONE = 0,
+ GNSS_MSM,
+ GNSS_GSS,
+ GNSS_MDM,
+ GNSS_GRIFFON,
+ GNSS_UNKNOWN
+}GNSS_TARGET;
+
+typedef enum {
+ NO_SSC = 0,
+ HAS_SSC
+}SSC_TYPE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*LOC_TARGET_H*/
diff --git a/msm8960/utils/loc_timer.c b/msm8960/utils/loc_timer.c
new file mode 100644
index 0000000..13f7786
--- /dev/null
+++ b/msm8960/utils/loc_timer.c
@@ -0,0 +1,157 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<sys/time.h>
+#include "loc_timer.h"
+#include<time.h>
+#include<errno.h>
+
+#define MAX_DELAY_RETRIES 3
+
+typedef struct {
+ loc_timer_callback callback_func;
+ void *user_data;
+ unsigned int time_msec;
+}timer_data;
+
+static void *timer_thread(void *thread_data)
+{
+ int ret;
+ unsigned char retries=0;
+ struct timespec ts;
+ struct timeval tv;
+ timer_data t;
+ t.callback_func = ((timer_data *)thread_data)->callback_func;
+ t.user_data = ((timer_data *)thread_data)->user_data;
+ t.time_msec = ((timer_data *)thread_data)->time_msec;
+ pthread_cond_t timer_cond;
+ pthread_mutex_t timer_mutex;
+
+ LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t.time_msec);
+ //Copied over all info into local variable. Do not need allocated struct
+ free(thread_data);
+
+ if(pthread_cond_init(&timer_cond, NULL)) {
+ LOC_LOGE("%s:%d]: Pthread cond init failed\n", __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+ if(pthread_mutex_init(&timer_mutex, NULL)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ ret = -1;
+ goto mutex_err;
+ }
+ while(retries < MAX_DELAY_RETRIES) {
+ gettimeofday(&tv, NULL);
+ clock_gettime(CLOCK_REALTIME, &ts);
+ if(t.time_msec >= 1000) {
+ ts.tv_sec += t.time_msec/1000;
+ t.time_msec = t.time_msec % 1000;
+ }
+ if(t.time_msec)
+ ts.tv_nsec += t.time_msec * 1000000;
+ if(ts.tv_nsec > 999999999) {
+ LOC_LOGD("%s:%d]: Large nanosecs\n", __func__, __LINE__);
+ ts.tv_sec += 1;
+ ts.tv_nsec -= 1000000000;
+ }
+ LOC_LOGD("%s:%d]: ts.tv_sec:%d; ts.tv_nsec:%d\n",
+ __func__, __LINE__, (int)ts.tv_sec, (int)ts.tv_nsec);
+ LOC_LOGD("%s:%d]: Current time: %d sec; %d nsec\n",
+ __func__, __LINE__, (int)tv.tv_sec, (int)tv.tv_usec*1000);
+ pthread_mutex_lock(&(timer_mutex));
+ ret = pthread_cond_timedwait(&timer_cond, &timer_mutex, &ts);
+ pthread_mutex_unlock(&(timer_mutex));
+ if(ret != ETIMEDOUT) {
+ LOC_LOGE("%s:%d]: Call to pthread timedwait failed; ret=%d\n",
+ __func__, __LINE__,ret);
+ ret = -1;
+ retries++;
+ }
+ else {
+ ret = 0;
+ break;
+ }
+ }
+
+ pthread_mutex_destroy(&timer_mutex);
+mutex_err:
+ pthread_cond_destroy(&timer_cond);
+err:
+ if(!ret)
+ t.callback_func(t.user_data, ret);
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return NULL;
+}
+
+int loc_timer_start(unsigned int msec, loc_timer_callback cb_func,
+ void* caller_data)
+{
+ int ret=0;
+ timer_data *t=NULL;
+ pthread_attr_t tattr;
+ pthread_t id;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ if(cb_func == NULL || msec == 0) {
+ LOC_LOGE("%s:%d]: Error: Wrong parameters\n", __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+ t = (timer_data *)calloc(1, sizeof(timer_data));
+ if(t == NULL) {
+ LOC_LOGE("%s:%d]: Could not allocate memory. Failing.\n",
+ __func__, __LINE__);
+ ret = -1;
+ goto err;
+ }
+
+ t->callback_func = cb_func;
+ t->user_data = caller_data;
+ t->time_msec = msec;
+
+ pthread_attr_init(&tattr);
+ pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+ if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) {
+ LOC_LOGE("%s:%d]: Could not create thread\n", __func__, __LINE__);
+ ret = -1;
+ goto attr_err;
+ }
+ else {
+ LOC_LOGD("%s:%d]: Created thread with id: %d\n",
+ __func__, __LINE__, (int)id);
+ }
+
+attr_err:
+ pthread_attr_destroy(&tattr);
+err:
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return ret;
+}
diff --git a/msm8960/utils/loc_timer.h b/msm8960/utils/loc_timer.h
new file mode 100644
index 0000000..213da20
--- /dev/null
+++ b/msm8960/utils/loc_timer.h
@@ -0,0 +1,54 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_DELAY_H__
+#define __LOC_DELAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#include<pthread.h>
+#include "log_util.h"
+
+/*
+ Return values:
+ Success = 0
+ Failure = Non zero
+*/
+typedef void(*loc_timer_callback)(void *user_data, int result);
+
+//int loc_timer_start(loc_timer_client_data *p_thread);
+int loc_timer_start(unsigned int delay_msec,
+ loc_timer_callback,
+ void* user_data);
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_DELAY_H__
diff --git a/msm8960/utils/log_util.h b/msm8960/utils/log_util.h
new file mode 100644
index 0000000..412a1dc
--- /dev/null
+++ b/msm8960/utils/log_util.h
@@ -0,0 +1,171 @@
+/* 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 __LOG_UTIL_H__
+#define __LOG_UTIL_H__
+
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#endif /* USE_GLIB */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define LOC_LOGE(...) \
+if ((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("W/" __VA_ARGS__); }
+
+#define LOC_LOGW(...) \
+if ((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); }
+
+#define LOC_LOGI(...) \
+if ((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("I/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); }
+
+#define LOC_LOGD(...) \
+if ((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("D/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); }
+
+#define LOC_LOGV(...) \
+if ((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("V/" __VA_ARGS__); } \
+else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE("E/"__VA_ARGS__)
+
+#define LOC_LOGW(...) ALOGW("W/"__VA_ARGS__)
+
+#define LOC_LOGI(...) ALOGI("I/"__VA_ARGS__)
+
+#define LOC_LOGD(...) ALOGD("D/"__VA_ARGS__)
+
+#define LOC_LOGV(...) ALOGV("V/"__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 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 ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL)
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __func__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __func__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __func__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __func__, 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/msm8960/utils/msg_q.c b/msm8960/utils/msg_q.c
new file mode 100644
index 0000000..f82d4c0
--- /dev/null
+++ b/msm8960/utils/msg_q.c
@@ -0,0 +1,336 @@
+/* Copyright (c) 2011-2012, 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 "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.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_LOGD("%s: Sending message with handle = 0x%08X\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_LOGD("%s: Finished Sending message with handle = 0x%08X\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;
+
+ LOC_LOGD("%s: Waiting on message\n", __FUNCTION__);
+
+ 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_LOGD("%s: Received message 0x%08X 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/msm8960/utils/msg_q.h b/msm8960/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/msm8960/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/msm8994/Android.mk b/msm8994/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/msm8994/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/msm8994/Makefile.am b/msm8994/Makefile.am
new file mode 100644
index 0000000..f374a5c
--- /dev/null
+++ b/msm8994/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am - Automake script for gps loc_api
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = utils loc_api/libloc_api_50001 loc_api/loc_api_v02
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/msm8994/configure.ac b/msm8994/configure.ac
new file mode 100644
index 0000000..dca18a1
--- /dev/null
+++ b/msm8994/configure.ac
@@ -0,0 +1,85 @@
+# configure.ac -- Autoconf script for gps loc_api
+#
+# 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 package version 1.0.0
+AC_INIT([loc-api],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([utils/loc_cfg.cpp])
+# 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([QMIF], [qmi-framework])
+AC_SUBST([QMIF_CFLAGS])
+AC_SUBST([QMIF_LIBS])
+
+AC_ARG_WITH([libhardware_includes],
+ AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@],
+ [Specify the location of the libhardware headers]),
+ [libhardware_incdir=$withval],
+ with_libhardware_includes=no)
+
+if test "x$with_libhardware_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${libhardware_incdir}"
+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_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 \
+ utils/Makefile \
+ loc_api/libloc_api_50001/Makefile \
+ loc_api/loc_api_v02/Makefile \
+ loc-api.pc \
+ ])
+
+AC_OUTPUT
diff --git a/msm8994/core/Android.mk b/msm8994/core/Android.mk
new file mode 100644
index 0000000..46d5343
--- /dev/null
+++ b/msm8994/core/Android.mk
@@ -0,0 +1,61 @@
+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_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+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 \
+ liblog \
+ libcutils \
+ libgps.utils \
+ libdl
+
+LOCAL_SRC_FILES += \
+ MsgTask.cpp \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils
+
+LOCAL_COPY_HEADERS_TO:= libloc_core/
+LOCAL_COPY_HEADERS:= \
+ MsgTask.h \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ LBSProxyBase.h \
+ UlpProxyBase.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8994/core/ContextBase.cpp b/msm8994/core/ContextBase.cpp
new file mode 100644
index 0000000..9f6c4aa
--- /dev/null
+++ b/msm8994/core/ContextBase.cpp
@@ -0,0 +1,114 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+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)();
+ }
+ }
+ 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;
+
+ // first if can not be MPQ
+ if (TARGET_MPQ != loc_get_target()) {
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask, 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)(mMsgTask, exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, 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())
+{
+}
+
+}
diff --git a/msm8994/core/ContextBase.h b/msm8994/core/ContextBase.h
new file mode 100644
index 0000000..ff7a4b3
--- /dev/null
+++ b/msm8994/core/ContextBase.h
@@ -0,0 +1,71 @@
+/* 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 __LOC_CONTEXT_BASE__
+#define __LOC_CONTEXT_BASE__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <MsgTask.h>
+#include <LocApiBase.h>
+#include <LBSProxyBase.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class ContextBase {
+ static LBSProxyBase* getLBSProxy(const char* libName);
+ LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
+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() { delete mLocApi; delete mLBSProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+ inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mLBSProxy->requestUlp(adapter, capabilities);
+ }
+ inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/msm8994/core/LBSProxyBase.h b/msm8994/core/LBSProxyBase.h
new file mode 100644
index 0000000..75ae992
--- /dev/null
+++ b/msm8994/core/LBSProxyBase.h
@@ -0,0 +1,64 @@
+/* Copyright (c) 2013-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 IZAT_PROXY_BASE_H
+#define IZAT_PROXY_BASE_H
+#include <gps_extended.h>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {}
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual bool hasCPIExtendedCapabilities() const { return false; }
+ inline virtual void modemPowerVote(bool power) const {}
+ virtual void injectFeatureConfig(ContextBase* context) const {}
+};
+
+typedef LBSProxyBase* (getLBSProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/msm8994/core/LocAdapterBase.cpp b/msm8994/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..fe0972c
--- /dev/null
+++ b/msm8994/core/LocAdapterBase.cpp
@@ -0,0 +1,141 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 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, LocAdapterProxyBase *adapterProxyBase) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask())
+{
+ mLocApi->addAdapter(this);
+}
+
+void LocAdapterBase::handleEngineUpEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineUpEvent();
+ }
+}
+
+void LocAdapterBase::handleEngineDownEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineDownEvent();
+ }
+}
+
+void LocAdapterBase::
+ reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ if (mLocAdapterProxyBase == NULL ||
+ !mLocAdapterProxyBase->reportPosition(location,
+ status,
+ loc_technology_mask)) {
+ DEFAULT_IMPL()
+ }
+}
+
+void LocAdapterBase::
+ reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportStatus(GpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmea(const char* nmea, int length)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestXtraData()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestTime()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestLocation()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestATL(int connHandle, AGpsType agps_type)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotify(GpsNiNotification ¬ify, const void* data)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportGpsMeasurementData(GpsData &gpsMeasurementData)
+DEFAULT_IMPL()
+} // namespace loc_core
diff --git a/msm8994/core/LocAdapterBase.h b/msm8994/core/LocAdapterBase.h
new file mode 100644
index 0000000..f8fdc48
--- /dev/null
+++ b/msm8994/core/LocAdapterBase.h
@@ -0,0 +1,119 @@
+/* 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 LOC_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+protected:
+ LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ 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 isEnabled)
+ {
+ mEvtMask =
+ isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event);
+
+ mLocApi->updateEvtMask();
+ }
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeInt(LocPosMode& posMode) {}
+ virtual void startFixInt() {}
+ virtual void stopFixInt() {}
+ virtual void getZppInt() {}
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotify(GpsNiNotification ¬ify,
+ const void* data);
+ inline virtual bool isInSession() { return false; }
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/msm8994/core/LocAdapterProxyBase.h b/msm8994/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..f6c22af
--- /dev/null
+++ b/msm8994/core/LocAdapterProxyBase.h
@@ -0,0 +1,69 @@
+/* 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_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):
+ mLocAdapterBase(new LocAdapterBase(mask, context, this)) {
+ }
+ inline virtual ~LocAdapterProxyBase() {
+ delete mLocAdapterBase;
+ }
+ ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
+ inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled) {
+ mLocAdapterBase->updateEvtMask(event,isEnabled);
+ }
+
+public:
+ inline virtual void handleEngineUpEvent() {};
+ inline virtual void handleEngineDownEvent() {};
+ inline virtual bool reportPosition(UlpLocation &location,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif //LOC_ADAPTER_PROXY_BASE_H
diff --git a/msm8994/core/LocApiBase.cpp b/msm8994/core/LocApiBase.cpp
new file mode 100644
index 0000000..f56694e
--- /dev/null
+++ b/msm8994/core/LocApiBase.cpp
@@ -0,0 +1,545 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <log_util.h>
+#include <LocDualContext.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ inline LocOpenMsg(LocApiBase* locApi,
+ LOC_API_ADAPTER_EVENT_MASK_T mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->open(mMask);
+ }
+ inline void locallog() {
+ LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
+ __func__, __LINE__, mMask);
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask),
+ mMask(0), mSupportedMsg(0), mContext(context)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ mMsgTask->sendMsg(new LocOpenMsg(this,
+ (adapter->getEvtMask())));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ }
+ }
+ }
+}
+
+void LocApiBase::updateEvtMask()
+{
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ LocDualContext::injectFeatureConfig(mContext);
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
+}
+
+void LocApiBase::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ // print the location info before delivering
+ LOC_LOGV("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: %lld\n rawDataSize: %d\n rawData: %p\n "
+ "Session status: %d\n Technology mask: %u",
+ 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, location.rawDataSize,
+ location.rawData, status, loc_technology_mask);
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask)
+ );
+}
+
+void LocApiBase::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+ // print the SV info before delivering
+ LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n used"
+ " in fix mask: %x\n sv: prn snr elevation azimuth",
+ svStatus.num_svs, svStatus.ephemeris_mask,
+ svStatus.almanac_mask, svStatus.used_in_fix_mask);
+ for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" %d: %d %f %f %f",
+ i,
+ svStatus.sv_list[i].prn,
+ svStatus.sv_list[i].snr,
+ svStatus.sv_list[i].elevation,
+ svStatus.sv_list[i].azimuth);
+ }
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSv(svStatus,
+ locationExtended,
+ svExt)
+ );
+}
+
+void LocApiBase::reportStatus(GpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+void LocApiBase::reportNmea(const char* nmea, int length)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmea(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::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, AGpsType agps_type)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
+}
+
+void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
+{
+ mSupportedMsg = supportedMsgList;
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ deleteAidingData(GpsAidingData f)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int enable)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* apn, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double latitude, double longitude, float accuracy)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, AGpsType agpsType)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int handle, int is_succ)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(const char* url, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSUPLVersion(uint32_t version)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setLPPConfig(uint32_t profile)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage,
+ int sensorProvider)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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)
+
+enum loc_api_adapter_err LocApiBase::
+ setExtPowerConfig(int isBatteryCharging)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ initDataServiceClient()
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+int LocApiBase::
+ setGpsLock(LOC_GPS_LOCK_MASK lock)
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+DEFAULT_IMPL()
+
+int LocApiBase::
+ getGpsLock()
+DEFAULT_IMPL(-1)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraVersionCheck(enum xtra_version_check check)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+DEFAULT_IMPL(-1)
+
+bool LocApiBase::
+ gnssConstellationConfig()
+DEFAULT_IMPL(false)
+
+} // namespace loc_core
diff --git a/msm8994/core/LocApiBase.h b/msm8994/core/LocApiBase.h
new file mode 100644
index 0000000..414769b
--- /dev/null
+++ b/msm8994/core/LocApiBase.h
@@ -0,0 +1,261 @@
+/* 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 LOC_API_BASE_H
+#define LOC_API_BASE_H
+
+#include <stddef.h>
+#include <ctype.h>
+#include <gps_extended.h>
+#include <MsgTask.h>
+#include <log_util.h>
+
+namespace loc_core {
+class ContextBase;
+
+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 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;
+
+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 class ContextBase;
+ const MsgTask* mMsgTask;
+ ContextBase *mContext;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+ uint64_t mSupportedMsg;
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+
+ void addAdapter(LocAdapterBase* adapter);
+ void removeAdapter(LocAdapterBase* adapter);
+
+ // upward calls
+ void handleEngineUpEvent();
+ void handleEngineDownEvent();
+ void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask =
+ LOC_POS_TECH_MASK_DEFAULT);
+ void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ void reportStatus(GpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, AGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ void saveSupportedMsgList(uint64_t supportedMsgList);
+ void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging);
+ virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol);
+ virtual enum loc_api_adapter_err
+ getWwanZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient();
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+ virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+ inline virtual void setInSession(bool inSession) {}
+ inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
+ if (msgID > (sizeof(mSupportedMsg) << 3)) {
+ return false;
+ } else {
+ uint32_t messageChecker = 1 << msgID;
+ return (messageChecker & mSupportedMsg) == messageChecker;
+ }
+ }
+ void updateEvtMask();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+
+ virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check);
+
+ /*
+ Update gps reporting events
+ */
+ virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+ /*
+ Check if the modem support the service
+ */
+ virtual bool gnssConstellationConfig();
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/msm8994/core/LocDualContext.cpp b/msm8994/core/LocDualContext.cpp
new file mode 100644
index 0000000..d68cb3b
--- /dev/null
+++ b/msm8994/core/LocDualContext.cpp
@@ -0,0 +1,183 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+ContextBase* LocDualContext::mInjectContext = NULL;
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
+
+pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
+
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name);
+ }
+ return mMsgTask;
+}
+
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tAssociate, name);
+ } else if (tAssociate) {
+ mMsgTask->associate(tAssociate);
+ }
+ return mMsgTask;
+}
+
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tAssociate", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tAssociate", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mBgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tAssociate", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tAssociate", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mBgContext;
+}
+
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Enter", __func__, __LINE__);
+ if(curContext == mInjectContext) {
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+ }
+ LOC_LOGD("%s:%d]: Exit", __func__, __LINE__);
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mLBSLibName)
+{
+}
+
+}
diff --git a/msm8994/core/LocDualContext.h b/msm8994/core/LocDualContext.h
new file mode 100644
index 0000000..1e96ea5
--- /dev/null
+++ b/msm8994/core/LocDualContext.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+ static ContextBase* mInjectContext;
+ static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
+ const char* name);
+ static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static pthread_mutex_t mGetLocContextMutex;
+
+protected:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tCreate tCreator,
+ const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
+ static void injectFeatureConfig(ContextBase *context);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/msm8994/core/MsgTask.cpp b/msm8994/core/MsgTask.cpp
new file mode 100644
index 0000000..5d375aa
--- /dev/null
+++ b/msm8994/core/MsgTask.cpp
@@ -0,0 +1,147 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+#define MAX_TASK_COMM_LEN 15
+
+static void LocMsgDestroy(void* msg) {
+ delete (LocMsg*)msg;
+}
+
+MsgTask::MsgTask(tCreate tCreator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(NULL){
+ if (tCreator) {
+ tCreator(threadName, loopMain,
+ (void*)new MsgTask(mQ, mAssociator));
+ } else {
+ createPThread(threadName);
+ }
+}
+
+MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) :
+ mQ(msg_q_init2()), mAssociator(tAssociator){
+ createPThread(threadName);
+}
+
+inline
+MsgTask::MsgTask(const void* q, tAssociate associator) :
+ mQ(q), mAssociator(associator){
+}
+
+MsgTask::~MsgTask() {
+ msg_q_unblock((void*)mQ);
+}
+
+void MsgTask::associate(tAssociate tAssociator) const {
+ struct LocAssociateMsg : public LocMsg {
+ tAssociate mAssociator;
+ inline LocAssociateMsg(tAssociate associator) :
+ LocMsg(), mAssociator(associator) {}
+ inline virtual void proc() const {
+ if (mAssociator) {
+ LOC_LOGD("MsgTask::associate");
+ mAssociator();
+ }
+ }
+ };
+ sendMsg(new LocAssociateMsg(tAssociator));
+}
+
+void MsgTask::createPThread(const char* threadName) {
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+ pthread_t tid;
+ // create the thread here, then if successful
+ // and a name is given, we set the thread name
+ if (!pthread_create(&tid, &attr, loopMain,
+ (void*)new MsgTask(mQ, mAssociator)) &&
+ NULL != threadName) {
+ char lname[MAX_TASK_COMM_LEN+1];
+ memcpy(lname, threadName, MAX_TASK_COMM_LEN);
+ lname[MAX_TASK_COMM_LEN] = 0;
+ pthread_setname_np(tid, lname);
+ }
+}
+
+void MsgTask::sendMsg(const LocMsg* msg) const {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void* MsgTask::loopMain(void* arg) {
+ MsgTask* copy = (MsgTask*)arg;
+
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+
+ if (NULL != copy->mAssociator) {
+ copy->mAssociator();
+ }
+
+ LocMsg* msg;
+ int cnt = 0;
+
+ while (1) {
+ LOC_LOGD("MsgTask::loop() %d listening ...\n", cnt++);
+
+ msq_q_err_type result = msg_q_rcv((void*)copy->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));
+ // destroy the Q and exit
+ msg_q_destroy((void**)&(copy->mQ));
+ delete copy;
+ return NULL;
+ }
+
+ msg->log();
+ // there is where each individual msg handling is invoked
+ msg->proc();
+
+ delete msg;
+ }
+
+ delete copy;
+
+ return NULL;
+}
+
+}
diff --git a/msm8994/core/MsgTask.h b/msm8994/core/MsgTask.h
new file mode 100644
index 0000000..d50bb31
--- /dev/null
+++ b/msm8994/core/MsgTask.h
@@ -0,0 +1,67 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef __MSG_TASK__
+#define __MSG_TASK__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <pthread.h>
+
+namespace loc_core {
+
+struct LocMsg {
+ inline LocMsg() {}
+ inline virtual ~LocMsg() {}
+ virtual void proc() const = 0;
+ inline virtual void log() const {}
+};
+
+class MsgTask {
+public:
+ typedef void* (*tStart)(void*);
+ typedef pthread_t (*tCreate)(const char* name, tStart start, void* arg);
+ typedef int (*tAssociate)();
+ MsgTask(tCreate tCreator, const char* threadName);
+ MsgTask(tAssociate tAssociator, const char* threadName);
+ ~MsgTask();
+ void sendMsg(const LocMsg* msg) const;
+ void associate(tAssociate tAssociator) const;
+
+private:
+ const void* mQ;
+ tAssociate mAssociator;
+ MsgTask(const void* q, tAssociate associator);
+ static void* loopMain(void* copy);
+ void createPThread(const char* name);
+};
+
+} // namespace loc_core
+
+#endif //__MSG_TASK__
diff --git a/msm8994/core/UlpProxyBase.h b/msm8994/core/UlpProxyBase.h
new file mode 100644
index 0000000..b9a8224
--- /dev/null
+++ b/msm8994/core/UlpProxyBase.h
@@ -0,0 +1,85 @@
+/* Copyright (c) 2013-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 ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ LocPosMode mPosMode;
+ bool mFixSet;
+ inline UlpProxyBase() {
+ mPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mFixSet = false;
+ }
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { mFixSet = true; return false; }
+ inline virtual bool sendStopFix() { mFixSet = false; return false; }
+ inline virtual bool sendFixMode(LocPosMode ¶ms) {
+ mPosMode = params;
+ return false;
+ }
+
+ inline virtual bool reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
+ }
+ inline virtual bool reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt) {
+ return false;
+ }
+ inline virtual bool reportStatus(GpsStatusValue status) {
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* adapter) {}
+ inline virtual void setCapabilities(unsigned long capabilities) {}
+ inline virtual bool reportBatchingSession(GpsExtBatchOptions &options,
+ bool active) {
+ return false;
+ }
+ inline virtual bool reportPositions(GpsExtLocation * locations,
+ int32_t number_of_locations,
+ enum loc_sess_status status,
+ LocPosTechMask techMask) {
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/msm8994/core/gps_extended.h b/msm8994/core/gps_extended.h
new file mode 100644
index 0000000..88b0415
--- /dev/null
+++ b/msm8994/core/gps_extended.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gps_extended_c.h>
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ GpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ char credentials[14];
+ char provider[8];
+ LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ const char* cred, const char* prov) :
+ mode(m), recurrence(recr),
+ min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
+ preferred_accuracy(accu), preferred_time(time) {
+ 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(GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(MIN_POSSIBLE_FIX_INTERVAL),
+ preferred_accuracy(50), preferred_time(120000) {
+ 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 &&
+ !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/msm8994/core/gps_extended_c.h b/msm8994/core/gps_extended_c.h
new file mode 100644
index 0000000..63fb6cf
--- /dev/null
+++ b/msm8994/core/gps_extended_c.h
@@ -0,0 +1,427 @@
+/* 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 GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <hardware/gps.h>
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** GpsLocation has valid "is indoor?" flag */
+#define GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** GpsLocation has valid floor number */
+#define GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** GpsLocation has valid map URL*/
+#define GPS_LOCATION_HAS_MAP_URL 0x0100
+/** GpsLocation has valid map index */
+#define GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+/** 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 source is ZPP only */
+#define ULP_LOCATION_IS_FROM_ZPP 0x0004
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+/** Positioin is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+#define ULP_LOCATION_IS_FROM_NLP 0x0020
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+
+/*Emergency SUPL*/
+#define GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+#define AGPS_CERTIFICATE_MAX_LENGTH 2000
+#define AGPS_CERTIFICATE_MAX_SLOTS 10
+
+/** Batching default ID for dummy batching session*/
+#define GPS_BATCHING_DEFAULT_ID 1
+
+/** This cap is used to decide the FLP session cache
+size on AP. If the BATCH_SIZE in flp.conf is less than
+GPS_AP_BATCHING_SIZE_CAP, FLP session cache size will
+be twice the BATCH_SIZE defined in flp.conf. Otherwise,
+FLP session cache size will be equal to the BATCH_SIZE.*/
+#define GPS_AP_BATCHING_SIZE_CAP 40
+
+#define GPS_BATCHING_OPERATION_SUCCEESS 1
+#define GPS_BATCHING_OPERATION_FAILURE 0
+
+/** GPS extended batching flags*/
+#define GPS_EXT_BATCHING_ON_FULL 0x0000001
+#define GPS_EXT_BATCHING_ON_FIX 0x0000002
+
+/** Reasons of GPS reports batched locations*/
+typedef enum loc_batching_reported_type {
+ LOC_BATCHING_ON_FULL_IND_REPORT,
+ LOC_BATCHING_ON_FIX_IND_REPORT,
+ LOC_BATCHING_ON_QUERY_REPORT
+}LocBatchingReportedType;
+
+enum loc_registration_mask_status {
+ LOC_REGISTRATION_MASK_ENABLED,
+ LOC_REGISTRATION_MASK_DISABLED
+};
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ GpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+/** AGPS type */
+typedef int16_t AGpsExtType;
+#define AGPS_TYPE_INVALID -1
+#define AGPS_TYPE_ANY 0
+#define AGPS_TYPE_SUPL 1
+#define AGPS_TYPE_C2K 2
+#define AGPS_TYPE_WWAN_ANY 3
+#define AGPS_TYPE_WIFI 4
+#define AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(GpsCallbacks) */
+ size_t size;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ gps_request_utc_time request_utc_time_cb;
+} GpsExtCallbacks;
+
+/** GPS extended batch options */
+typedef struct {
+ double max_power_allocation_mW;
+ uint32_t sources_to_use;
+ uint32_t flags;
+ int64_t period_ns;
+} GpsExtBatchOptions;
+
+/** 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 {
+ gps_xtra_download_request download_request_cb;
+ 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) */
+ size_t size;
+
+ AGpsExtType type;
+ AGpsStatusValue 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;
+ gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ gps_ni_notify_callback notify_cb;
+ gps_create_thread create_thread_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
+} 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;
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+
+/** GpsLocationExtended has valid latitude and longitude. */
+#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0)
+/** GpsLocationExtended has valid altitude. */
+#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE (1U<<1)
+/** GpsLocationExtended has valid speed. */
+#define GPS_LOCATION_EXTENDED_HAS_SPEED (1U<<2)
+/** GpsLocationExtended has valid bearing. */
+#define GPS_LOCATION_EXTENDED_HAS_BEARING (1U<<4)
+/** GpsLocationExtended has valid accuracy. */
+#define GPS_LOCATION_EXTENDED_HAS_ACCURACY (1U<<8)
+
+/** GPS extended supports geofencing */
+#define GPS_EXTENDED_CAPABILITY_GEOFENCE 0x0000001
+/** GPS extended supports batching */
+#define GPS_EXTENDED_CAPABILITY_BATCHING 0x0000002
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint16_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
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+} GpsLocationExtended;
+
+typedef struct GpsExtLocation_s {
+ size_t size;
+ uint16_t flags;
+ double latitude;
+ double longitude;
+ double altitude;
+ float speed;
+ float bearing;
+ float accuracy;
+ int64_t timestamp;
+ uint32_t sources_used;
+} GpsExtLocation;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+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)
+
+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_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_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_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)
+
+typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
+
+typedef enum loc_api_adapter_msg_to_check_supported {
+ LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching
+ LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach
+
+ LOC_API_ADAPTER_MESSAGE_MAX
+} LocCheckingMessagesID;
+
+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)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
+
diff --git a/msm8994/core/loc_core_log.cpp b/msm8994/core/loc_core_log.cpp
new file mode 100644
index 0000000..1b22010
--- /dev/null
+++ b/msm8994/core/loc_core_log.cpp
@@ -0,0 +1,260 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_core_log.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static loc_name_val_s_type gps_status_name[] =
+{
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
+};
+static int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(GpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
+};
+static int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( GPS_DELETE_ALMANAC ),
+ NAME_VAL( GPS_DELETE_POSITION ),
+ NAME_VAL( GPS_DELETE_TIME ),
+ NAME_VAL( GPS_DELETE_IONO ),
+ NAME_VAL( GPS_DELETE_UTC ),
+ NAME_VAL( GPS_DELETE_HEALTH ),
+ NAME_VAL( GPS_DELETE_SVDIR ),
+ NAME_VAL( GPS_DELETE_SVSTEER ),
+ NAME_VAL( GPS_DELETE_SADATA ),
+ NAME_VAL( GPS_DELETE_RTI ),
+ NAME_VAL( GPS_DELETE_CELLDB_INFO ),
+#ifndef PDK_FEATURE_SET
+ NAME_VAL( GPS_DELETE_ALMANAC_CORR ),
+ NAME_VAL( GPS_DELETE_FREQ_BIAS_EST ),
+ NAME_VAL( GLO_DELETE_EPHEMERIS ),
+ NAME_VAL( GLO_DELETE_ALMANAC ),
+ NAME_VAL( GLO_DELETE_SVDIR ),
+ NAME_VAL( GLO_DELETE_SVSTEER ),
+ NAME_VAL( GLO_DELETE_ALMANAC_CORR ),
+ NAME_VAL( GPS_DELETE_TIME_GPS ),
+ NAME_VAL( GLO_DELETE_TIME ),
+ NAME_VAL( BDS_DELETE_SVDIR ),
+ NAME_VAL( BDS_DELETE_SVSTEER ),
+ NAME_VAL( BDS_DELETE_TIME ),
+ NAME_VAL( BDS_DELETE_ALMANAC_CORR ),
+ NAME_VAL( BDS_DELETE_EPHEMERIS ),
+ NAME_VAL( BDS_DELETE_ALMANAC ),
+#endif
+ NAME_VAL( GPS_DELETE_ALL)
+};
+static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(GpsAidingData data)
+{
+ return NULL;
+}
+
+
+static loc_name_val_s_type loc_eng_agps_types[] =
+{
+ NAME_VAL( AGPS_TYPE_INVALID ),
+ NAME_VAL( AGPS_TYPE_ANY ),
+ NAME_VAL( AGPS_TYPE_SUPL ),
+ NAME_VAL( AGPS_TYPE_C2K ),
+ NAME_VAL( AGPS_TYPE_WWAN_ANY )
+};
+static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(AGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_types[] =
+{
+ NAME_VAL( GPS_NI_TYPE_VOICE ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ),
+ NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL )
+};
+static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(GpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_responses[] =
+{
+ NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY )
+};
+static int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(GpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static loc_name_val_s_type loc_eng_ni_encodings[] =
+{
+ NAME_VAL( GPS_ENC_NONE ),
+ NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( GPS_ENC_UNKNOWN )
+};
+static int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static loc_name_val_s_type loc_eng_agps_status_names[] =
+{
+ NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
+};
+static int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(AGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/msm8994/core/loc_core_log.h b/msm8994/core/loc_core_log.h
new file mode 100644
index 0000000..8a1825a
--- /dev/null
+++ b/msm8994/core/loc_core_log.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_CORE_LOG_H
+#define LOC_CORE_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <gps_extended.h>
+
+const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+const char* loc_get_position_mode_name(GpsPositionMode mode);
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(GpsAidingData data);
+const char* loc_get_agps_type_name(AGpsType type);
+const char* loc_get_ni_type_name(GpsNiType type);
+const char* loc_get_ni_response_name(GpsUserResponseType response);
+const char* loc_get_ni_encoding_name(GpsNiEncodingType 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(AGpsStatusValue status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CORE_LOG_H */
diff --git a/msm8994/etc/Android.mk b/msm8994/etc/Android.mk
new file mode 100644
index 0000000..fef8963
--- /dev/null
+++ b/msm8994/etc/Android.mk
@@ -0,0 +1,12 @@
+ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/
+LOCAL_SRC_FILES := gps.conf
+
+include $(BUILD_PREBUILT)
+endif
diff --git a/msm8994/etc/gps.conf b/msm8994/etc/gps.conf
new file mode 100644
index 0000000..a1d5d2c
--- /dev/null
+++ b/msm8994/etc/gps.conf
@@ -0,0 +1,117 @@
+#Uncommenting these urls would only enable
+#the power up auto injection and force injection(test case).
+#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
+#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
+#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
+
+#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
+
+#Test
+NTP_SERVER=time.gpsonextra.net
+#Asia
+# NTP_SERVER=asia.pool.ntp.org
+#Europe
+# NTP_SERVER=europe.pool.ntp.org
+#North America
+# NTP_SERVER=north-america.pool.ntp.org
+
+# 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
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 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=1
+
+#SUPL_MODE is a bit mask set in config.xml per carrier by default.
+#If it is uncommented here, this value will over write 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
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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 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 = 0
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=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
diff --git a/msm8994/loc-api.pc.in b/msm8994/loc-api.pc.in
new file mode 100644
index 0000000..3b4f81b
--- /dev/null
+++ b/msm8994/loc-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-api
+Description: Qualcomm GPS Location API
+Version: @VERSION@
+Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_eng_so -lgps_default_so -lloc_api
+Cflags: -I${includedir}/loc-api/libloc_api_50001 -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api
diff --git a/msm8994/loc_api/Android.mk b/msm8994/loc_api/Android.mk
new file mode 100644
index 0000000..743b386
--- /dev/null
+++ b/msm8994/loc_api/Android.mk
@@ -0,0 +1,17 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+
+LOCAL_PATH := $(call my-dir)
+
+# add RPC dirs if RPC is available
+ifneq ($(TARGET_NO_RPC),true)
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
+
+endif #TARGET_NO_RPC
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
+
+#call the subfolders
+include $(addsuffix Android.mk, $(GPS_DIR_LIST))
+
+endif#BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8994/loc_api/NOTICE b/msm8994/loc_api/NOTICE
new file mode 100644
index 0000000..85b5740
--- /dev/null
+++ b/msm8994/loc_api/NOTICE
@@ -0,0 +1,13 @@
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/Android.mk b/msm8994/loc_api/libloc_api-rpc-50001/Android.mk
new file mode 100644
index 0000000..6c5d533
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+include $(call all-subdir-makefiles)
+endif
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
new file mode 100644
index 0000000..bb3d924
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
@@ -0,0 +1,60 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+RPC_INC:=rpc_inc
+
+source_files:= \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpc.cpp
+
+LOCAL_SRC_FILES:= $(source_files)
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-DDEBUG -DUSE_QCOM_AUTO_RPC -DUSE_QCOM_AUTO_RPC
+LOCAL_CFLAGS+=$(GPS_FEATURES)
+
+# for loc_api_fixup.c
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= \
+ librpc \
+ libutils \
+ libcutils \
+ libcommondefs \
+ libgps.utils \
+ libloc_core
+
+LOCAL_STATIC_LIBRARIES := \
+ libloc_api_rpcgen
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/rpc_inc \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/loc_api/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/librpc \
+ $(TARGET_OUT_HEADERS)/libloc-rpc/rpc_inc \
+ $(TOP)/hardware/msm7k/librpc
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc-qc/$(RPC_INC)
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_rpc_glue.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_api_sync_call.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ $(RPC_INC)/LocApiRpc.h
+
+LOCAL_MODULE:= libloc_api-rpc-qc
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
new file mode 100644
index 0000000..f5c5136
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
@@ -0,0 +1,46 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I../../../platform_lib_abstractions \
+ -I./rpc_inc \
+ -I../libloc_api-rpc-stub/inc \
+ -I../../libloc_api_50001 \
+ $(MSM7K_CFLAGS) \
+ -DUSE_QCOM_AUTO_RPC
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ rpc_inc/loc_api_rpc_glue.h \
+ rpc_inc/loc_api_fixup.h \
+ rpc_inc/loc_api_sync_call.h \
+ rpc_inc/loc_apicb_appinit.h \
+
+c_sources = \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpcAdapter.cpp \
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpc_qc_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpc_qc_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpc_qc_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpc_qc_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpc_qc_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpc_qc_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpc_qc.la
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
new file mode 100644
index 0000000..01d67f4
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
@@ -0,0 +1,140 @@
+/* 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 LOC_API_RPC_H
+#define LOC_API_RPC_H
+
+#include <rpc/rpc.h>
+#include <loc_api_rpcgen_common_rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <LocApiBase.h>
+#include <loc_log.h>
+
+using namespace loc_core;
+
+class LocApiRpc : public LocApiBase {
+protected:
+ // RPC communication establishment
+ rpc_loc_client_handle_type client_handle;
+
+private:
+ int dataEnableLastSet;
+ char apnLastSet[MAX_APN_LEN];
+
+ static const LOC_API_ADAPTER_EVENT_MASK_T maskAll;
+ static const rpc_loc_event_mask_type locBits[];
+ static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ static rpc_loc_lock_e_type convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask);
+ static enum loc_api_adapter_err convertErr(int rpcErr);
+ static GpsNiEncodingType convertNiEncodingType(int loc_encoding);
+ static int NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv);
+
+ void reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr);
+ void reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+ void reportStatus(const rpc_loc_status_event_s_type *status_report_ptr);
+ void reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+ void ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr);
+ void NIEvent(const rpc_loc_ni_event_s_type *ni_req_ptr);
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+public:
+ LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ ~LocApiRpc();
+
+ virtual int locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+
+ void locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event);
+
+ // RPC adapter interface implementations
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& mode);
+ inline virtual enum loc_api_adapter_err
+ enableData(int enable) { return enableData(enable, false); }
+ virtual enum loc_api_adapter_err
+ enableData(int enable, boolean force);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ inline virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len) { return setAPN(apn, len, false); }
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len, boolean force);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(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 enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual void setInSession(bool inSession);
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+};
+
+extern "C" LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+#endif //LOC_API_RPC_H
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
new file mode 100644
index 0000000..49a6d0b
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
@@ -0,0 +1,69 @@
+/* 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "LocSvc_rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ ALOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ ALOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ ALOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
new file mode 100644
index 0000000..c483b4a
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
@@ -0,0 +1,226 @@
+/* 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 LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RPC failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+// Special return value for modem restart incurred RPC failure
+#define RPC_LOC_API_RPC_MODEM_RESTART (-1235)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE 0x00000200
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* EFS data access */
+#define RPC_LOC_EFS_MAX_PATH_LEN_BYTES 64 /* Max file name length in bytes that can be written*/
+#define RPC_LOC_EFS_MAX_FILE_LEN_BYTES 2000 /* Max file size in bytes that can be written */
+
+/* WIPER valid information flag in log report */
+#define RPC_LOC_WIPER_LOG_TIME_VALID 0x01
+#define RPC_LOC_WIPER_LOG_POS_VALID 0x02
+#define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04
+
+/* General WIPER defines */
+#define RPC_LOC_WIPER_MAC_ADDR_LENGTH 6 // Do not change this number since it affects RPC and log packet sizes
+#define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes
+
+/* WIPER AP Qualifier */
+#define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1 /* AP is being used by WPS */
+#define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */
+#define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4 /* AP has encryption turned on */
+#define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8 /* AP is in infrastructure mode and not in ad-hoc/unknown mode */
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+/* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */
+/* values for apn_profiles[0].srv_system_type */
+#define LOC_APN_PROFILE_SRV_SYS_CDMA 0x01
+#define LOC_APN_PROFILE_SRV_SYS_HDR 0x02
+#define LOC_APN_PROFILE_SRV_SYS_GSM 0x04
+#define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08
+#define LOC_APN_PROFILE_SRV_SYS_LTE 0x10
+#define LOC_APN_PROFILE_SRV_SYS_MAX 0x1F
+/* values for apn_profiles[0].pdp_type */
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4 0x01
+#define LOC_APN_PROFILE_PDN_TYPE_IPV6 0x02
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4V6 0x03
+#define LOC_APN_PROFILE_PDN_TYPE_PPP 0x04
+#define LOC_APN_PROFILE_PDN_TYPE_MAX 0x04
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
new file mode 100644
index 0000000..f037428
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
@@ -0,0 +1,59 @@
+/* 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 LOC_API_LOG_H
+#define LOC_API_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_api_rpcgen_common_rpc.h"
+
+extern int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open);
+extern const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask);
+extern const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type);
+extern const char* loc_get_ioctl_status_name(uint32 status);
+extern const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status);
+extern const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state);
+extern const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state);
+extern const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_LOG_H */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..6df33ae
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
@@ -0,0 +1,123 @@
+/* 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 LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+#include "loc_api_fixup.h"
+#include "loc_api_sync_call.h"
+#include <rpc/clnt.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ void* userData,
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+typedef void (loc_reset_notif_cb_f_type)(
+ void* userData,
+ CLIENT* clnt,
+ enum rpc_reset_event event
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_global_cb,
+ void* userData
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern void loc_clear
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+extern int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
new file mode 100644
index 0000000..43208bd
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
@@ -0,0 +1,90 @@
+/* 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 LOC_API_CB_SYNC_H
+#define LOC_API_CB_SYNC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include "loc_api_rpc_glue.h"
+#define LOC_SYNC_CALL_SLOTS_MAX 8
+
+typedef struct {
+ pthread_mutex_t lock;
+
+ /* Client ID */
+ rpc_loc_client_handle_type loc_handle;
+
+ /* Callback waiting conditional variable */
+ pthread_cond_t loc_cb_arrived_cond;
+
+ /* Callback waiting data block, protected by loc_cb_data_mutex */
+ boolean in_use;
+ boolean signal_sent;
+ boolean not_available;
+ rpc_loc_event_mask_type loc_cb_wait_event_mask; /* event to wait for */
+ rpc_loc_ioctl_e_type ioctl_type; /* ioctl to wait for */
+ rpc_loc_event_payload_u_type loc_cb_received_payload; /* received payload */
+ rpc_loc_event_mask_type loc_cb_received_event_mask; /* received event */
+} loc_sync_call_slot_s_type;
+
+typedef struct {
+ int num_of_slots;
+ loc_sync_call_slot_s_type slots[LOC_SYNC_CALL_SLOTS_MAX];
+} loc_sync_call_slot_array_s_type;
+
+/* Init function */
+void loc_api_sync_call_init();
+
+/* Destroy function */
+void loc_api_sync_call_destroy();
+
+/* Process Loc API callbacks to wake up blocked user threads */
+void loc_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+/* Reentrant synchronous IOCTL call, using Loc API return code */
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..ba41d08
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
@@ -0,0 +1,45 @@
+/* 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 LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
new file mode 100644
index 0000000..87d6b7c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
@@ -0,0 +1,1461 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc"
+
+#include <unistd.h>
+#include <math.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#endif /* USE_GLIB */
+#include <LocApiRpc.h>
+#include <LocAdapterBase.h>
+#include <loc_api_fixup.h>
+#include <loc_api_rpc_glue.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_api_log.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include <librpc.h>
+#include <platform_lib_includes.h>
+
+using namespace loc_core;
+
+#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
+#define XTRA_BLOCK_SIZE (3072)
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+/*===========================================================================
+FUNCTION loc_event_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int32 loc_event_cb
+(
+ void* user,
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event));
+ loc_callback_log(loc_event, loc_event_payload);
+ int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_rpc_global_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open for RPC global events
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event));
+ ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event);
+ EXIT_LOG(%p, VOID_RET);
+}
+
+const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll =
+ LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+const rpc_loc_event_mask_type LocApiRpc::locBits[] =
+{
+ RPC_LOC_EVENT_PARSED_POSITION_REPORT,
+ RPC_LOC_EVENT_SATELLITE_REPORT,
+ RPC_LOC_EVENT_NMEA_1HZ_REPORT,
+ RPC_LOC_EVENT_NMEA_POSITION_REPORT,
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST,
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST,
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST,
+ RPC_LOC_EVENT_IOCTL_REPORT,
+ RPC_LOC_EVENT_STATUS_REPORT,
+ RPC_LOC_EVENT_WPS_NEEDED_REQUEST
+};
+
+// constructor
+LocApiRpc::LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) :
+ LocApiBase(msgTask, exMask, context),
+ client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
+ dataEnableLastSet(-1)
+{
+ memset(apnLastSet, 0, sizeof(apnLastSet));
+ loc_api_glue_init();
+}
+
+LocApiRpc::~LocApiRpc()
+{
+ close();
+}
+
+rpc_loc_event_mask_type
+LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ rpc_loc_event_mask_type newMask = 0;
+
+ for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) {
+ if (mask & bit) {
+ newMask |= locBits[i];
+ mask ^= bit;
+ }
+ }
+
+ return newMask;
+}
+
+rpc_loc_lock_e_type
+LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask)
+{
+ if (isGpsLockAll(lockMask))
+ return RPC_LOC_LOCK_ALL;
+ if (isGpsLockMO(lockMask))
+ return RPC_LOC_LOCK_MI;
+ if (isGpsLockMT(lockMask))
+ return RPC_LOC_LOCK_MT;
+ if (isGpsLockNone(lockMask))
+ return RPC_LOC_LOCK_NONE;
+ return (rpc_loc_lock_e_type)lockMask;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::convertErr(int rpcErr)
+{
+ switch(rpcErr)
+ {
+ case RPC_LOC_API_SUCCESS:
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+ case RPC_LOC_API_GENERAL_FAILURE:
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ case RPC_LOC_API_UNSUPPORTED:
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ case RPC_LOC_API_INVALID_HANDLE:
+ return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ case RPC_LOC_API_INVALID_PARAMETER:
+ return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
+ case RPC_LOC_API_ENGINE_BUSY:
+ return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
+ case RPC_LOC_API_PHONE_OFFLINE:
+ return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
+ case RPC_LOC_API_TIMEOUT:
+ return LOC_API_ADAPTER_ERR_TIMEOUT;
+ case RPC_LOC_API_RPC_MODEM_RESTART:
+ return LOC_API_ADAPTER_ERR_ENGINE_DOWN;
+ case RPC_LOC_API_RPC_FAILURE:
+ return LOC_API_ADAPTER_ERR_FAILURE;
+ default:
+ return LOC_API_ADAPTER_ERR_UNKNOWN;
+ }
+}
+
+void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event)
+{
+ static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX;
+
+ switch (event) {
+ case RPC_SUBSYSTEM_RESTART_BEGIN:
+ if (RPC_LOC_ENGINE_STATE_OFF != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_OFF;
+ handleEngineDownEvent();
+ }
+ break;
+ case RPC_SUBSYSTEM_RESTART_END:
+ if (RPC_LOC_ENGINE_STATE_ON != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_ON;
+ handleEngineUpEvent();
+ }
+ break;
+ }
+}
+
+int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ // Parsed report
+ if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
+ {
+ reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ parsed_location_report);
+ }
+
+ // Satellite report
+ if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
+ {
+ reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report);
+ }
+
+ // Status report
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report);
+ }
+
+ // NMEA
+ if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
+ {
+ reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
+ }
+ // XTRA support: supports only XTRA download
+ if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST)
+ {
+ if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
+ {
+ requestXtraData();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_TIME_REQ)
+ {
+ requestTime();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ)
+ {
+ requestLocation();
+ }
+ }
+
+ // AGPS data request
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ loc_server_request);
+ }
+
+ // NI notify request
+ if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request);
+ }
+
+ return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to
+ // cause any issues in RPC thread context
+}
+
+enum loc_api_adapter_err
+LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ // RPC does not dynamically update the event mask. And in the
+ // case of RPC, all we support are positioning (gps + agps)
+ // masks anyways, so we simply mask all of them on always.
+ // After doing so the first time in a power cycle, we know there
+ // will the following if condition will never be true any more.
+ mask = maskAll;
+
+ if (mask != mMask) {
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ close();
+ }
+
+ mMask = mask;
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and bckground.
+ client_handle = loc_open(convertMask(mask),
+ loc_event_cb,
+ loc_rpc_global_cb, this);
+
+ if (client_handle < 0) {
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+ ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ }
+ }
+
+ return ret_val;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::close()
+{
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ loc_clear(client_handle);
+ }
+
+ loc_close(client_handle);
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::startFix(const LocPosMode& posMode) {
+ LOC_LOGD("LocApiRpc::startFix() called");
+ return convertErr(
+ loc_start_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::stopFix() {
+ LOC_LOGD("LocApiRpc::stopFix() called");
+ return convertErr(
+ loc_stop_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setPositionMode(const LocPosMode& posMode)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ rpc_loc_operation_mode_e_type op_mode;
+ int ret_val;
+ const LocPosMode* fixCriteria = &posMode;
+
+ ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode);
+
+ switch (fixCriteria->mode)
+ {
+ case LOC_POSITION_MODE_MS_BASED:
+ op_mode = RPC_LOC_OPER_MODE_MSB;
+ break;
+ case LOC_POSITION_MODE_MS_ASSISTED:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ break;
+ case LOC_POSITION_MODE_RESERVED_1:
+ op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_2:
+ op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_3:
+ op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_4:
+ case LOC_POSITION_MODE_RESERVED_5:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ fix_criteria_ptr->preferred_response_time = 0;
+ break;
+ default:
+ op_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ }
+
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->preferred_operation_mode = op_mode;
+
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+
+ if (fixCriteria->preferred_accuracy > 0) {
+ fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+ }
+ if (fixCriteria->preferred_time > 0) {
+ fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
+ }
+
+ switch (fixCriteria->recurrence) {
+ case GPS_POSITION_RECURRENCE_SINGLE:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
+ break;
+ case GPS_POSITION_RECURRENCE_PERIODIC:
+ default:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
+ break;
+ }
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_time_s_type *time_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+ int ret_val;
+
+ LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+
+ time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time;
+ time_info_ptr->time_utc = time;
+ time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::injectPosition(double latitude, double longitude, float accuracy)
+{
+ /* IOCTL data */
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_pos_s_type *assistance_data_position =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position;
+ int ret_val;
+
+ /************************************************
+ * Fill in latitude, longitude & accuracy
+ ************************************************/
+
+ /* This combo is required */
+ assistance_data_position->valid_mask =
+ RPC_LOC_ASSIST_POS_VALID_LATITUDE |
+ RPC_LOC_ASSIST_POS_VALID_LONGITUDE |
+ RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR |
+ RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL;
+
+ assistance_data_position->latitude = latitude;
+ assistance_data_position->longitude = longitude;
+ assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */
+ assistance_data_position->confidence_horizontal = 63; /* 63% (1 std dev) assumed */
+
+ /* Log */
+ LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n",
+ (double) assistance_data_position->latitude,
+ (double) assistance_data_position->longitude,
+ (double) assistance_data_position->hor_unc_circular);
+
+ ret_val = loc_eng_ioctl( client_handle,
+ RPC_LOC_IOCTL_INJECT_POSITION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+{
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+
+ memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back,
+ passThroughData, sizeof (rpc_loc_ni_event_s_type));
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ default:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ }
+
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setAPN(char* apn, int len, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ int size = sizeof(apnLastSet);
+ if (force || memcmp(apnLastSet, apn, size)) {
+ if (len < size) {
+ // size will be not larger than its original value
+ size = len + 1;
+ }
+ memcpy(apnLastSet, apn, size);
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
+ memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
+
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+void LocApiRpc::setInSession(bool inSession)
+{
+ if (!inSession) {
+ enableData(dataEnableLastSet, true);
+ setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(const char* url, int len)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
+#if (AMSS_VERSION==3200)
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len;
+#else
+ strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url,
+ sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", url);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(unsigned int ip, int port, LocServerType type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ switch (type) {
+ case LOC_AGPS_MPC_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR;
+ break;
+ case LOC_AGPS_CUSTOM_PDE_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR;
+ break;
+ default:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
+ break;
+ }
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
+ LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::enableData(int enable, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ if (force || dataEnableLastSet != enable) {
+ dataEnableLastSet = enable;
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
+
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::deleteAidingData(GpsAidingData bits)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits;
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
+{
+ LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
+
+ UlpLocation location = {0};
+ GpsLocationExtended locationExtended = {0};
+
+ location.size = sizeof(location);
+ locationExtended.size = sizeof(locationExtended);
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
+ {
+ // Process the position from final and intermediate reports
+ if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS ||
+ location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS)
+ {
+ // Latitude & Longitude
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) &&
+ (location_report_ptr->latitude != 0 ||
+ location_report_ptr->longitude != 0))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = location_report_ptr->latitude;
+ location.gpsLocation.longitude = location_report_ptr->longitude;
+
+ // Time stamp (UTC)
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.gpsLocation.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ // Altitude
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ // Speed
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal +
+ location_report_ptr->speed_vertical * location_report_ptr->speed_vertical);
+ }
+
+ // Heading
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = location_report_ptr->heading;
+ }
+
+ // Uncertainty (circular)
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ // Technology Mask
+
+ tech_Mask |= location_report_ptr->technology_mask;
+ //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->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
+ locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
+ locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = location_report_ptr->vert_unc;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = location_report_ptr->speed_unc;
+ }
+
+ LOC_LOGV("reportPosition: fire callback\n");
+ enum loc_sess_status fixStatus =
+ (location_report_ptr->session_status
+ == RPC_LOC_SESS_STATUS_IN_PROGESS ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS);
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ (void*)location_report_ptr,
+ fixStatus,
+ tech_Mask);
+ }
+ }
+ else
+ {
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_FAILURE);
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status = %d\n",
+ location_report_ptr->session_status);
+ }
+ }
+ else
+ {
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status is not set\n");
+ }
+}
+
+void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
+{
+ GpsSvStatus SvStatus = {0};
+ GpsLocationExtended locationExtended = {0};
+ locationExtended.size = sizeof(locationExtended);
+ int num_svs_max = 0;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ num_svs_max = gnss_report_ptr->sv_count;
+ if (num_svs_max > GPS_MAX_SVS)
+ {
+ num_svs_max = GPS_MAX_SVS;
+ }
+ }
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ SvStatus.num_svs = 0;
+
+ for (int i = 0; i < num_svs_max; i++)
+ {
+ sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
+ {
+ if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+ }
+ // SBAS: GPS RPN: 120-151,
+ // In exteneded measurement report, we follow nmea standard, which is from 33-64.
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
+ }
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
+ }
+ // Unsupported SV system
+ else
+ {
+ continue;
+ }
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ }
+
+ SvStatus.num_svs++;
+ }
+ }
+
+ if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
+ locationExtended.pdop = gnss_report_ptr->position_dop;
+ locationExtended.hdop = gnss_report_ptr->horizontal_dop;
+ locationExtended.vdop = gnss_report_ptr->vertical_dop;
+ }
+
+ if (SvStatus.num_svs >= 0)
+ {
+ LocApiBase::reportSv(SvStatus,
+ locationExtended,
+ (void*)gnss_report_ptr);
+ }
+}
+
+void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
+{
+
+ if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
+ if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON);
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN);
+ }
+ else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_END);
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF);
+ }
+ else
+ {
+ LocApiBase::reportStatus(GPS_STATUS_NONE);
+ }
+ }
+
+}
+
+void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+{
+
+#if (AMSS_VERSION==3200)
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#else
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences,
+ nmea_report_ptr->length);
+ LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n",
+ nmea_report_ptr->nmea_sentences[3],
+ nmea_report_ptr->nmea_sentences[4],
+ nmea_report_ptr->nmea_sentences[5]);
+#endif /* #if (AMSS_VERSION==3200) */
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setXtraData(char* data, int length)
+{
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ int total_parts;
+ uint8 part;
+ uint16 part_len;
+ uint16 len_injected;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
+ rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data);
+
+ predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data;
+ predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA;
+ predicted_orbits_data_ptr->total_size = length;
+ total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1;
+ predicted_orbits_data_ptr->total_parts = total_parts;
+
+ len_injected = 0; // O bytes injected
+ ioctl_data.disc = ioctl_type;
+
+ // XTRA injection starts with part 1
+ for (part = 1; part <= total_parts; part++)
+ {
+ predicted_orbits_data_ptr->part = part;
+ predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE;
+ if (XTRA_BLOCK_SIZE > (length - len_injected))
+ {
+ predicted_orbits_data_ptr->part_len = length - len_injected;
+ }
+ predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
+ predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n",
+ predicted_orbits_data_ptr->part,
+ total_parts,
+ predicted_orbits_data_ptr->part_len,
+ len_injected);
+
+ if (part < total_parts)
+ {
+ // No callback in this case
+ rpc_ret_val = loc_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data);
+
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
+ break;
+ }
+ //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor
+ usleep(10 * 1000);
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ if (!loc_eng_ioctl(client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
+ NULL))
+ {
+ rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ }
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
+ }
+
+ return convertErr(rpc_ret_val);
+}
+
+/* Request the Xtra Server Url from the modem */
+enum loc_api_adapter_err
+LocApiRpc::requestXtraServer()
+{
+ loc_api_adapter_err err;
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ err = convertErr(loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_data));
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS != err)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err);
+ return err;
+ }
+ else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+
+ reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[0],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[1],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[2],
+ 255);
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+{
+ rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+
+ if (AGPS_TYPE_INVALID == agpsType) {
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr->conn_handle = handle;
+ conn_open_status_ptr->open_status = open_status;
+#if (AMSS_VERSION==3200)
+ conn_open_status_ptr->apn_name = apn; /* requires APN */
+#else
+ if (is_succ) {
+ strlcpy(conn_open_status_ptr->apn_name, apn,
+ sizeof conn_open_status_ptr->apn_name);
+ } else {
+ conn_open_status_ptr->apn_name[0] = 0;
+ }
+#endif /* #if (AMSS_VERSION==3200) */
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n",
+ log_succ_fail_string(is_succ),
+ apn);
+ } else {
+ rpc_loc_server_multi_open_status_s_type *conn_multi_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS;
+ conn_multi_open_status_ptr->conn_handle = handle;
+ conn_multi_open_status_ptr->open_status = open_status;
+ if (is_succ) {
+ strlcpy(conn_multi_open_status_ptr->apn_name, apn,
+ sizeof conn_multi_open_status_ptr->apn_name);
+ } else {
+ conn_multi_open_status_ptr->apn_name[0] = 0;
+ }
+
+ switch(bearer)
+ {
+ case AGPS_APN_BEARER_IPV4:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
+ break;
+ case AGPS_APN_BEARER_IPV6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6;
+ break;
+ case AGPS_APN_BEARER_IPV4V6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6;
+ break;
+ default:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
+ }
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
+ log_succ_fail_string(is_succ),
+ apn,
+ conn_multi_open_status_ptr->pdp_type);
+ }
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlCloseStatus(int handle, int is_succ)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
+ conn_close_status_ptr->conn_handle = handle;
+ conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr)
+{
+ int connHandle;
+ AGpsType agps_type;
+
+ LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)",
+ loc_get_event_atl_open_name(server_request_ptr->event));
+ switch (server_request_ptr->event)
+ {
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle;
+ if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type
+ == RPC_LOC_SERVER_CONNECTION_LBS) {
+ agps_type = AGPS_TYPE_SUPL;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle);
+ } else {
+ agps_type = AGPS_TYPE_WWAN_ANY;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle);
+ }
+ requestATL(connHandle, agps_type);
+ break;
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle);
+ requestATL(connHandle, AGPS_TYPE_INVALID);
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle);
+ releaseATL(connHandle);
+ break;
+ default:
+ LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event);
+ }
+}
+
+void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req)
+{
+ GpsNiNotification notif = {0};
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ LOC_LOGI("VX Notification");
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ // Requestor ID
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ vx_req->requester_id.requester_id,
+ vx_req->requester_id.requester_id_length);
+ notif.text_encoding = 0; // No text and no encoding
+ notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme);
+ NIEventFillVerfiyType(notif, vx_req->notification_priv_type);
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ LOC_LOGI("UMTS CP Notification\n");
+ notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE; // Stores notification text
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text.notification_text_val,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+ umts_cp_req->requestor_id.string_len);
+#else
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string,
+ umts_cp_req->requestor_id.string_len);
+#endif
+ notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type);
+
+ // LCS address (using extras field)
+ if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0)
+ {
+ // 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;
+
+#if (AMSS_VERSION==3200)
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
+#else
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address;
+#endif /* #if (AMSS_VERSION==3200) */
+
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source,
+ umts_cp_req->ext_client_address_data.ext_client_address_len);
+
+ // The address is ASCII string
+ if (addr_len)
+ {
+ strlcat(notif.extras, lcs_addr, sizeof notif.extras);
+ }
+ }
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ LOC_LOGI("SUPL Notification\n");
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#else
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#else
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: requestor_id not present.");
+ }
+
+ // Encoding type
+ if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
+ {
+ notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ }
+ else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+ }
+ break;
+
+ default:
+ LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ return;
+ }
+
+ // this copy will get freed in loc_eng_ni when loc_ni_respond() is called
+ rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy));
+ memcpy(copy, ni_req, sizeof(*copy));
+ requestNiNotify(notif, (const void*)copy);
+}
+
+int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv)
+{
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif.notify_flags = 0;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_ACCEPT;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_DENY;
+ return 1;
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setSUPLVersion(uint32_t version)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version;
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
+{
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ return GPS_ENC_SUPL_UTF8;
+ case RPC_LOC_NI_SUPL_UCS2:
+ return GPS_ENC_SUPL_UCS2;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ return GPS_ENC_SUPL_GSM_DEFAULT;
+ case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
+ return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ default:
+ return GPS_ENC_UNKNOWN;
+ }
+}
+
+LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context) {
+ return new LocApiRpc(msgTask, exMask, context);
+}
+
+/*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+*/
+int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+ LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask);
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask);
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val);
+ return (ret_val == TRUE ? 0 : -1);
+}
+
+/*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+*/
+int LocApiRpc :: getGpsLock()
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+ boolean ret_val;
+ int ret=0;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload);
+ if(ret_val == TRUE) {
+ ret = (int)callback_payload.data.engine_lock;
+ LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__);
+ ret = -1;
+ }
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return ret;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
new file mode 100644
index 0000000..837ef11
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
new file mode 100644
index 0000000..1c48232
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
@@ -0,0 +1,345 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc_glue"
+
+#include "loc_api_log.h"
+#include "loc_log.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "rpc/rpc.h"
+#include "loc_api_fixup.h"
+
+/* Event names */
+loc_name_val_s_type loc_event_name[] =
+ {
+ NAME_VAL( RPC_LOC_EVENT_PARSED_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_SATELLITE_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_1HZ_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_LOCATION_SERVER_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_IOCTL_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_STATUS_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ),
+ };
+int loc_event_num = sizeof loc_event_name / sizeof(loc_name_val_s_type);
+
+/* Event names */
+loc_name_val_s_type loc_event_atl_open_name[] =
+ {
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_OPEN ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_CLOSE ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_MULTI_OPEN )
+ };
+int loc_event_atl_open_num = sizeof loc_event_atl_open_name / sizeof(loc_name_val_s_type);
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open)
+{
+ return loc_get_name_from_val(loc_event_atl_open_name, loc_event_atl_open_num,
+ (long) loc_event_atl_open);
+}
+
+/* IOCTL Type names */
+loc_name_val_s_type loc_ioctl_type_name[] =
+ {
+ NAME_VAL( RPC_LOC_IOCTL_GET_API_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_UTC_TIME ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_RTC_VALUE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_POSITION ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_ENGINE_STATE ),
+ NAME_VAL( RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_DATA_ENABLE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_DELETE_ASSIST_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR ),
+ };
+int loc_ioctl_type_num = sizeof loc_ioctl_type_name / sizeof(loc_name_val_s_type);
+
+/* IOCTL Status names */
+loc_name_val_s_type loc_ioctl_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_API_SUCCESS ),
+ NAME_VAL( RPC_LOC_API_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_API_UNSUPPORTED ),
+ NAME_VAL( RPC_LOC_API_INVALID_HANDLE ),
+ NAME_VAL( RPC_LOC_API_INVALID_PARAMETER ),
+ NAME_VAL( RPC_LOC_API_ENGINE_BUSY ),
+ NAME_VAL( RPC_LOC_API_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_API_TIMEOUT ),
+ NAME_VAL( RPC_LOC_API_RPC_FAILURE ),
+ NAME_VAL( RPC_LOC_API_RPC_MODEM_RESTART )
+ };
+int loc_ioctl_status_num = sizeof loc_ioctl_status_name / sizeof(loc_name_val_s_type);
+
+/* Fix session status names */
+loc_name_val_s_type loc_sess_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_SESS_STATUS_SUCCESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_IN_PROGESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_TIMEOUT ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_BAD_PARAMETER ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_ENGINE_LOCKED )
+ };
+int loc_sess_status_num = sizeof loc_sess_status_name / sizeof(loc_name_val_s_type);
+
+/* Engine state names */
+loc_name_val_s_type loc_engine_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_ENGINE_STATE_ON ),
+ NAME_VAL( RPC_LOC_ENGINE_STATE_OFF )
+ };
+int loc_engine_state_num = sizeof loc_engine_state_name / sizeof(loc_name_val_s_type);
+
+/* Fix session state names */
+loc_name_val_s_type loc_fix_session_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_BEGIN ),
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_END )
+ };
+int loc_fix_session_state_num = sizeof loc_fix_session_state_name / sizeof(loc_name_val_s_type);
+
+
+static const char* log_final_interm_string(int is_final)
+{
+ return is_final ? "final" : "intermediate";
+}
+
+/* Logs parsed report */
+static void log_parsed_report(const rpc_loc_parsed_position_s_type *parsed_report)
+{
+ rpc_loc_session_status_e_type status = parsed_report->session_status;
+ LOC_LOGD("Session status: %s Valid mask: 0x%X\n",
+ loc_get_sess_status_name(status),
+ (uint) parsed_report->valid_mask);
+ LOC_LOGD("Latitude: %.7f (%s)\n", parsed_report->latitude,
+ log_final_interm_string(
+ (parsed_report->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ parsed_report->session_status == RPC_LOC_SESS_STATUS_SUCCESS));
+ LOC_LOGD("Longitude: %.7f\n", parsed_report->longitude);
+ LOC_LOGD("Accuracy: %.7f\n", parsed_report->hor_unc_circular);
+}
+
+/* Logs status report */
+static void log_status_report(const rpc_loc_status_event_s_type *status_event)
+{
+ rpc_loc_status_event_e_type event = status_event->event;
+ switch (event) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ LOC_LOGD("Engine state: %s\n",
+ loc_get_engine_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.engine_state));
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ LOC_LOGD("Fix session state: %s\n",
+ loc_get_fix_session_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state));
+ break;
+ default:
+ break;
+ }
+}
+
+/* Logs valid fields in the GNSS SV constellation report */
+static void log_satellite_report(const rpc_loc_gnss_info_s_type *gnss)
+{
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP)
+ {
+ LOC_LOGV("position dop: %.3f\n", (float) gnss->position_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP)
+ {
+ LOC_LOGV("horizontal dop: %.3f\n", (float) gnss->horizontal_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP)
+ {
+ LOC_LOGV("vertical dop: %.3f\n", (float) gnss->vertical_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED)
+ {
+ LOC_LOGV("altitude assumed: %d\n", (int) gnss->altitude_assumed);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ LOC_LOGD("sv count: %d\n", (int) gnss->sv_count);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ LOC_LOGV("sv list: ");
+
+ if (gnss->sv_count)
+ {
+ LOC_LOGV("\n\tsys\tprn\thlth\tproc\teph\talm\telev\tazi\tsnr\n");
+ }
+ else {
+ LOC_LOGV("empty\n");
+ }
+
+ int i;
+ for (i = 0; i < gnss->sv_count; i++)
+ {
+ const rpc_loc_sv_info_s_type *sv = &gnss->sv_list.sv_list_val[i];
+ rpc_loc_sv_info_valid_mask_type mask = sv->valid_mask;
+ LOC_LOGV(" %d: \t%d\t%d\t%d\t%d\t%d\t%d\t%.3f\t%.3f\t%.3f\n", i,
+ CHECK_MASK(int, sv->system, mask, RPC_LOC_SV_INFO_VALID_SYSTEM),
+ CHECK_MASK(int, sv->prn, mask, RPC_LOC_SV_INFO_VALID_PRN),
+ CHECK_MASK(int, sv->health_status, mask, RPC_LOC_SV_INFO_VALID_HEALTH_STATUS),
+ CHECK_MASK(int, sv->process_status, mask, RPC_LOC_SV_INFO_VALID_PROCESS_STATUS),
+ CHECK_MASK(int, sv->has_eph, mask, RPC_LOC_SV_INFO_VALID_HAS_EPH),
+ CHECK_MASK(int, sv->has_alm, mask, RPC_LOC_SV_INFO_VALID_HAS_ALM),
+ CHECK_MASK(float, sv->elevation, mask, RPC_LOC_SV_INFO_VALID_ELEVATION),
+ CHECK_MASK(float, sv->azimuth, mask, RPC_LOC_SV_INFO_VALID_AZIMUTH),
+ CHECK_MASK(float, sv->snr, mask, RPC_LOC_SV_INFO_VALID_SNR)
+ );
+ }
+ }
+}
+
+/* Logs a callback event */
+int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ switch (loc_event)
+ {
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ log_satellite_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.gnss_report);
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ log_status_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.status_report);
+ break;
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ log_parsed_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.parsed_location_report);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask)
+{
+ return loc_get_name_from_mask(loc_event_name, loc_event_num,
+ (long) loc_event_mask);
+}
+
+/* Finds IOCTL type name */
+const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type)
+{
+ return loc_get_name_from_val(loc_ioctl_type_name, loc_ioctl_type_num,
+ (long) ioctl_type);
+}
+
+/* Finds IOCTL status name */
+const char* loc_get_ioctl_status_name(uint32 status)
+{
+ return loc_get_name_from_val(loc_ioctl_status_name, loc_ioctl_status_num,
+ (long) status);
+}
+
+/* Finds session status name */
+const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status)
+{
+ return loc_get_name_from_val(loc_sess_status_name, loc_sess_status_num,
+ (long) status);
+}
+
+/* Find engine state name */
+const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state)
+{
+ return loc_get_name_from_val(loc_engine_state_name, loc_engine_state_num,
+ (long) state);
+}
+
+/* Find engine state name */
+const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state)
+{
+ return loc_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num,
+ (long) state);
+}
+
+/* Event names */
+loc_name_val_s_type rpc_reset_event_name[] =
+{
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_BEGIN ),
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_END )
+};
+int rpc_reset_event_num = sizeof rpc_reset_event_name / sizeof(loc_name_val_s_type);
+
+const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event)
+{
+ return loc_get_name_from_val(rpc_reset_event_name, rpc_reset_event_num, event);
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
new file mode 100644
index 0000000..e0f400c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
@@ -0,0 +1,636 @@
+/* Copyright (c) 2011-2012, 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 FILES FOR MODULE
+
+======================================================================*/
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <loc_api_log.h>
+
+#include <rpc/rpc.h>
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "rpc_inc/loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+#define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/* Logging Improvement */
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/* Uncomment to force ALOGD messages */
+// #define ALOGD ALOGI
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_MAX_CLIENTS 16
+typedef struct
+{
+ uint32 cb_id; /* same as rpc/types.h */
+ loc_event_cb_f_type *cb_func; /* callback func */
+ loc_reset_notif_cb_f_type *rpc_cb; /* callback from RPC */
+ rpc_loc_client_handle_type handle; /* stores handle for client closing */
+ void* user; /* user's own data handle */
+} loc_glue_cb_entry_s_type;
+
+loc_glue_cb_entry_s_type loc_glue_callback_table[LOC_API_CB_MAX_CLIENTS];
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) a ## v ## b
+#define RPC_CALLBACK_FUNC_VERSION(a,v,b) RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { EXIT_LOG_CALLFLOW(%d, RPC_LOC_API_RPC_FAILURE); return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { \
+ LOC_LOGE("%s:%d] failure code %d", __func__, __LINE__, stat); \
+ return (ret_type)((stat == RPC_SUBSYSTEM_RESTART) ? \
+ RPC_LOC_API_RPC_MODEM_RESTART : RPC_LOC_API_RPC_FAILURE); \
+ }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ // The lower word of cd_id is the index
+ int index = argp->cb_id & 0xFFFF;
+
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (index >= LOC_API_CB_MAX_CLIENTS || loc_glue_callback_table[index].cb_func == NULL)
+ {
+ LOC_LOGE("Warning: No callback handler %d.\n", index);
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOC_LOGV("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOC_LOGV("Callback received: %x (cb_id=%p handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ argp->cb_id,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ /* Gives control to synchronous call handler */
+ loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload);
+
+ int32 rc = (loc_glue_callback_table[index].cb_func)(loc_glue_callback_table[index].user,
+ loc_handle, loc_event, loc_event_payload);
+
+ LOC_LOGV("cb_func=%p", loc_glue_callback_table[index].cb_func);
+
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOC_LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+/*===========================================================================
+
+FUNCTION rpc_loc_event_cb_f_type_<version>_svc (MACRO)
+
+DESCRIPTION
+ Callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_event_cb_f_type_, RPC_LOC_EVENT_CB_F_TYPE_VERSION, _svc) (
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ return rpc_loc_event_cb_f_type_svc(argp, ret, req);
+}
+
+/*===========================================================================
+
+FUNCTION loc_apicbprog_<version>_freeresult (MACRO)
+
+DESCRIPTION
+ Free up RPC data structure
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+#define VERSION_CONCAT(MAJOR,MINOR) MAJOR##MINOR
+#define loc_apicb_prog_VER_freeresult(M,N) \
+int RPC_CALLBACK_FUNC_VERSION(loc_apicbprog_, VERSION_CONCAT(M,N), _freeresult) \
+(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) \
+{ \
+ return loc_apicbprog_freeresult(transp, xdr_result, result); \
+}
+
+/* Define all of the possible minors */
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0001);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0002);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0003);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0004);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0005);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+/*===========================================================================
+
+FUNCTION rpc_loc_api_cb_null_<version>_svc (MACRO) [Patch for wrong RPCGEN stubs]
+
+DESCRIPTION
+ Null callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+
+===========================================================================*/
+#define rpc_loc_api_cb_null_VER_svc(M,N) \
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_api_cb_null_, VERSION_CONCAT(M,N), _svc) ( \
+ void *a, int *b, struct svc_req *req) \
+{ \
+ return 1; \
+}
+
+/* Define all of the possible minors */
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0001);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0002);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0003);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0004);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0005);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+static void loc_api_glue_rpc_cb(CLIENT* client, enum rpc_reset_event event)
+{
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) {
+ if (NULL != loc_glue_callback_table[i].rpc_cb) {
+ loc_glue_callback_table[i].rpc_cb(loc_glue_callback_table[i].user, client, event);
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Initialize data */
+ int i;
+ int pid = getpid();
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ loc_glue_callback_table[i].cb_id = i | (pid << 16);
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].user = NULL;
+ }
+
+ /* Print msg */
+ LOC_LOGV("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOC_LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ LOC_LOGE("Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ loc_api_sync_call_init();
+
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOC_LOGD("Loc API RPC client initialized.\n");
+ clnt_register_reset_notification_cb(loc_api_clnt, loc_api_glue_rpc_cb);
+ }
+ else {
+ LOC_LOGE("Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_cb,
+ void* userData
+)
+{
+ int try_num = RPC_TRY_NUM;
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_client_handle_type ret_val;
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+
+ int i, j = LOC_API_CB_MAX_CLIENTS;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].user == userData)
+ {
+ LOC_LOGW("Client already opened service (callback=%p)...\n",
+ event_callback);
+ break;
+ } else if (j == LOC_API_CB_MAX_CLIENTS &&
+ loc_glue_callback_table[i].user == NULL) {
+ j = i;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ i = j;
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGE("Too many clients opened at once...\n");
+ return RPC_LOC_CLIENT_HANDLE_INVALID;
+ }
+
+ loc_glue_callback_table[i].cb_func = event_callback;
+ loc_glue_callback_table[i].rpc_cb = rpc_cb;
+ loc_glue_callback_table[i].user = userData;
+
+ args.event_callback = loc_glue_callback_table[i].cb_id;
+ LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client open");
+
+ /*try more for rpc_loc_open_xx()*/
+
+ do
+ {
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
+ ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
+ try_num--;
+
+ }while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num );
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ /* save the handle in the table */
+ loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
+
+ return ret_val;
+
+}
+
+int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client close");
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt);
+
+ loc_clear(handle);
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ ret_val = (int32) rets.loc_close_result;
+
+ return ret_val;
+}
+
+void loc_clear(rpc_loc_client_handle_type handle) {
+ /* Clean the client's callback function in callback table */
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].handle == handle)
+ {
+ /* Found the client */
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].user = NULL;
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGW("Handle not found (handle=%d)...\n", (int) handle);
+ }
+}
+
+int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc start fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_start_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc stop fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_stop_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ break;
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ break;
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ break;
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ break;
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, loc_get_ioctl_type_name(ioctl_type));
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_ioctl_result;
+
+ return ret_val;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ clnt_unregister_reset_notification_cb(loc_api_clnt);
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl
+
+DESCRIPTION
+ This function calls loc_ioctl and waits for the callback result before
+ returning back to the user.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS;
+
+ ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr);
+
+ LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, returt %s\n",
+ (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type),
+ loc_get_ioctl_status_name(ret_val) );
+
+ return ret_val;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
new file mode 100644
index 0000000..ae629d7
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
@@ -0,0 +1,565 @@
+/* Copyright (c) 2011-2012, 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 <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include "loc_api_sync_call.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_slot_array_s_type loc_sync_data;
+
+pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
+boolean loc_sync_call_inited = 0;
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_init
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_init()
+{
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 1) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 1;
+
+ loc_sync_data.num_of_slots = LOC_SYNC_CALL_SLOTS_MAX;
+
+ int i;
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->not_available = 0;
+ slot->in_use = 0;
+ slot->loc_handle = -1;
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_destroy
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_destroy()
+{
+ int i;
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 0) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 0;
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->not_available = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ pthread_cond_destroy(&slot->loc_cb_arrived_cond);
+ pthread_mutex_destroy(&slot->lock);
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_match_callback
+
+DESCRIPTION
+ Checks if an awaited event has arrived
+
+RETURN VALUE
+ TRUE arrived
+ FALSE not matching
+
+===========================================================================*/
+static boolean loc_match_callback(
+ rpc_loc_event_mask_type wait_mask,
+ rpc_loc_ioctl_e_type wait_ioctl,
+ rpc_loc_event_mask_type event_mask,
+ const rpc_loc_event_payload_u_type *callback_payload
+)
+{
+ if ((event_mask & wait_mask) == 0) return FALSE;
+
+ if (event_mask != RPC_LOC_EVENT_IOCTL_REPORT || wait_ioctl == 0 ||
+ ( (callback_payload != NULL) &&
+ callback_payload->rpc_loc_event_payload_u_type_u.ioctl_report.type == wait_ioctl) )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_callback_process_sync_call
+
+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_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ int i;
+
+ ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->in_use &&
+ slot->signal_sent == 0 &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload))
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+
+ slot->loc_cb_received_event_mask = loc_event;
+
+ ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ slot->signal_sent = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+ break;
+ } else {
+ /* do nothing */
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_a_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_lock_a_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+ if (pthread_mutex_trylock(&slot->lock) == EBUSY)
+ {
+ ALOGV("trylock EBUSY : %d", i);
+ continue;
+ }
+
+ if (!slot->in_use && !slot->not_available)
+ {
+ select_id = i;
+ /* Return from here and leave the mutex locked.
+ * will unlock it in loc_unlock_slot()
+ */
+ break;
+ }
+ /* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_unlock_slot
+
+DESCRIPTION
+ Unlocks a buffer slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_unlock_slot(int select_id)
+{
+ pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_slot
+
+DESCRIPTION
+ Locks a specific slot that was previously locked from loc_lock_a_slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_lock_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_set_slot_in_use
+
+DESCRIPTION
+ Sets the in_use flag of slot to true or false.
+ Should be called only after the slot is locked
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_set_slot_in_use(int select_id, boolean in_use)
+{
+ loc_sync_data.slots[select_id].in_use = in_use;
+ if (in_use == 1)
+ loc_sync_data.slots[select_id].signal_sent = 0;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_save_callback
+
+DESCRIPTION
+ Selects which callback or IOCTL event to wait for.
+
+ The event_mask specifies the event(s). If it is RPC_LOC_EVENT_IOCTL_REPORT,
+ then ioctl_type specifies the IOCTL event.
+
+ If ioctl_type is non-zero, RPC_LOC_EVENT_IOCTL_REPORT is automatically added.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : out of buffer
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_api_save_callback(
+ int select_id, /* Selected slot */
+ rpc_loc_client_handle_type loc_handle, /* Client handle */
+ rpc_loc_event_mask_type event_mask, /* Event mask to wait for */
+ rpc_loc_ioctl_e_type ioctl_type /* IOCTL type to wait for */
+)
+{
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ slot->loc_handle = loc_handle;
+
+ slot->loc_cb_wait_event_mask = event_mask;
+ slot->ioctl_type = ioctl_type;
+ if (ioctl_type) slot->loc_cb_wait_event_mask |= RPC_LOC_EVENT_IOCTL_REPORT;
+
+ return;
+}
+
+/*===========================================================================
+
+FUNCTION loc_save_user_payload
+
+DESCRIPTION
+ Saves received payload into user data structures
+
+RETURN VALUE
+ None
+
+===========================================================================*/
+static void loc_save_user_payload(
+ rpc_loc_event_payload_u_type *user_cb_payload,
+ rpc_loc_ioctl_callback_s_type *user_ioctl_buffer,
+ const rpc_loc_event_payload_u_type *received_cb_payload
+)
+{
+ if (user_cb_payload)
+ {
+ memcpy(user_cb_payload, received_cb_payload,
+ sizeof (rpc_loc_event_payload_u_type));
+ }
+ if (user_ioctl_buffer)
+ {
+ memcpy(user_ioctl_buffer,
+ &received_cb_payload->rpc_loc_event_payload_u_type_u.ioctl_report,
+ sizeof *user_ioctl_buffer);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_wait_callback
+
+DESCRIPTION
+ Waits for a selected callback. The wait expires in timeout_seconds seconds.
+
+ If the function is called before an existing wait has finished, it will
+ immediately return EBUSY.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS if successful (0)
+ RPC_LOC_API_TIMEOUT if timed out
+ RPC_LOC_API_ENGINE_BUSY if already in a wait
+ RPC_LOC_API_INVALID_PARAMETER if callback is not yet selected
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_api_wait_callback(
+ int select_id, /* ID from loc_select_callback() */
+ int timeout_seconds, /* Timeout in this number of seconds */
+ rpc_loc_event_payload_u_type *callback_payload, /* Pointer to callback payload buffer, can be NULL */
+ rpc_loc_ioctl_callback_s_type *ioctl_payload /* Pointer to IOCTL payload, can be NULL */
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc = 0; /* return code from pthread calls */
+
+ struct timespec expire_time;
+
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ clock_gettime(CLOCK_REALTIME, &expire_time);
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Waiting */
+ while (slot->signal_sent == 0 && rc != ETIMEDOUT) {
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+ }
+
+ if (rc == ETIMEDOUT)
+ {
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ ALOGE("TIMEOUT: %d", select_id);
+ }
+ else {
+ /* Obtained the first awaited callback */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_ioctl
+
+DESCRIPTION
+ Synchronous IOCTL call (reentrant version)
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Loc API error code (0 = success)
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int rc = -1;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ select_id = loc_lock_a_slot();
+
+ if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
+ {
+ ALOGE("slot not available ioctl_type = %s",
+ loc_get_ioctl_type_name(ioctl_type));
+ return rc;
+ }
+
+ loc_set_slot_in_use(select_id, 1); // set slot in use to true
+
+ // Select the callback we are waiting for
+ loc_api_save_callback(select_id, handle, 0, ioctl_type);
+
+ loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true
+
+ // we want to avoid keeping the slot locked during the loc_ioctl because the rpc
+ // framework will also lock a different mutex during this call, and typically
+ // locking two different mutexes at the same time can lead to deadlock.
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+
+ loc_lock_slot(select_id);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else {
+ ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
+ select_id, ioctl_type);
+ // Wait for the callback of loc_ioctl
+ if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
+ {
+ // Callback waiting failed
+ ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else
+ {
+ if (cb_data_ptr) memcpy(cb_data_ptr, &callback_data, sizeof *cb_data_ptr);
+ if (callback_data.status != RPC_LOC_API_SUCCESS)
+ {
+ rc = callback_data.status;
+ ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ } else {
+ ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
+ select_id, ioctl_type, rc);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+
+ loc_set_slot_in_use(select_id, 0); // set slot in use to false
+ loc_unlock_slot(select_id);
+
+ return rc;
+}
+
+
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..db5b291
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
@@ -0,0 +1,86 @@
+/* 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.
+ */
+
+#include "rpc/rpc.h"
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+#include "rpc_inc/loc_api_fixup.h"
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+ svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ svrPort = NULL;
+}
+
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
new file mode 100644
index 0000000..c0987e6
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
@@ -0,0 +1,36 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# functions
+LOC_RPCGEN_APIS_PATH := $(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+LOC_RPCGEN_APIS_PATH_FL := ../../../../../$(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+
+LOCAL_MODULE := libloc_api_rpcgen
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_SHARED_LIBRARIES := \
+ librpc \
+ libcommondefs
+
+LOCAL_SRC_FILES += \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+LOCAL_C_INCLUDES += hardware/msm7k/librpc
+LOCAL_C_INCLUDES += $(LOC_RPCGEN_APIS_PATH)/../../SHARED_LIBRARIES/libcommondefs_intermediates/inc
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc
+
+LOCAL_COPY_HEADERS_TO := loc_api/rpcgen/inc
+LOCAL_COPY_HEADERS := inc/loc_api_rpcgen_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_common_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_cb_rpc.h
+LOCAL_COPY_HEADERS += inc/loc_apicb_appinit.h
+
+LOCAL_LDLIBS += -lpthread
+LOCAL_PRELINK_MODULE := false
+include $(BUILD_STATIC_LIBRARY)
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
new file mode 100644
index 0000000..4ac8c8a
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
@@ -0,0 +1,42 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I./inc \
+ $(MSM7K_CFLAGS)
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ inc/loc_api_rpcgen_rpc.h \
+ inc/loc_api_rpcgen_common_rpc.h \
+ inc/loc_api_rpcgen_cb_rpc.h \
+ inc/loc_apicb_appinit.h
+
+c_sources = \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-stub/inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpcgen_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpcgen_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpcgen_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpcgen_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpcgen_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpcgen_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpcgen.la
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
new file mode 100644
index 0000000..87f2c37
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_RPC_H_RPCGEN
+#define _LOC_API_CB_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00050006
+
+#define LOC_APICBPROG 0x3100008C
+#define LOC_APICBVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001();
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc();
+extern int loc_apicbprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002();
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc();
+extern int loc_apicbprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003();
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc();
+extern int loc_apicbprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004();
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc();
+extern int loc_apicbprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005();
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc();
+extern int loc_apicbprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006();
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc();
+extern int loc_apicbprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_RPC_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
new file mode 100644
index 0000000..8107de2
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
@@ -0,0 +1,1261 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_RPC_H_RPCGEN
+#define _LOC_API_COMMON_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040030
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_API_CB_NULL_VERSION 0x00050002
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00050001
+#define RPC_LOC_STOP_FIX_VERSION 0x00050001
+#define RPC_LOC_START_FIX_VERSION 0x00050001
+#define RPC_LOC_IOCTL_VERSION 0x00050001
+#define RPC_LOC_CLOSE_VERSION 0x00050001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001
+#define RPC_LOC_OPEN_VERSION 0x00050001
+#define RPC_LOC_API_NULL_VERSION 0x00050001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0005
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+typedef struct rpc_loc_server_addr_ipv6_type rpc_loc_server_addr_ipv6_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ rpc_loc_server_addr_ipv6_type ipv6;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+typedef struct rpc_loc_pos_inj_request_s_type rpc_loc_pos_inj_request_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET = 0 + 1,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216,
+};
+typedef enum rpc_loc_server_connection_e_type rpc_loc_server_connection_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+typedef struct rpc_loc_server_multi_open_req_s_type rpc_loc_server_multi_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP = 0 + 1,
+ RPC_LOC_SERVER_PDP_IPV6 = 0 + 2,
+ RPC_LOC_SERVER_PDP_IPV4V6 = 0 + 3,
+ RPC_LOC_SERVER_PDP_MAX = 268435456,
+};
+typedef enum rpc_loc_server_pdp_type_e_type rpc_loc_server_pdp_type_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_multi_open_status_s_type rpc_loc_server_multi_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456,
+};
+typedef enum rpc_loc_error_estimate_config_e_type rpc_loc_error_estimate_config_e_type;
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ char apn_name[100];
+};
+typedef struct rpc_loc_apn_profiles_type rpc_loc_apn_profiles_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_boolean data_enable;
+ rpc_uint32 supl_version;
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_uint32 supl_version;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type (XDR *, rpc_loc_server_addr_ipv6_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type (XDR *, rpc_loc_pos_inj_request_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_connection_e_type (XDR *, rpc_loc_server_connection_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (XDR *, rpc_loc_server_multi_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type (XDR *, rpc_loc_server_pdp_type_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (XDR *, rpc_loc_server_multi_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type (XDR *, rpc_loc_error_estimate_config_e_type*);
+extern bool_t xdr_rpc_loc_apn_profiles_type (XDR *, rpc_loc_apn_profiles_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_connection_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type ();
+extern bool_t xdr_rpc_loc_apn_profiles_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_RPC_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
new file mode 100644
index 0000000..6138432
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
@@ -0,0 +1,288 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_RPC_H_RPCGEN
+#define _LOC_API_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00050006
+
+#define LOC_APIPROG 0x3000008C
+#define LOC_APIVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00050001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00050001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00050001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00050001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00050001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001();
+extern bool_t rpc_loc_api_null_0x00050001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001();
+extern bool_t rpc_loc_open_0x00050001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001();
+extern bool_t rpc_loc_close_0x00050001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001();
+extern bool_t rpc_loc_start_fix_0x00050001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001();
+extern bool_t rpc_loc_stop_fix_0x00050001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001();
+extern bool_t rpc_loc_ioctl_0x00050001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001();
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc();
+extern int loc_apiprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050002();
+extern bool_t rpc_loc_api_null_0x00050002_svc();
+extern int loc_apiprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050003(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050003_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050003();
+extern bool_t rpc_loc_api_null_0x00050003_svc();
+extern int loc_apiprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050004(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050004_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050004();
+extern bool_t rpc_loc_api_null_0x00050004_svc();
+extern int loc_apiprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050005(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050005_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050005();
+extern bool_t rpc_loc_api_null_0x00050005_svc();
+extern int loc_apiprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050006(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050006_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050006();
+extern bool_t rpc_loc_api_null_0x00050006_svc();
+extern int loc_apiprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_RPC_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..875c4f0
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* 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.
+ *
+ */
+
+/* Initialization function for callbacks */
+int loc_apicb_app_init();
+
+void loc_apicb_app_deinit();
+
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
new file mode 100644
index 0000000..2ef5852
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
@@ -0,0 +1,327 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00050001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00050001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00050001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00050001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050002(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050002_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050002_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050002_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050003(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050003_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050003_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050003_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050004(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050004_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050004_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050004_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050005(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050005_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050005_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050005_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050006(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050006_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050006_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050006_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
new file mode 100644
index 0000000..ad171dc
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
new file mode 100644
index 0000000..3e39576
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
@@ -0,0 +1,155 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api_rpcgen_rpc.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00050001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00050001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00050001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00050001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050003(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050004(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050005(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050006(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
new file mode 100644
index 0000000..21be8f4
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
@@ -0,0 +1,1775 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_common_rpc.h"
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv6_type (XDR *xdrs, rpc_loc_server_addr_ipv6_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_vector (xdrs, (char *)objp->addr, 8,
+ sizeof (rpc_uint16), (xdrproc_t) xdr_rpc_uint16))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ if (!xdr_rpc_loc_server_addr_ipv6_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv6))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_inj_request_s_type (XDR *xdrs, rpc_loc_pos_inj_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->position_uncertainty))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ if (!xdr_rpc_loc_pos_inj_request_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.pos_injection))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_e_type (XDR *xdrs, rpc_loc_server_connection_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_req_s_type (XDR *xdrs, rpc_loc_server_multi_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ if (!xdr_rpc_loc_server_connection_e_type (xdrs, &objp->connection_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ if (!xdr_rpc_loc_server_multi_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.multi_open_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_pdp_type_e_type (XDR *xdrs, rpc_loc_server_pdp_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_status_s_type (XDR *xdrs, rpc_loc_server_multi_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_rpc_loc_server_pdp_type_e_type (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_error_estimate_config_e_type (XDR *xdrs, rpc_loc_error_estimate_config_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_apn_profiles_type (XDR *xdrs, rpc_loc_apn_profiles_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint32 (xdrs, &objp->srv_system_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ if (!xdr_rpc_loc_error_estimate_config_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.error_estimate_config))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.data_enable))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_multi_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.multi_conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_callback_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
new file mode 100644
index 0000000..a0fdcab
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
@@ -0,0 +1,199 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_rpc.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..b469eb0
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ */
+#include "librpc.h"
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_0x00010001 */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+
+
+
+ if(svc_register(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+void loc_apicb_app_deinit(void)
+{
+
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+
+ svc_unregister(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001);
+}
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
new file mode 100644
index 0000000..82dca56
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
@@ -0,0 +1,261 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00050006 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050002;
+
+version LOC_APIVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050003;
+
+version LOC_APIVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050004;
+
+version LOC_APIVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APIVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050006;
+
+
+} = 0x3000008C;
+
+const LOC_APIVERS = 0x00050006;
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
new file mode 100644
index 0000000..4756c6c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
@@ -0,0 +1,187 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00050006 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APICBVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050002;
+
+version LOC_APICBVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050003;
+
+version LOC_APICBVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050004;
+
+version LOC_APICBVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APICBVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050006;
+
+
+} = 0x3100008C;
+
+const LOC_APICBVERS = 0x00050006;
diff --git a/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
new file mode 100644
index 0000000..e059c66
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
@@ -0,0 +1,1021 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040030;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_API_CB_NULL_VERSION = 0x00050002;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00050001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00050001;
+const RPC_LOC_START_FIX_VERSION = 0x00050001;
+const RPC_LOC_IOCTL_VERSION = 0x00050001;
+const RPC_LOC_CLOSE_VERSION = 0x00050001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001;
+const RPC_LOC_OPEN_VERSION = 0x00050001;
+const RPC_LOC_API_NULL_VERSION = 0x00050001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0005;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[200];
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256];
+};
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ rpc_loc_server_addr_ipv6_type ipv6;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20];
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP,
+ RPC_LOC_SERVER_PDP_IPV6,
+ RPC_LOC_SERVER_PDP_IPV4V6,
+ RPC_LOC_SERVER_PDP_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100];
+};
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456
+};
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ rpc_boolean data_enable;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/msm8994/loc_api/libloc_api-rpc/Android.mk b/msm8994/loc_api/libloc_api-rpc/Android.mk
new file mode 100644
index 0000000..06e4694
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/Android.mk
@@ -0,0 +1,61 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+AMSS_VERSION:=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION)
+RPC_INC:=inc-$(AMSS_VERSION)
+
+generated_files:= \
+ gen-$(AMSS_VERSION)/loc_api_clnt.c \
+ gen-$(AMSS_VERSION)/loc_api_cb_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_common_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_cb_svc.c \
+ gen-$(AMSS_VERSION)/loc_api_xdr.c \
+ gen-$(AMSS_VERSION)/loc_api_fixup.c \
+ gen-$(AMSS_VERSION)/loc_api_rpc_glue.c \
+ src/loc_apicb_appinit.c
+
+LOCAL_SRC_FILES:= $(generated_files)
+
+# removed from library build since the client should implement this code.
+# src/loc_api_cb_server.c
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-include $(RPC_INC)/loc_api_common.h
+LOCAL_CFLAGS+=-DDEBUG
+# LOCAL_CFLAGS+=-DDEBUG -DVERBOSE
+
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= librpc
+LOCAL_STATIC_LIBRARIES:= libcommondefs-rpc
+
+
+
+LOCAL_COPY_HEADERS_TO:= libloc_api-rpc/inc
+LOCAL_COPY_HEADERS:= \
+ $(RPC_INC)/loc_api_cb.h \
+ $(RPC_INC)/loc_api_common.h \
+ $(RPC_INC)/loc_api.h \
+ $(RPC_INC)/loc_api_fixup.h \
+ $(RPC_INC)/loc_apicb_appinit.h \
+ inc/debug.h \
+ inc/loc_api_rpc_glue.h
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/inc \
+ $(LOCAL_PATH)/$(RPC_INC) \
+ $(TARGET_OUT_HEADERS)/libcommondefs-rpc \
+ $(TARGET_OUT_HEADERS)/librpc
+
+LOCAL_MODULE:= libloc_api-rpc
+LOCAL_MODULE_OWNER := qcom
+
+include $(BUILD_STATIC_LIBRARY)
+
+endif
+endif
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr b/msm8994/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
new file mode 100644
index 0000000..5d9cf6c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr
@@ -0,0 +1,29 @@
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
new file mode 100644
index 0000000..a9d60aa
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr
@@ -0,0 +1,172 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00040002 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00040001;
+
+
+
+ version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_ni_event_e_type in 0x00040002
+RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00040002;
+
+
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00040002;
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
new file mode 100644
index 0000000..1bd4e15
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr
@@ -0,0 +1,85 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00040002 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00040001;
+
+
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00040002;
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c
new file mode 100644
index 0000000..52a0d15
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00040001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00040001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00040001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00040001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00040001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c
new file mode 100644
index 0000000..dca1e8d
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c
@@ -0,0 +1,91 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00040001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00040001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00040001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00040001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00040002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
new file mode 100644
index 0000000..4e01607
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr
@@ -0,0 +1,906 @@
+/* LOC_API TOOL VERSION: 4.36 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+ Copyright (c) 2010 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040024;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00040001;
+const RPC_LOC_OPEN_VERSION = 0x00040001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00040001;
+const RPC_LOC_API_NULL_VERSION = 0x00040001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00040001;
+const RPC_LOC_IOCTL_VERSION = 0x00040001;
+const RPC_LOC_START_FIX_VERSION = 0x00040001;
+const RPC_LOC_CLOSE_VERSION = 0x00040001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00040001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0004;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef bool rpc_boolean;
+
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[1200]; /* EVAL:[1200]*/
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256]; /* EVAL:[256]*/
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200]; /* EVAL:[200]*/
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4]; /* EVAL:[4]*/
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200]; /* EVAL:[200]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64]; /* EVAL:[64]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8]; /* EVAL:[8]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20]; /* EVAL:[20]*/
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20]; /* EVAL:[20]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64]; /* EVAL:[64]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+ typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+ typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100]; /* EVAL:[100]*/
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6]; /* EVAL:[6]*/
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50]; /* EVAL:[50]*/
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64]; /* EVAL:[64]*/
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8]; /* EVAL:[8]*/
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c
new file mode 100644
index 0000000..7c860bf
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c
@@ -0,0 +1,1650 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 1200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
new file mode 100644
index 0000000..fe512f5
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
new file mode 100644
index 0000000..fbaca8b
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00040001_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00040001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr b/msm8994/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
new file mode 100644
index 0000000..5d9cf6c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr
@@ -0,0 +1,29 @@
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
new file mode 100644
index 0000000..981266b
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr
@@ -0,0 +1,164 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00010001 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+ } = 0x00010001;
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00010001;
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
new file mode 100644
index 0000000..3f53504
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr
@@ -0,0 +1,90 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00010001 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+ } = 0x00010001;
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00010001;
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c
new file mode 100644
index 0000000..b1aa199
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00010001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00010001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00010001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00010001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00010001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c
new file mode 100644
index 0000000..79814d4
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c
@@ -0,0 +1,82 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00010001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00010001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00010001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00010001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
new file mode 100644
index 0000000..7ef6357
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
@@ -0,0 +1,803 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_OPEN_VERSION = 0x00010001;
+const RPC_LOC_CLOSE_VERSION = 0x00010001;
+const RPC_LOC_START_FIX_VERSION = 0x00010001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00010001;
+const RPC_LOC_IOCTL_VERSION = 0x00010001;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00010001;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0001;
+typedef bool rpc_boolean;
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<RPC_LOC_API_MAX_SV_COUNT>;
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences<RPC_LOC_API_MAX_NMEA_STRING_LENGTH>;
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string<RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ unsigned char maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address<RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS>;
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string<RPC_LOC_NI_CODEWORD_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ string apn_name<>;
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+const RPC_LOC_API_NULL_VERSION = 0x00010001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00010001;
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
new file mode 100644
index 0000000..7b37b9c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
@@ -0,0 +1,1441 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->apn_name, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
new file mode 100644
index 0000000..fe512f5
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
new file mode 100644
index 0000000..8c17122
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
@@ -0,0 +1,339 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00010001_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00010001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api.h b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api.h
new file mode 100644
index 0000000..e02648c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api.h
@@ -0,0 +1,210 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00040002
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00040001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00040001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00040001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00040001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00040001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00040001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00040001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00040001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00040001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00040001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00040001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00040001();
+extern bool_t rpc_loc_api_null_0x00040001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00040001();
+extern bool_t rpc_loc_open_0x00040001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00040001();
+extern bool_t rpc_loc_close_0x00040001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00040001();
+extern bool_t rpc_loc_start_fix_0x00040001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00040001();
+extern bool_t rpc_loc_stop_fix_0x00040001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00040001();
+extern bool_t rpc_loc_ioctl_0x00040001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00040001();
+extern bool_t rpc_loc_api_api_versions_0x00040001_svc();
+extern int loc_apiprog_0x00040001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00040002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00040002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00040002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00040002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00040002();
+extern bool_t rpc_loc_api_null_0x00040002_svc();
+extern int loc_apiprog_0x00040002_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h
new file mode 100644
index 0000000..67ac084
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00040002
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00040001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001();
+extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc();
+extern int loc_apicbprog_0x00040001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h
new file mode 100644
index 0000000..6ff3baf
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h
@@ -0,0 +1,1154 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040024
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00040001
+#define RPC_LOC_OPEN_VERSION 0x00040001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00040001
+#define RPC_LOC_API_NULL_VERSION 0x00040001
+#define RPC_LOC_STOP_FIX_VERSION 0x00040001
+#define RPC_LOC_IOCTL_VERSION 0x00040001
+#define RPC_LOC_START_FIX_VERSION 0x00040001
+#define RPC_LOC_CLOSE_VERSION 0x00040001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00040001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0004
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[1200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
new file mode 100644
index 0000000..e62eb36
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
new file mode 100644
index 0000000..92d4e15
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api.h b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api.h
new file mode 100644
index 0000000..8998aca
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api.h
@@ -0,0 +1,198 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00010001
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00010001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00010001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00010001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00010001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00010001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00010001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00010001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00010001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00010001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00010001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00010001();
+extern bool_t rpc_loc_api_null_0x00010001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00010001();
+extern bool_t rpc_loc_open_0x00010001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00010001();
+extern bool_t rpc_loc_close_0x00010001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00010001();
+extern bool_t rpc_loc_start_fix_0x00010001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00010001();
+extern bool_t rpc_loc_stop_fix_0x00010001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00010001();
+extern bool_t rpc_loc_ioctl_0x00010001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00010001();
+extern bool_t rpc_loc_api_api_versions_0x00010001_svc();
+extern int loc_apiprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h
new file mode 100644
index 0000000..4f2f8f9
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00010001
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00010001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001();
+extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc();
+extern int loc_apicbprog_0x00010001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
new file mode 100644
index 0000000..04be079
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
@@ -0,0 +1,1031 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_OPEN_VERSION 0x00010001
+#define RPC_LOC_CLOSE_VERSION 0x00010001
+#define RPC_LOC_START_FIX_VERSION 0x00010001
+#define RPC_LOC_STOP_FIX_VERSION 0x00010001
+#define RPC_LOC_IOCTL_VERSION 0x00010001
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00010001
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+#define RPC_LOC_API_API_MAJOR_NUM 0x0001
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ struct {
+ u_int nmea_sentences_len;
+ char *nmea_sentences_val;
+ } nmea_sentences;
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ struct {
+ u_int addr_len;
+ char *addr_val;
+ } addr;
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int requestor_id_string_len;
+ char *requestor_id_string_val;
+ } requestor_id_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int client_name_string_len;
+ char *client_name_string_val;
+ } client_name_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ u_char maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ struct {
+ u_int ext_client_address_len;
+ char *ext_client_address_val;
+ } ext_client_address;
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int lcs_codeword_string_len;
+ char *lcs_codeword_string_val;
+ } lcs_codeword_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ struct {
+ u_int notification_text_len;
+ char *notification_text_val;
+ } notification_text;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char *apn_name;
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+#define RPC_LOC_API_NULL_VERSION 0x00010001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00010001
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
new file mode 100644
index 0000000..e62eb36
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
new file mode 100644
index 0000000..92d4e15
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8994/loc_api/libloc_api-rpc/inc/debug.h b/msm8994/loc_api/libloc_api-rpc/inc/debug.h
new file mode 100644
index 0000000..a71b23a
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc/debug.h
@@ -0,0 +1,57 @@
+/*
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "libgps-rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ LOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ LOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ LOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/msm8994/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h b/msm8994/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..ef972bd
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h
@@ -0,0 +1,100 @@
+/******************************************************************************
+ @file: loc_api_rpc_glue.h
+ @brief: Loc API Android glue code header
+
+ DESCRIPTION
+ Loc API Android glue code header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/17/09 dx Initial version
+
+$Id: //source/qcom/qct/modem/gps/cgps/dev/locationmiddleware/locapi/app-linux/source/test/loc_api_test/loc_api_cb_log.h#4 $
+======================================================================*/
+
+#ifndef LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#include "loc_api_common.h"
+#include "loc_api.h"
+#include "loc_api_cb.h"
+#include "loc_api_fixup.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/msm8994/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c b/msm8994/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..7fcfd6c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c
@@ -0,0 +1,61 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+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 QUALCOMM USA, INC. 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 "rpc/rpc.h"
+#include "loc_api_common.h"
+#include "loc_api.h"
+#include "loc_api_cb.h"
+#include "loc_api_fixup.h"
+
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ svrPort = NULL;
+}
diff --git a/msm8994/loc_api/libloc_api_50001/Android.mk b/msm8994/loc_api/libloc_api_50001/Android.mk
new file mode 100644
index 0000000..74d5423
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/Android.mk
@@ -0,0 +1,104 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_eng
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_nmea.cpp \
+ LocEngAdapter.cpp
+
+LOCAL_SRC_FILES += \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_COPY_HEADERS_TO:= libloc_eng/
+LOCAL_COPY_HEADERS:= \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+
+## Libs
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_eng \
+ libloc_core \
+ libgps.utils \
+ libdl
+
+ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false)
+endif
+
+LOCAL_SRC_FILES += \
+ loc.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+
+ifeq ($(TARGET_USES_QCOM_BSP), true)
+LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
+endif
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/msm8994/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msm8994/loc_api/libloc_api_50001/LocEngAdapter.cpp
new file mode 100644
index 0000000..c47502b
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -0,0 +1,422 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_EngAdapter"
+
+#include <LocEngAdapter.h>
+#include "loc_eng_msg.h"
+#include "loc_log.h"
+
+using namespace loc_core;
+
+LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
+ LocAdapterBase(adapter->getMsgTask()),
+ mLocEngAdapter(adapter)
+{
+}
+void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
+ sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
+}
+void LocInternalAdapter::startFixInt() {
+ sendMsg(new LocEngStartFix(mLocEngAdapter));
+}
+void LocInternalAdapter::stopFixInt() {
+ sendMsg(new LocEngStopFix(mLocEngAdapter));
+}
+void LocInternalAdapter::getZppInt() {
+ sendMsg(new LocEngGetZpp(mLocEngAdapter));
+}
+
+LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ MsgTask::tCreate tCreator) :
+ LocAdapterBase(mask,
+ //Get the AFW context if VzW context has not already been intialized in
+ //loc_ext
+ context == NULL?
+ LocDualContext::getLocFgContext(tCreator,
+ LocDualContext::mLocationHalName)
+ :context),
+ mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
+ mUlp(new UlpProxyBase()), mNavigating(false),
+ mSupportsAgpsRequests(false),
+ mSupportsPositionInjection(false),
+ mSupportsTimeInjection(false),
+ mPowerVote(0)
+{
+ memset(&mFixCriteria, 0, sizeof(mFixCriteria));
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ LOC_LOGD("LocEngAdapter created");
+}
+
+inline
+LocEngAdapter::~LocEngAdapter()
+{
+ delete mInternalAdapter;
+ LOC_LOGV("LocEngAdapter deleted");
+}
+
+void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
+ struct LocSetUlpProxy : public LocMsg {
+ LocAdapterBase* mAdapter;
+ UlpProxyBase* mUlp;
+ inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
+ LocMsg(), mAdapter(adapter), mUlp(ulp) {
+ }
+ virtual void proc() const {
+ LOC_LOGV("%s] ulp %p adapter %p", __func__,
+ mUlp, mAdapter);
+ mAdapter->setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
+}
+
+void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ if (ulp == mUlp) {
+ //This takes care of the case when double initalization happens
+ //and we get the same object back for UlpProxyBase . Do nothing
+ return;
+ }
+
+ LOC_LOGV("%s] %p", __func__, ulp);
+ if (NULL == ulp) {
+ LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__);
+ ulp = new UlpProxyBase();
+ }
+
+ if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) {
+ // need to send this mode and start msg to ULP
+ ulp->sendFixMode(mUlp->mPosMode);
+ }
+
+ if(mUlp->mFixSet) {
+ ulp->sendStartFix();
+ }
+
+ delete mUlp;
+ mUlp = ulp;
+}
+
+int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask)
+{
+ struct LocEngAdapterGpsLock : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LOC_GPS_LOCK_MASK mLockMask;
+ inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) :
+ LocMsg(), mAdapter(adapter), mLockMask(lockMask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setGpsLock(mLockMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+ };
+ sendMsg(new LocEngAdapterGpsLock(this, lockMask));
+ return 0;
+}
+
+void LocEngAdapter::requestPowerVote()
+{
+ if (getPowerVoteRight()) {
+ /* Power voting without engine lock:
+ * 101: vote down, 102-104 - vote up
+ * These codes are used not to confuse with actual engine lock
+ * functionality, that can't be used in SSR scenario, as it
+ * conflicts with initialization sequence.
+ */
+ bool powerUp = getPowerVote();
+ LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp);
+ setGpsLock(powerUp ? 103 : 101);
+ }
+}
+
+void LocInternalAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ sendMsg(new LocEngReportPosition(mLocEngAdapter,
+ location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask));
+}
+
+
+void LocEngAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ if (! mUlp->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask )) {
+ mInternalAdapter->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask);
+ }
+}
+
+void LocInternalAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt){
+ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
+ locationExtended, svExt));
+}
+
+void LocEngAdapter::reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+
+ // We want to send SV info to ULP to help it in determining GNSS
+ // signal strength ULP will forward the SV reports to HAL without
+ // any modifications
+ if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
+ mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
+ }
+}
+
+void LocEngAdapter::setInSession(bool inSession)
+{
+ mNavigating = inSession;
+ mLocApi->setInSession(inSession);
+ if (!mNavigating) {
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ }
+}
+
+void LocInternalAdapter::reportStatus(GpsStatusValue status)
+{
+ sendMsg(new LocEngReportStatus(mLocEngAdapter, status));
+}
+
+void LocEngAdapter::reportStatus(GpsStatusValue status)
+{
+ if (!mUlp->reportStatus(status)) {
+ mInternalAdapter->reportStatus(status);
+ }
+}
+
+inline
+void LocEngAdapter::reportNmea(const char* nmea, int length)
+{
+ sendMsg(new LocEngReportNmea(mOwner, nmea, length));
+}
+
+inline
+bool LocEngAdapter::reportXtraServer(const char* url1,
+ const char* url2,
+ const char* url3,
+ const int maxlength)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReportXtraServer(mOwner, url1,
+ url2, url3, maxlength));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestATL(mOwner,
+ connHandle, agps_type));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::releaseATL(int connHandle)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReleaseATL(mOwner, connHandle));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestXtraData()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestXtra(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestTime()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestTime(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data)
+{
+ if (mSupportsAgpsRequests) {
+ notif.size = sizeof(notif);
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ sendMsg(new LocEngRequestNi(mOwner, notif, data));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestSuplES(int connHandle)
+{
+ if (mSupportsAgpsRequests)
+ sendMsg(new LocEngRequestSuplEs(mOwner, connHandle));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallOpened()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsOpened(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallClosed()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsClosed(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+void LocEngAdapter::handleEngineDownEvent()
+{
+ sendMsg(new LocEngDown(mOwner));
+}
+
+inline
+void LocEngAdapter::handleEngineUpEvent()
+{
+ sendMsg(new LocEngUp(mOwner));
+}
+
+enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty)
+{
+ loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d",
+ __func__, __LINE__, mSupportsTimeInjection);
+
+ if (mSupportsTimeInjection) {
+ LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
+ result = mLocApi->setTime(time, timeReference, uncertainty);
+ } else {
+ mSupportsTimeInjection = true;
+ }
+ return result;
+}
+
+enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
+{
+ enum loc_api_adapter_err ret;
+ ENTRY_LOG();
+ enum xtra_version_check eCheck;
+ switch (check) {
+ case 0:
+ eCheck = DISABLED;
+ break;
+ case 1:
+ eCheck = AUTO;
+ break;
+ case 2:
+ eCheck = XTRA2;
+ break;
+ case 3:
+ eCheck = XTRA3;
+ break;
+ default:
+ eCheck = DISABLED;
+ }
+ ret = mLocApi->setXtraVersionCheck(eCheck);
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData)
+{
+ sendMsg(new LocEngReportGpsMeasurement(mOwner,
+ gpsMeasurementData));
+}
+
+/*
+ Update Registration Mask
+ */
+void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+{
+ LOC_LOGD("entering %s", __func__);
+ int result = LOC_API_ADAPTER_ERR_FAILURE;
+ result = mLocApi->updateRegistrationMask(event, isEnabled);
+ if (result == LOC_API_ADAPTER_ERR_SUCCESS) {
+ LOC_LOGD("%s] update registration mask succeed.", __func__);
+ } else {
+ LOC_LOGE("%s] update registration mask failed.", __func__);
+ }
+}
+
+/*
+ Set Gnss Constellation Config
+ */
+bool LocEngAdapter::gnssConstellationConfig()
+{
+ LOC_LOGD("entering %s", __func__);
+ bool result = false;
+ result = mLocApi->gnssConstellationConfig();
+ return result;
+}
diff --git a/msm8994/loc_api/libloc_api_50001/LocEngAdapter.h b/msm8994/loc_api/libloc_api_50001/LocEngAdapter.h
new file mode 100644
index 0000000..6302662
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -0,0 +1,350 @@
+/* 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 LOC_API_ENG_ADAPTER_H
+#define LOC_API_ENG_ADAPTER_H
+
+#include <ctype.h>
+#include <hardware/gps.h>
+#include <loc.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <platform_lib_includes.h>
+
+#define MAX_URL_LEN 256
+
+using namespace loc_core;
+
+class LocEngAdapter;
+
+class LocInternalAdapter : public LocAdapterBase {
+ LocEngAdapter* mLocEngAdapter;
+public:
+ LocInternalAdapter(LocEngAdapter* adapter);
+
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void setPositionModeInt(LocPosMode& posMode);
+ virtual void startFixInt();
+ virtual void stopFixInt();
+ virtual void getZppInt();
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+};
+
+typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
+
+class LocEngAdapter : public LocAdapterBase {
+ void* mOwner;
+ LocInternalAdapter* mInternalAdapter;
+ UlpProxyBase* mUlp;
+ LocPosMode mFixCriteria;
+ bool mNavigating;
+ // mPowerVote is encoded as
+ // mPowerVote & 0x20 -- powerVoteRight
+ // mPowerVote & 0x10 -- power On / Off
+ unsigned int mPowerVote;
+ static const unsigned int POWER_VOTE_RIGHT = 0x20;
+ static const unsigned int POWER_VOTE_VALUE = 0x10;
+
+public:
+ bool mSupportsAgpsRequests;
+ bool mSupportsPositionInjection;
+ bool mSupportsTimeInjection;
+
+ LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ MsgTask::tCreate tCreator);
+ virtual ~LocEngAdapter();
+
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ inline void requestUlp(unsigned long capabilities) {
+ mContext->requestUlp(mInternalAdapter, capabilities);
+ }
+ inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
+ inline UlpProxyBase* getUlpProxy() { return mUlp; }
+ inline void* getOwner() { return mOwner; }
+ inline bool hasAgpsExtendedCapabilities() {
+ return mContext->hasAgpsExtendedCapabilities();
+ }
+ inline bool hasCPIExtendedCapabilities() {
+ return mContext->hasCPIExtendedCapabilities();
+ }
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+
+ inline enum loc_api_adapter_err
+ startFix()
+ {
+ return mLocApi->startFix(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ stopFix()
+ {
+ return mLocApi->stopFix();
+ }
+ inline enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f)
+ {
+ return mLocApi->deleteAidingData(f);
+ }
+ inline enum loc_api_adapter_err
+ enableData(int enable)
+ {
+ return mLocApi->enableData(enable);
+ }
+ inline enum loc_api_adapter_err
+ setAPN(char* apn, int len)
+ {
+ return mLocApi->setAPN(apn, len);
+ }
+ inline enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy)
+ {
+ return mLocApi->injectPosition(latitude, longitude, accuracy);
+ }
+ inline enum loc_api_adapter_err
+ setXtraData(char* data, int length)
+ {
+ return mLocApi->setXtraData(data, length);
+ }
+ inline enum loc_api_adapter_err
+ requestXtraServer()
+ {
+ return mLocApi->requestXtraServer();
+ }
+ inline enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+ {
+ return mLocApi->atlOpenStatus(handle, is_succ, apn, bearer, agpsType);
+ }
+ inline enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ)
+ {
+ return mLocApi->atlCloseStatus(handle, is_succ);
+ }
+ inline enum loc_api_adapter_err
+ setPositionMode(const LocPosMode *posMode)
+ {
+ if (NULL != posMode) {
+ mFixCriteria = *posMode;
+ }
+ return mLocApi->setPositionMode(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ setServer(const char* url, int len)
+ {
+ return mLocApi->setServer(url, len);
+ }
+ inline enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+ {
+ return mLocApi->setServer(ip, port, type);
+ }
+ inline enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData)
+ {
+ return mLocApi->informNiResponse(userResponse, passThroughData);
+ }
+ inline enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version)
+ {
+ return mLocApi->setSUPLVersion(version);
+ }
+ inline enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile)
+ {
+ return mLocApi->setLPPConfig(profile);
+ }
+ inline enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider)
+ {
+ return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider);
+ }
+ inline enum loc_api_adapter_err
+ setSensorProperties(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)
+ {
+ return mLocApi->setSensorProperties(gyroBiasVarianceRandomWalk_valid, gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid, angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid, rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid, velocityBiasVarianceRandomWalk);
+ }
+ inline virtual enum loc_api_adapter_err
+ setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
+ {
+ return mLocApi->setSensorPerfControlConfig(controlMode, accelSamplesPerBatch, accelBatchesPerSec,
+ gyroSamplesPerBatch, gyroBatchesPerSec,
+ accelSamplesPerBatchHigh, accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
+ algorithmConfig);
+ }
+ inline virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging)
+ {
+ return mLocApi->setExtPowerConfig(isBatteryCharging);
+ }
+ inline virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+ {
+ return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
+ }
+ inline virtual int initDataServiceClient()
+ {
+ return mLocApi->initDataServiceClient();
+ }
+ inline virtual int openAndStartDataCall()
+ {
+ return mLocApi->openAndStartDataCall();
+ }
+ inline virtual void stopDataCall()
+ {
+ mLocApi->stopDataCall();
+ }
+ inline virtual void closeDataCall()
+ {
+ mLocApi->closeDataCall();
+ }
+ inline enum loc_api_adapter_err
+ getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
+ {
+ return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
+ }
+ enum loc_api_adapter_err setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty);
+ enum loc_api_adapter_err setXtraVersionCheck(int check);
+ inline virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+ {
+ mLocApi->installAGpsCert(pData, length, slotBitMask);
+ }
+ virtual void handleEngineDownEvent();
+ virtual void handleEngineUpEvent();
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GpsSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData);
+
+ inline const LocPosMode& getPositionMode() const
+ {return mFixCriteria;}
+ inline virtual bool isInSession()
+ { return mNavigating; }
+ void setInSession(bool inSession);
+
+ // Permit/prohibit power voting
+ inline void setPowerVoteRight(bool powerVoteRight) {
+ mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) :
+ (mPowerVote & ~POWER_VOTE_RIGHT);
+ }
+ inline bool getPowerVoteRight() const {
+ return (mPowerVote & POWER_VOTE_RIGHT) != 0 ;
+ }
+ // Set the power voting up/down and do actual operation if permitted
+ inline void setPowerVote(bool powerOn) {
+ mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) :
+ (mPowerVote & ~POWER_VOTE_VALUE);
+ requestPowerVote();
+ mContext->modemPowerVote(powerOn);
+ }
+ inline bool getPowerVote() const {
+ return (mPowerVote & POWER_VOTE_VALUE) != 0 ;
+ }
+ // Do power voting according to last settings if permitted
+ void requestPowerVote();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ inline int setGpsLock(LOC_GPS_LOCK_MASK lock)
+ {
+ return mLocApi->setGpsLock(lock);
+ }
+
+ int setGpsLockMsg(LOC_GPS_LOCK_MASK lock);
+
+ /*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+ */
+ inline int getGpsLock()
+ {
+ return mLocApi->getGpsLock();
+ }
+
+ /*
+ Update Registration Mask
+ */
+ void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+
+ /*
+ Set Gnss Constellation Config
+ */
+ bool gnssConstellationConfig();
+};
+
+#endif //LOC_API_ENG_ADAPTER_H
diff --git a/msm8994/loc_api/libloc_api_50001/Makefile.am b/msm8994/loc_api/libloc_api_50001/Makefile.am
new file mode 100644
index 0000000..2374357
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/Makefile.am
@@ -0,0 +1,76 @@
+AM_CFLAGS = \
+ -I../../utils \
+ -I../../platform_lib_abstractions \
+ -fno-short-enums \
+ -DFEATURE_GNSS_BIT_API
+
+libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp
+
+if USE_GLIB
+libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la
+
+
+libloc_eng_so_la_SOURCES = \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+
+if USE_GLIB
+libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_eng_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la
+
+
+libgps_default_so_la_SOURCES = \
+ loc.cpp \
+ gps.c
+
+if USE_GLIB
+libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_default_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la
+
+library_include_HEADERS = \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+library_includedir = $(pkgincludedir)/libloc_api_50001
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la
diff --git a/msm8994/loc_api/libloc_api_50001/gps.c b/msm8994/loc_api/libloc_api_50001/gps.c
new file mode 100644
index 0000000..29f20f4
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/gps.c
@@ -0,0 +1,73 @@
+/* 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 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 <hardware/gps.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
+
+ if(dev == NULL)
+ return -1;
+
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = 1,
+ .hal_api_version = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/msm8994/loc_api/libloc_api_50001/loc.cpp b/msm8994/loc_api/libloc_api_50001/loc.cpp
new file mode 100644
index 0000000..1d4e54c
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc.cpp
@@ -0,0 +1,1076 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_afw"
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_eng.h>
+#include <loc_target.h>
+#include <loc_log.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <LocDualContext.h>
+#include <cutils/properties.h>
+
+using namespace loc_core;
+
+#define LOC_PM_CLIENT_NAME "GPS"
+
+//Globals defns
+static gps_location_callback gps_loc_cb = NULL;
+static gps_sv_status_callback gps_sv_cb = NULL;
+
+static void local_loc_cb(UlpLocation* location, void* locExt);
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
+
+static const GpsGeofencingInterface* get_geofence_interface(void);
+
+// Function declarations for sLocEngInterface
+static int loc_init(GpsCallbacks* callbacks);
+static int loc_start();
+static int loc_stop();
+static void loc_cleanup();
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_inject_location(double latitude, double longitude, float accuracy);
+static void loc_delete_aiding_data(GpsAidingData f);
+static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy,
+ uint32_t preferred_time);
+static const void* loc_get_extension(const char* name);
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_init,
+ loc_start,
+ loc_stop,
+ loc_cleanup,
+ loc_inject_time,
+ loc_inject_location,
+ loc_delete_aiding_data,
+ loc_set_position_mode,
+ loc_get_extension
+};
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_agps_init(AGpsCallbacks* callbacks);
+static int loc_agps_open(const char* apn);
+static int loc_agps_closed();
+static int loc_agps_open_failed();
+static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType);
+
+static const AGpsInterface sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface),
+ loc_agps_init,
+ loc_agps_open,
+ loc_agps_closed,
+ loc_agps_open_failed,
+ loc_agps_set_server,
+ loc_agps_open_with_apniptype
+};
+
+static int loc_xtra_init(GpsXtraCallbacks* callbacks);
+static int loc_xtra_inject_data(char* data, int length);
+
+static const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ loc_xtra_init,
+ loc_xtra_inject_data
+};
+
+static void loc_ni_init(GpsNiCallbacks *callbacks);
+static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+static const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_ni_init,
+ loc_ni_respond,
+};
+
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks);
+static void loc_gps_measurement_close();
+
+static const GpsMeasurementInterface sLocEngGpsMeasurementInterface =
+{
+ sizeof(GpsMeasurementInterface),
+ loc_gps_measurement_init,
+ loc_gps_measurement_close
+};
+
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
+static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
+
+static const AGpsRilInterface sLocEngAGpsRilInterface =
+{
+ sizeof(AGpsRilInterface),
+ loc_agps_ril_init,
+ loc_agps_ril_set_ref_location,
+ loc_agps_ril_set_set_id,
+ loc_agps_ril_ni_message,
+ loc_agps_ril_update_network_state,
+ loc_agps_ril_update_network_availability
+};
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length);
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length);
+
+static const SuplCertificateInterface sLocEngAGpsCertInterface =
+{
+ sizeof(SuplCertificateInterface),
+ loc_agps_install_certificates,
+ loc_agps_revoke_certificates
+};
+
+static void loc_configuration_update(const char* config_data, int32_t length);
+
+static const GnssConfigurationInterface sLocEngConfigInterface =
+{
+ sizeof(GnssConfigurationInterface),
+ loc_configuration_update
+};
+
+static loc_eng_data_s_type loc_afw_data;
+static int gss_fd = -1;
+static int sGnssType = GNSS_UNKNOWN;
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ ENTRY_LOG_CALLFLOW();
+ const GpsInterface* ret_val;
+
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ loc_eng_read_config();
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ ret_val = NULL;
+ } else {
+ ret_val = &sLocEngInterface;
+ }
+
+ loc_eng_read_config();
+
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ unsigned int target = TARGET_DEFAULT;
+ loc_eng_read_config();
+
+ target = loc_get_target();
+ LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
+
+ sGnssType = getTargetGnssType(target);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ //APQ8064
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ gss_fd = open("/dev/gss", O_RDONLY);
+ if (gss_fd < 0) {
+ LOC_LOGE("GSS open failed: %s\n", strerror(errno));
+ }
+ else {
+ LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
+ gps_conf.CAPABILITIES);
+ }
+ break;
+ case GNSS_NONE:
+ //MPQ8064
+ LOC_LOGE("No GPS HW on this target. Not returning interface.");
+ return NULL;
+ case GNSS_QCA1530:
+ // qca1530 chip is present
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ LOC_LOGD("qca1530 present: CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
+ break;
+ }
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/Ax
+
+===========================================================================*/
+static int loc_init(GpsCallbacks* callbacks)
+{
+ int retVal = -1;
+ ENTRY_LOG();
+ LOC_API_ADAPTER_EVENT_MASK_T event;
+
+ if (NULL == callbacks) {
+ LOC_LOGE("loc_init failed. cb = NULL\n");
+ EXIT_LOG(%d, retVal);
+ return retVal;
+ }
+
+ event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
+ callbacks->status_cb, /* status_cb */
+ local_sv_cb, /* sv_status_cb */
+ callbacks->nmea_cb, /* nmea_cb */
+ callbacks->set_capabilities_cb, /* set_capabilities_cb */
+ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
+ callbacks->release_wakelock_cb, /* release_wakelock_cb */
+ callbacks->create_thread_cb, /* create_thread_cb */
+ NULL, /* location_ext_parser */
+ NULL, /* sv_ext_parser */
+ callbacks->request_utc_time_cb, /* request_utc_time_cb */
+ };
+
+ gps_loc_cb = callbacks->location_cb;
+ gps_sv_cb = callbacks->sv_status_cb;
+
+ retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
+ loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->setGpsLockMsg(0);
+ loc_afw_data.adapter->requestUlp(getCarrierCapabilities());
+
+ if(retVal) {
+ LOC_LOGE("loc_eng_init() fail!");
+ goto err;
+ }
+
+ loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530);
+ loc_afw_data.adapter->setPowerVote(true);
+
+ LOC_LOGD("loc_eng_init() success!");
+
+err:
+ EXIT_LOG(%d, retVal);
+ return retVal;
+}
+
+/*===========================================================================
+FUNCTION loc_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_cleanup()
+{
+ ENTRY_LOG();
+
+ loc_afw_data.adapter->setPowerVote(false);
+ loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK);
+
+ loc_eng_cleanup(loc_afw_data);
+ gps_loc_cb = NULL;
+ gps_sv_cb = NULL;
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_start()
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_start(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_stop()
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ ret_val = loc_eng_stop(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_set_position_mode(GpsPositionMode mode,
+ GpsPositionRecurrence recurrence,
+ uint32_t min_interval,
+ uint32_t preferred_accuracy,
+ uint32_t preferred_time)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ LocPositionMode locMode;
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ locMode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ locMode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ locMode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+
+ LocPosMode params(locMode, recurrence, min_interval,
+ preferred_accuracy, preferred_time, NULL, NULL);
+ ret_val = loc_eng_set_position_mode(loc_afw_data, params);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG();
+ int ret_val = 0;
+
+ ret_val = loc_eng_inject_time(loc_afw_data, time,
+ timeReference, uncertainty);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_inject_location(double latitude, double longitude, float accuracy)
+{
+ ENTRY_LOG();
+
+ int ret_val = 0;
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_delete_aiding_data(GpsAidingData f)
+{
+ ENTRY_LOG();
+ loc_eng_delete_aiding_data(loc_afw_data, f);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+const GpsGeofencingInterface* get_geofence_interface(void)
+{
+ ENTRY_LOG();
+ void *handle;
+ const char *error;
+ typedef const GpsGeofencingInterface* (*get_gps_geofence_interface_function) (void);
+ get_gps_geofence_interface_function get_gps_geofence_interface;
+ static const GpsGeofencingInterface* geofence_interface = NULL;
+
+ dlerror(); /* Clear any existing error */
+
+ handle = dlopen ("libgeofence.so", RTLD_NOW);
+
+ if (!handle)
+ {
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlopen for libgeofence.so failed, error = %s\n", __func__, error);
+ }
+ goto exit;
+ }
+ dlerror(); /* Clear any existing error */
+ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
+ if ((error = dlerror()) != NULL && NULL != get_gps_geofence_interface) {
+ LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
+ goto exit;
+ }
+
+ geofence_interface = get_gps_geofence_interface();
+
+exit:
+ EXIT_LOG(%d, geofence_interface == NULL);
+ return geofence_interface;
+}
+/*===========================================================================
+FUNCTION loc_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* loc_get_extension(const char* name)
+{
+ ENTRY_LOG();
+ const void* ret_val = NULL;
+
+ LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsInterface;
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngNiInterface;
+ }
+ else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
+ {
+ char baseband[PROPERTY_VALUE_MAX];
+ property_get("ro.baseband", baseband, "msm");
+ if (strcmp(baseband, "csfb") == 0)
+ {
+ ret_val = &sLocEngAGpsRilInterface;
+ }
+ }
+ else if (strcmp(name, GPS_GEOFENCING_INTERFACE) == 0)
+ {
+ if ((gps_conf.CAPABILITIES | GPS_CAPABILITY_GEOFENCING) == gps_conf.CAPABILITIES ){
+ ret_val = get_geofence_interface();
+ }
+ }
+ else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsCertInterface;
+ }
+ else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngConfigInterface;
+ }
+ else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngGpsMeasurementInterface;
+ }
+ else
+ {
+ LOC_LOGE ("get_extension: Invalid interface passed in\n");
+ }
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_init(AGpsCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_agps_init(loc_afw_data, (AGpsExtCallbacks*)callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open(const char* apn)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType = AGPS_APN_BEARER_IPV4;
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_with_apniptype
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType;
+
+ switch (apnIpType) {
+ case APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_closed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_agps_open_failed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_set_server
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ LocServerType serverType;
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ break;
+ case AGPS_TYPE_C2K:
+ serverType = LOC_AGPS_CDMA_PDE_SERVER;
+ break;
+ default:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ }
+ int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTIONf571
+ loc_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ GpsXtraExtCallbacks extCallbacks;
+ memset(&extCallbacks, 0, sizeof(extCallbacks));
+ extCallbacks.download_request_cb = callbacks->download_request_cb;
+ int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_xtra_inject_data
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_inject_data(char* data, int length)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE))
+ ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
+ else
+ LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d",
+ __func__, data, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_init
+
+DESCRIPTION
+ This function initializes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_gps_measurement_init(loc_afw_data,
+ callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_close
+
+DESCRIPTION
+ This function closes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_gps_measurement_close()
+{
+ ENTRY_LOG();
+ loc_eng_gps_measurement_close(loc_afw_data);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_init(GpsNiCallbacks *callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG();
+ loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+// Below stub functions are members of sLocEngAGpsRilInterface
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {}
+
+/*===========================================================================
+FUNCTION loc_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_ril_update_network_availability(int available, const char* apn)
+{
+ ENTRY_LOG();
+ loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length)
+{
+ ENTRY_LOG();
+ LOC_LOGE("%s:%d]: agps_revoke_certificates not supported");
+ int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static void loc_configuration_update(const char* config_data, int32_t length)
+{
+ ENTRY_LOG();
+ loc_eng_configuration_update(loc_afw_data, config_data, length);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ case GNSS_QCA1530:
+ //APQ
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ break;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_loc_cb(UlpLocation* location, void* locExt)
+{
+ ENTRY_LOG();
+ if (NULL != location) {
+ CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
+
+ if (NULL != gps_loc_cb) {
+ gps_loc_cb(&location->gpsLocation);
+ }
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
+{
+ ENTRY_LOG();
+ if (NULL != gps_sv_cb) {
+ CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
+ gps_sv_cb(sv_status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc.h b/msm8994/loc_api/libloc_api_50001/loc.h
new file mode 100644
index 0000000..e56fdcf
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc.h
@@ -0,0 +1,66 @@
+/* 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 __LOC_H__
+#define __LOC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/
+
+typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
+typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
+typedef void* (*loc_ext_parser)(void* data);
+
+typedef struct {
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ gps_request_utc_time request_utc_time_cb;
+} LocCallbacks;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_H__
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng.cpp
new file mode 100644
index 0000000..d5f73c2
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng.cpp
@@ -0,0 +1,2999 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <time.h>
+#include <new>
+#include <LocEngAdapter.h>
+
+#include <cutils/sched_policy.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+#include <glib.h>
+#include <sys/syscall.h>
+#endif /* USE_GLIB */
+
+#include <string.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_dmn_conn.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_msg.h>
+#include <loc_eng_nmea.h>
+#include <msg_q.h>
+#include <loc.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_core_log.h"
+#include "loc_eng_log.h"
+
+#define SUCCESS TRUE
+#define FAILURE FALSE
+
+#ifndef GPS_CONF_FILE
+#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
+#endif
+
+#ifndef SAP_CONF_FILE
+#define SAP_CONF_FILE "/etc/sap.conf"
+#endif
+
+#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net"
+
+using namespace loc_core;
+
+boolean configAlreadyRead = false;
+unsigned int agpsStatus = 0;
+loc_gps_cfg_s_type gps_conf;
+loc_sap_cfg_s_type sap_conf;
+
+/* Parameter spec table */
+static loc_param_s_type gps_conf_table[] =
+{
+ {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'},
+ {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
+ {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+ {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
+ {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'},
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
+ {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
+ {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'},
+ {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'},
+ {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'},
+ {"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
+};
+
+static loc_param_s_type sap_conf_table[] =
+{
+ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'}
+};
+
+static void loc_default_parameters(void)
+{
+ /*Defaults for gps.conf*/
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.NMEA_PROVIDER = 0;
+ gps_conf.GPS_LOCK = 0;
+ gps_conf.SUPL_VER = 0x10000;
+ gps_conf.SUPL_MODE = 0x3;
+ gps_conf.CAPABILITIES = 0x7;
+ /* LTE Positioning Profile configuration is disable by default*/
+ gps_conf.LPP_PROFILE = 0;
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+ /*XTRA version check is disabled by default*/
+ gps_conf.XTRA_VERSION_CHECK=0;
+ /*Use emergency PDN by default*/
+ gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
+
+ /*Defaults for sap.conf*/
+ sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ sap_conf.SENSOR_USAGE = 0; /* Enabled */
+ sap_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 */
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ /* default provider is SSC */
+ sap_conf.SENSOR_PROVIDER = 1;
+
+ /* None of the 10 slots for agps certificates are writable by default */
+ gps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+}
+
+// 2nd half of init(), singled out for
+// modem restart to use.
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
+
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+// Internal functions
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_report_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_process_conn_request(loc_eng_data_s_type &loc_eng_data,
+ int connHandle, AGpsType agps_type);
+static void loc_eng_agps_close_status(loc_eng_data_s_type &loc_eng_data, int is_succ);
+static void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data) ;
+static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
+static void deleteAidingData(loc_eng_data_s_type &logEng);
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
+static int dataCallCb(void *cb_data);
+static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ loc_eng_data.adapter->deleteAidingData(loc_eng_data.aiding_data_for_deletion);
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+}
+
+static void* noProc(void* data)
+{
+ return NULL;
+}
+
+
+/*********************************************************************
+ * definitions of the static messages used in the file
+ *********************************************************************/
+// case LOC_ENG_MSG_REQUEST_NI:
+LocEngRequestNi::LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data) :
+ LocMsg(), mLocEng(locEng), mNotify(notif), mPayload(data) {
+ locallog();
+}
+void LocEngRequestNi::proc() const {
+ loc_eng_ni_request_handler(*((loc_eng_data_s_type*)mLocEng),
+ &mNotify, mPayload);
+}
+void LocEngRequestNi::locallog() const
+{
+ LOC_LOGV("id: %d\n type: %s\n flags: %d\n time out: %d\n "
+ "default response: %s\n requestor id encoding: %s\n"
+ " text encoding: %s\n passThroughData: %p",
+ mNotify.notification_id,
+ loc_get_ni_type_name(mNotify.ni_type),
+ mNotify.notify_flags,
+ mNotify.timeout,
+ loc_get_ni_response_name(mNotify.default_response),
+ loc_get_ni_encoding_name(mNotify.requestor_id_encoding),
+ loc_get_ni_encoding_name(mNotify.text_encoding),
+ mPayload);
+}
+inline void LocEngRequestNi::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_INFORM_NI_RESPONSE:
+// in loc_eng_ni.cpp
+
+// case LOC_ENG_MSG_START_FIX:
+LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStartFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_start_handler(*locEng);
+}
+inline void LocEngStartFix::locallog() const
+{
+ LOC_LOGV("LocEngStartFix");
+}
+inline void LocEngStartFix::log() const
+{
+ locallog();
+}
+void LocEngStartFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_STOP_FIX:
+LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStopFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_stop_handler(*locEng);
+}
+inline void LocEngStopFix::locallog() const
+{
+ LOC_LOGV("LocEngStopFix");
+}
+inline void LocEngStopFix::log() const
+{
+ locallog();
+}
+void LocEngStopFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_POSITION_MODE:
+LocEngPositionMode::LocEngPositionMode(LocEngAdapter* adapter,
+ LocPosMode &mode) :
+ LocMsg(), mAdapter(adapter), mPosMode(mode)
+{
+ mPosMode.logv();
+}
+inline void LocEngPositionMode::proc() const {
+ mAdapter->setPositionMode(&mPosMode);
+}
+inline void LocEngPositionMode::log() const {
+ mPosMode.logv();
+}
+void LocEngPositionMode::send() const {
+ mAdapter->sendMsg(this);
+}
+
+LocEngGetZpp::LocEngGetZpp(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngGetZpp::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_get_zpp_handler(*locEng);
+}
+inline void LocEngGetZpp::locallog() const
+{
+ LOC_LOGV("LocEngGetZpp");
+}
+inline void LocEngGetZpp::log() const
+{
+ locallog();
+}
+void LocEngGetZpp::send() const {
+ mAdapter->sendMsg(this);
+}
+
+struct LocEngSetTime : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUtcTime mTime;
+ const int64_t mTimeReference;
+ const int mUncertainty;
+ inline LocEngSetTime(LocEngAdapter* adapter,
+ GpsUtcTime t, int64_t tf, int unc) :
+ LocMsg(), mAdapter(adapter),
+ mTime(t), mTimeReference(tf), mUncertainty(unc)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setTime(mTime, mTimeReference, mUncertainty);
+ }
+ inline void locallog() const {
+ LOC_LOGV("time: %lld\n timeReference: %lld\n uncertainty: %d",
+ mTime, mTimeReference, mUncertainty);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+ // case LOC_ENG_MSG_INJECT_LOCATION:
+struct LocEngInjectLocation : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const double mLatitude;
+ const double mLongitude;
+ const float mAccuracy;
+ inline LocEngInjectLocation(LocEngAdapter* adapter,
+ double lat, double lon, float accur) :
+ LocMsg(), mAdapter(adapter),
+ mLatitude(lat), mLongitude(lon), mAccuracy(accur)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ inline void locallog() const {
+ LOC_LOGV("latitude: %f\n longitude: %f\n accuracy: %f",
+ mLatitude, mLongitude, mAccuracy);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_IPV4:
+struct LocEngSetServerIpv4 : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned int mNlAddr;
+ const int mPort;
+ const LocServerType mServerType;
+ inline LocEngSetServerIpv4(LocEngAdapter* adapter,
+ unsigned int ip,
+ int port,
+ LocServerType type) :
+ LocMsg(), mAdapter(adapter),
+ mNlAddr(ip), mPort(port), mServerType(type)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mNlAddr, mPort, mServerType);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s",
+ mNlAddr, mPort, loc_get_server_type_name(mServerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_URL:
+struct LocEngSetServerUrl : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLen;
+ char* mUrl;
+ inline LocEngSetServerUrl(LocEngAdapter* adapter,
+ char* urlString,
+ int url_len) :
+ LocMsg(), mAdapter(adapter),
+ mLen(url_len), mUrl(new char[mLen+1])
+ {
+ memcpy((void*)mUrl, (void*)urlString, url_len);
+ mUrl[mLen] = 0;
+ locallog();
+ }
+ inline ~LocEngSetServerUrl()
+ {
+ delete[] mUrl;
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mUrl, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
+struct LocEngAGlonassProtocol : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned long mAGlonassProtocl;
+ inline LocEngAGlonassProtocol(LocEngAdapter* adapter,
+ unsigned long protocol) :
+ LocMsg(), mAdapter(adapter), mAGlonassProtocl(protocol)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setAGLONASSProtocol(mAGlonassProtocl);
+ }
+ inline void locallog() const {
+ LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SUPL_VERSION:
+struct LocEngSuplVer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSuplVer;
+ inline LocEngSuplVer(LocEngAdapter* adapter,
+ int suplVer) :
+ LocMsg(), mAdapter(adapter), mSuplVer(suplVer)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSUPLVersion(mSuplVer);
+ }
+ inline void locallog() const {
+ LOC_LOGV("SUPL Version: %d", mSuplVer);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSuplMode : public LocMsg {
+ UlpProxyBase* mUlp;
+
+ inline LocEngSuplMode(UlpProxyBase* ulp) :
+ LocMsg(), mUlp(ulp)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mUlp->setCapabilities(getCarrierCapabilities());
+ }
+ inline void locallog() const {
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LPP_CONFIG:
+struct LocEngLppConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLppConfig;
+ inline LocEngLppConfig(LocEngAdapter* adapter,
+ int lppConfig) :
+ LocMsg(), mAdapter(adapter), mLppConfig(lppConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setLPPConfig(mLppConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG:
+struct LocEngSensorControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSensorsDisabled;
+ const int mSensorProvider;
+ inline LocEngSensorControlConfig(LocEngAdapter* adapter,
+ int sensorsDisabled, int sensorProvider) :
+ LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled),
+ mSensorProvider(sensorProvider)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d",
+ mSensorsDisabled, mSensorProvider);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PROPERTIES:
+struct LocEngSensorProperties : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const bool mGyroBiasVarianceRandomWalkValid;
+ const float mGyroBiasVarianceRandomWalk;
+ const bool mAccelRandomWalkValid;
+ const float mAccelRandomWalk;
+ const bool mAngleRandomWalkValid;
+ const float mAngleRandomWalk;
+ const bool mRateRandomWalkValid;
+ const float mRateRandomWalk;
+ const bool mVelocityRandomWalkValid;
+ const float mVelocityRandomWalk;
+ inline LocEngSensorProperties(LocEngAdapter* adapter,
+ bool gyroBiasRandomWalk_valid,
+ float gyroBiasRandomWalk,
+ bool accelRandomWalk_valid,
+ float accelRandomWalk,
+ bool angleRandomWalk_valid,
+ float angleRandomWalk,
+ bool rateRandomWalk_valid,
+ float rateRandomWalk,
+ bool velocityRandomWalk_valid,
+ float velocityRandomWalk) :
+ LocMsg(), mAdapter(adapter),
+ mGyroBiasVarianceRandomWalkValid(gyroBiasRandomWalk_valid),
+ mGyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
+ mAccelRandomWalkValid(accelRandomWalk_valid),
+ mAccelRandomWalk(accelRandomWalk),
+ mAngleRandomWalkValid(angleRandomWalk_valid),
+ mAngleRandomWalk(angleRandomWalk),
+ mRateRandomWalkValid(rateRandomWalk_valid),
+ mRateRandomWalk(rateRandomWalk),
+ mVelocityRandomWalkValid(velocityRandomWalk_valid),
+ mVelocityRandomWalk(velocityRandomWalk)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorProperties(mGyroBiasVarianceRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalkValid,
+ mAccelRandomWalk,
+ mAngleRandomWalkValid,
+ mAngleRandomWalk,
+ mRateRandomWalkValid,
+ mRateRandomWalk,
+ mVelocityRandomWalkValid,
+ mVelocityRandomWalk);
+ }
+ inline void locallog() const {
+ LOC_LOGV("Sensor properties validity, Gyro Random walk: %d "
+ "Accel Random Walk: %d "
+ "Angle Random Walk: %d Rate Random Walk: %d "
+ "Velocity Random Walk: %d\n"
+ "Sensor properties, Gyro Random walk: %f "
+ "Accel Random Walk: %f "
+ "Angle Random Walk: %f Rate Random Walk: %f "
+ "Velocity Random Walk: %f",
+ mGyroBiasVarianceRandomWalkValid,
+ mAccelRandomWalkValid,
+ mAngleRandomWalkValid,
+ mRateRandomWalkValid,
+ mVelocityRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalk,
+ mAngleRandomWalk,
+ mRateRandomWalk,
+ mVelocityRandomWalk
+ );
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG:
+struct LocEngSensorPerfControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mControlMode;
+ const int mAccelSamplesPerBatch;
+ const int mAccelBatchesPerSec;
+ const int mGyroSamplesPerBatch;
+ const int mGyroBatchesPerSec;
+ const int mAccelSamplesPerBatchHigh;
+ const int mAccelBatchesPerSecHigh;
+ const int mGyroSamplesPerBatchHigh;
+ const int mGyroBatchesPerSecHigh;
+ const int mAlgorithmConfig;
+ inline LocEngSensorPerfControlConfig(LocEngAdapter* adapter,
+ int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig) :
+ LocMsg(), mAdapter(adapter),
+ mControlMode(controlMode),
+ mAccelSamplesPerBatch(accelSamplesPerBatch),
+ mAccelBatchesPerSec(accelBatchesPerSec),
+ mGyroSamplesPerBatch(gyroSamplesPerBatch),
+ mGyroBatchesPerSec(gyroBatchesPerSec),
+ mAccelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
+ mAccelBatchesPerSecHigh(accelBatchesPerSecHigh),
+ mGyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
+ mGyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
+ mAlgorithmConfig(algorithmConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorPerfControlConfig(mControlMode,
+ mAccelSamplesPerBatch,
+ mAccelBatchesPerSec,
+ mGyroSamplesPerBatch,
+ mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh,
+ mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh,
+ mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("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",
+ mControlMode,
+ mAccelSamplesPerBatch, mAccelBatchesPerSec,
+ mGyroSamplesPerBatch, mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh, mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh, mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_EXT_POWER_CONFIG:
+struct LocEngExtPowerConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mIsBatteryCharging;
+ inline LocEngExtPowerConfig(LocEngAdapter* adapter,
+ int isBatteryCharging) :
+ LocMsg(), mAdapter(adapter),
+ mIsBatteryCharging(isBatteryCharging)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setExtPowerConfig(mIsBatteryCharging);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
+ mIsBatteryCharging);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_POSITION:
+LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology) :
+ LocMsg(), mAdapter(adapter), mLocation(loc),
+ mLocationExtended(locExtended),
+ mLocationExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->location_ext_parser(locExt)),
+ mStatus(st), mTechMask(technology)
+{
+ locallog();
+}
+void LocEngReportPosition::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
+ bool reported = false;
+ if (locEng->location_cb != NULL) {
+ if (LOC_SESS_FAILURE == mStatus) {
+ // in case we want to handle the failure case
+ locEng->location_cb(NULL, NULL);
+ reported = true;
+ }
+ // what's in the else if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ else if ((LOC_SESS_SUCCESS == mStatus &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID) &
+ mTechMask)) ||
+ (LOC_SESS_INTERMEDIATE == locEng->intermediateFix &&
+ !((mLocation.gpsLocation.flags &
+ GPS_LOCATION_HAS_ACCURACY) &&
+ (gps_conf.ACCURACY_THRES != 0) &&
+ (mLocation.gpsLocation.accuracy >
+ gps_conf.ACCURACY_THRES)))) {
+ locEng->location_cb((UlpLocation*)&(mLocation),
+ (void*)mLocationExt);
+ reported = true;
+ }
+ }
+
+ // if we have reported this fix
+ if (reported &&
+ // and if this is a singleshot
+ GPS_POSITION_RECURRENCE_SINGLE ==
+ locEng->adapter->getPositionMode().recurrence) {
+ if (LOC_SESS_INTERMEDIATE == mStatus) {
+ // modem could be still working for a final fix,
+ // although we no longer need it. So stopFix().
+ locEng->adapter->stopFix();
+ }
+ // turn off the session flag.
+ locEng->adapter->setInSession(false);
+ }
+
+ if (locEng->generateNmea &&
+ mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS &&
+ mTechMask & (LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID))
+ {
+ unsigned char generate_nmea = reported &&
+ (mStatus != LOC_SESS_FAILURE);
+ loc_eng_nmea_generate_pos(locEng, mLocation, mLocationExtended,
+ generate_nmea);
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(mLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+ }
+}
+void LocEngReportPosition::locallog() const {
+ LOC_LOGV("LocEngReportPosition");
+}
+void LocEngReportPosition::log() const {
+ locallog();
+}
+void LocEngReportPosition::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+// case LOC_ENG_MSG_REPORT_SV:
+LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExt) :
+ LocMsg(), mAdapter(adapter), mSvStatus(sv),
+ mLocationExtended(locExtended),
+ mSvExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->sv_ext_parser(svExt))
+{
+ locallog();
+}
+void LocEngReportSv::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->sv_status_cb != NULL) {
+ locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus),
+ (void*)mSvExt);
+ }
+
+ if (locEng->generateNmea)
+ {
+ loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
+ }
+ }
+}
+void LocEngReportSv::locallog() const {
+ LOC_LOGV("%s:%d] LocEngReportSv",__func__, __LINE__);
+}
+inline void LocEngReportSv::log() const {
+ locallog();
+}
+void LocEngReportSv::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REPORT_STATUS:
+LocEngReportStatus::LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus) :
+ LocMsg(), mAdapter(adapter), mStatus(engineStatus)
+{
+ locallog();
+}
+inline void LocEngReportStatus::proc() const
+{
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ loc_eng_report_status(*locEng, mStatus);
+ update_aiding_data_for_deletion(*locEng);
+}
+inline void LocEngReportStatus::locallog() const {
+ LOC_LOGV("LocEngReportStatus");
+}
+inline void LocEngReportStatus::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_NMEA:
+LocEngReportNmea::LocEngReportNmea(void* locEng,
+ const char* data, int len) :
+ LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
+{
+ memcpy((void*)mNmea, (void*)data, len);
+ locallog();
+}
+void LocEngReportNmea::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ CALLBACK_LOG_CALLFLOW("nmea_cb", %d, mLen);
+
+ if (locEng->nmea_cb != NULL)
+ locEng->nmea_cb(now, mNmea, mLen);
+}
+inline void LocEngReportNmea::locallog() const {
+ LOC_LOGV("LocEngReportNmea");
+}
+inline void LocEngReportNmea::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_XTRA_SERVER:
+LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
+ const char *url1,
+ const char *url2,
+ const char *url3,
+ const int maxlength) :
+ LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
+ mServers(new char[3*(mMaxLen+1)])
+{
+ char * cptr = mServers;
+ memset(mServers, 0, 3*(mMaxLen+1));
+
+ // Override modem URLs with uncommented gps.conf urls
+ if( gps_conf.XTRA_SERVER_1[0] != '\0' ) {
+ url1 = &gps_conf.XTRA_SERVER_1[0];
+ }
+ if( gps_conf.XTRA_SERVER_2[0] != '\0' ) {
+ url2 = &gps_conf.XTRA_SERVER_2[0];
+ }
+ if( gps_conf.XTRA_SERVER_3[0] != '\0' ) {
+ url3 = &gps_conf.XTRA_SERVER_3[0];
+ }
+ // copy non xtra1.gpsonextra.net URLs into the forwarding buffer.
+ if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url1, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url2, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url3, mMaxLen + 1);
+ }
+ locallog();
+}
+
+void LocEngReportXtraServer::proc() const {
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->report_xtra_server_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("report_xtra_server_cb", %s, mServers);
+ locEngXtra->report_xtra_server_cb(mServers,
+ &(mServers[mMaxLen+1]),
+ &(mServers[(mMaxLen+1)<<1]));
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngReportXtraServer::locallog() const {
+ LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n"
+ " server3: %s\n",
+ mServers, &mServers[mMaxLen+1], &mServers[(mMaxLen+1)<<1]);
+}
+inline void LocEngReportXtraServer::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_BIT:
+// case LOC_ENG_MSG_RELEASE_BIT:
+LocEngReqRelBIT::LocEngReqRelBIT(void* locEng, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mIPv4Addr(ipv4),
+ mIPv6Addr(ipv6 ? new char[16] : NULL), mIsReq(isReq) {
+ if (NULL != ipv6)
+ memcpy(mIPv6Addr, ipv6, 16);
+ locallog();
+}
+inline LocEngReqRelBIT::~LocEngReqRelBIT() {
+ if (mIPv6Addr) {
+ delete[] mIPv6Addr;
+ }
+}
+void LocEngReqRelBIT::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ BITSubscriber s(getAgpsStateMachine(*locEng, mType),
+ mIPv4Addr, mIPv6Addr);
+ AgpsStateMachine* sm = (AgpsStateMachine*)s.mStateMachine;
+
+ if (mIsReq) {
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ sm->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelBIT::locallog() const {
+ LOC_LOGV("LocEngRequestBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)mIPv4Addr,
+ (unsigned char)(mIPv4Addr>>8),
+ (unsigned char)(mIPv4Addr>>16),
+ (unsigned char)(mIPv4Addr>>24),
+ NULL != mIPv6Addr ? mIPv6Addr : "");
+}
+inline void LocEngReqRelBIT::log() const {
+ locallog();
+}
+void LocEngReqRelBIT::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_RELEASE_BIT:
+struct LocEngReleaseBIT : public LocMsg {
+ const BITSubscriber mSubscriber;
+ inline LocEngReleaseBIT(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ LocMsg(),
+ mSubscriber(stateMachine, ipv4, ipv6)
+ {
+ locallog();
+ }
+ inline virtual void proc() const
+ {
+ AgpsStateMachine* sm = (AgpsStateMachine*)mSubscriber.mStateMachine;
+ sm->unsubscribeRsrc((Subscriber*)&mSubscriber);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngReleaseBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mSubscriber.ID>>24),
+ (unsigned char)(mSubscriber.ID>>16),
+ (unsigned char)(mSubscriber.ID>>8),
+ (unsigned char)mSubscriber.ID,
+ NULL != mSubscriber.mIPv6Addr ? mSubscriber.mIPv6Addr : "");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// LocEngSuplEsOpened
+LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsOpened::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_GRANTED);
+ }
+}
+void LocEngSuplEsOpened::locallog() const {
+ LOC_LOGV("LocEngSuplEsOpened");
+}
+void LocEngSuplEsOpened::log() const {
+ locallog();
+}
+
+// LocEngSuplEsClosed
+LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsClosed::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_RELEASED);
+ }
+}
+void LocEngSuplEsClosed::locallog() const {
+ LOC_LOGV("LocEngSuplEsClosed");
+}
+void LocEngSuplEsClosed::log() const {
+ locallog();
+}
+
+
+// case LOC_ENG_MSG_REQUEST_SUPL_ES:
+LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngRequestSuplEs::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ DSSubscriber s(sm, mID);
+ sm->subscribeRsrc((Subscriber*)&s);
+ }
+ else if (locEng->agnss_nif) {
+ AgpsStateMachine *sm = locEng->agnss_nif;
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ false);
+ sm->subscribeRsrc((Subscriber*)&s);
+ LOC_LOGD("%s:%d]: Using regular ATL for SUPL ES", __func__, __LINE__);
+ }
+ else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1);
+ }
+}
+inline void LocEngRequestSuplEs::locallog() const {
+ LOC_LOGV("LocEngRequestSuplEs");
+}
+inline void LocEngRequestSuplEs::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_ATL:
+LocEngRequestATL::LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type) :
+ LocMsg(), mLocEng(locEng), mID(id), mType(agps_type) {
+ locallog();
+}
+void LocEngRequestATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = (AgpsStateMachine*)
+ getAgpsStateMachine(*locEng, mType);
+ if (sm) {
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ AGPS_TYPE_INVALID == mType);
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngRequestATL::locallog() const {
+ LOC_LOGV("LocEngRequestATL");
+}
+inline void LocEngRequestATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_RELEASE_ATL:
+LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngReleaseATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+
+ if (locEng->agnss_nif) {
+ ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false);
+ if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->internet_nif) {
+ ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false);
+ if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from internet_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->ds_nif) {
+ DSSubscriber s3(locEng->ds_nif, mID);
+ if (locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from ds_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ LOC_LOGW("%s:%d]: Could not release ATL. "
+ "No subscribers found\n",
+ __func__, __LINE__);
+ locEng->adapter->atlCloseStatus(mID, 0);
+}
+inline void LocEngReleaseATL::locallog() const {
+ LOC_LOGV("LocEngReleaseATL");
+}
+inline void LocEngReleaseATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_WIFI:
+// case LOC_ENG_MSG_RELEASE_WIFI:
+LocEngReqRelWifi::LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mSenderId(sender_id),
+ mSSID(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == p ? NULL : new char[SSID_BUF_SIZE]),
+ mIsReq(isReq) {
+ if (NULL != s)
+ strlcpy(mSSID, s, SSID_BUF_SIZE);
+ if (NULL != p)
+ strlcpy(mPassword, p, SSID_BUF_SIZE);
+ locallog();
+}
+LocEngReqRelWifi::~LocEngReqRelWifi() {
+ if (NULL != mSSID) {
+ delete[] mSSID;
+ }
+ if (NULL != mPassword) {
+ delete[] mPassword;
+ }
+}
+void LocEngReqRelWifi::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->wifi_nif) {
+ WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
+ if (mIsReq) {
+ locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
+ }
+ } else {
+ locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngReqRelWifi::locallog() const {
+ LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
+ mIsReq ? "LocEngRequestWifi" : "LocEngReleaseWifi",
+ mSenderId,
+ NULL != mSSID ? mSSID : "",
+ NULL != mPassword ? mPassword : "");
+}
+inline void LocEngReqRelWifi::log() const {
+ locallog();
+}
+void LocEngReqRelWifi::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REQUEST_XTRA_DATA:
+LocEngRequestXtra::LocEngRequestXtra(void* locEng) :
+ mLocEng(locEng) {
+ locallog();
+}
+void LocEngRequestXtra::proc() const
+{
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->download_request_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("download_request_cb", %p, mLocEng);
+ locEngXtra->download_request_cb();
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngRequestXtra::locallog() const {
+ LOC_LOGV("LocEngReqXtra");
+}
+inline void LocEngRequestXtra::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_TIME:
+LocEngRequestTime::LocEngRequestTime(void* locEng) :
+ LocMsg(), mLocEng(locEng)
+{
+ locallog();
+}
+void LocEngRequestTime::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (gps_conf.CAPABILITIES & GPS_CAPABILITY_ON_DEMAND_TIME) {
+ if (locEng->request_utc_time_cb != NULL) {
+ locEng->request_utc_time_cb();
+ } else {
+ LOC_LOGE("Callback function for request time is NULL");
+ }
+ }
+}
+inline void LocEngRequestTime::locallog() const {
+ LOC_LOGV("LocEngReqTime");
+}
+inline void LocEngRequestTime::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_DELETE_AIDING_DATA:
+struct LocEngDelAidData : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ const GpsAidingData mType;
+ inline LocEngDelAidData(loc_eng_data_s_type* locEng,
+ GpsAidingData f) :
+ LocMsg(), mLocEng(locEng), mType(f)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocEng->aiding_data_for_deletion = mType;
+ update_aiding_data_for_deletion(*mLocEng);
+ }
+ inline void locallog() const {
+ LOC_LOGV("aiding data msak %d", mType);
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENABLE_DATA:
+struct LocEngEnableData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mEnable;
+ char* mAPN;
+ const int mLen;
+ inline LocEngEnableData(LocEngAdapter* adapter,
+ const char* name, int len, int enable) :
+ LocMsg(), mAdapter(adapter),
+ mEnable(enable), mAPN(NULL), mLen(len)
+ {
+ if (NULL != name) {
+ mAPN = new char[len+1];
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ }
+ locallog();
+ }
+ inline ~LocEngEnableData() {
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter->enableData(mEnable);
+ if (NULL != mAPN) {
+ mAdapter->setAPN(mAPN, mLen);
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("apn: %s\n enable: %d",
+ (NULL == mAPN) ? "NULL" : mAPN, mEnable);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_INJECT_XTRA_DATA:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_SET_CAPABILITIES:
+struct LocEngSetCapabilities : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_capabilities_cb) {
+ LOC_LOGV("calling set_capabilities_cb 0x%x",
+ gps_conf.CAPABILITIES);
+ mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES);
+ } else {
+ LOC_LOGV("set_capabilities_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetCapabilities");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LOC_INIT:
+struct LocEngInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_reinit(*mLocEng);
+ // set the capabilities
+ mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInit");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REQUEST_XTRA_SERVER:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
+struct LocEngAtlOpenSuccess : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ const int mLen;
+ char* mAPN;
+ const AGpsBearerType mBearerType;
+ inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
+ const char* name,
+ int len,
+ AGpsBearerType btype) :
+ LocMsg(),
+ mStateMachine(statemachine), mLen(len),
+ mAPN(new char[len+1]), mBearerType(btype)
+ {
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ locallog();
+ }
+ inline ~LocEngAtlOpenSuccess()
+ {
+ delete[] mAPN;
+ }
+ inline virtual void proc() const {
+ mStateMachine->setBearer(mBearerType);
+ mStateMachine->setAPN(mAPN, mLen);
+ mStateMachine->onRsrcEvent(RSRC_GRANTED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n"
+ " bearer type: %s",
+ loc_get_agps_type_name(mStateMachine->getType()),
+ mAPN,
+ loc_get_agps_bear_name(mBearerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_CLOSED:
+struct LocEngAtlClosed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_RELEASED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_OPEN_FAILED:
+struct LocEngAtlOpenFailed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_DENIED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenFailed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENGINE_DOWN:
+LocEngDown::LocEngDown(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngDown::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_down(*locEng);
+}
+inline void LocEngDown::locallog() const {
+ LOC_LOGV("LocEngDown");
+}
+inline void LocEngDown::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_ENGINE_UP:
+LocEngUp::LocEngUp(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngUp::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_up(*locEng);
+}
+inline void LocEngUp::locallog() const {
+ LOC_LOGV("LocEngUp");
+}
+inline void LocEngUp::log() const {
+ locallog();
+}
+
+struct LocEngDataClientInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngDataClientInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+ }
+ virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ if(!locEng->adapter->initDataServiceClient()) {
+ locEng->ds_nif = new DSStateMachine(servicerTypeExt,
+ (void *)dataCallCb,
+ locEng->adapter);
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngDataClientInit\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInstallAGpsCert : public LocMsg {
+ LocEngAdapter* mpAdapter;
+ const size_t mNumberOfCerts;
+ const uint32_t mSlotBitMask;
+ DerEncodedCertificate* mpData;
+ inline LocEngInstallAGpsCert(LocEngAdapter* adapter,
+ const DerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask) :
+ LocMsg(), mpAdapter(adapter),
+ mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask),
+ mpData(new DerEncodedCertificate[mNumberOfCerts])
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ mpData[i].data = new u_char[pData[i].length];
+ if (mpData[i].data) {
+ memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length);
+ mpData[i].length = pData[i].length;
+ } else {
+ LOC_LOGE("malloc failed for cert#%d", i);
+ break;
+ }
+ }
+ locallog();
+ }
+ inline ~LocEngInstallAGpsCert()
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ if (mpData[i].data) {
+ delete[] mpData[i].data;
+ }
+ }
+ delete[] mpData;
+ }
+ inline virtual void proc() const {
+ mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u",
+ mNumberOfCerts, mSlotBitMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngUpdateRegistrationMask : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ loc_registration_mask_status mIsEnabled;
+ inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng,
+ LOC_API_ADAPTER_EVENT_MASK_T mask,
+ loc_registration_mask_status isEnabled) :
+ LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ locEng->adapter->updateRegistrationMask(mMask,
+ mIsEnabled);
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngUpdateRegistrationMask\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngGnssConstellationConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (mAdapter->gnssConstellationConfig()) {
+ LOC_LOGV("Modem supports GNSS measurements\n");
+ gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
+ } else {
+ LOC_LOGV("Modem does not support GNSS measurements\n");
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngGnssConstellationConfig\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
+LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng,
+ GpsData &gpsData) :
+ LocMsg(), mLocEng(locEng), mGpsData(gpsData)
+{
+ locallog();
+}
+void LocEngReportGpsMeasurement::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gps_measurement_cb != NULL) {
+ locEng->gps_measurement_cb((GpsData*)&(mGpsData));
+ }
+ }
+}
+void LocEngReportGpsMeasurement::locallog() const {
+ IF_LOC_LOGV {
+ LOC_LOGV("%s:%d]: Received in GPS HAL."
+ "GNSS Measurements count: %d \n",
+ __func__, __LINE__, mGpsData.measurement_count);
+ for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) {
+ LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
+ " GPS_HAL => Measurement ID | prn | time_offset_ns | state |"
+ " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |"
+ " pseudorange_rate_uncertainty_mps |"
+ " accumulated_delta_range_state | flags \n"
+ " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n",
+ i,
+ mGpsData.measurements[i].prn,
+ mGpsData.measurements[i].time_offset_ns,
+ mGpsData.measurements[i].state,
+ mGpsData.measurements[i].received_gps_tow_ns,
+ mGpsData.measurements[i].c_n0_dbhz,
+ mGpsData.measurements[i].pseudorange_rate_mps,
+ mGpsData.measurements[i].pseudorange_rate_uncertainty_mps,
+ mGpsData.measurements[i].accumulated_delta_range_state,
+ mGpsData.measurements[i].flags);
+ }
+ LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n"
+ " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type,
+ mGpsData.clock.time_ns);
+ }
+}
+inline void LocEngReportGpsMeasurement::log() const {
+ locallog();
+}
+
+/*********************************************************************
+ * Initialization checking macros
+ *********************************************************************/
+#define STATE_CHECK(ctx, x, ret) \
+ if (!(ctx)) \
+ { \
+ /* Not intialized, abort */\
+ LOC_LOGE("%s: log_eng state error: %s", __func__, x); \
+ EXIT_LOG(%s, x); \
+ ret; \
+ }
+#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
+
+uint32_t getCarrierCapabilities() {
+ #define carrierMSA (uint32_t)0x2
+ #define carrierMSB (uint32_t)0x1
+ #define gpsConfMSA (uint32_t)0x4
+ #define gpsConfMSB (uint32_t)0x2
+ uint32_t capabilities = gps_conf.CAPABILITIES;
+ if ((gps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
+ capabilities &= ~gpsConfMSA;
+ }
+ if ((gps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
+ capabilities &= ~gpsConfMSB;
+ }
+
+ LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
+ gps_conf.CAPABILITIES, gps_conf.SUPL_MODE, capabilities);
+ return capabilities;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event, ContextBase* context)
+
+{
+ int ret_val = 0;
+
+ ENTRY_LOG_CALLFLOW();
+ if (NULL == callbacks || 0 == event) {
+ LOC_LOGE("loc_eng_init: bad parameters cb %p eMask %d", callbacks, event);
+ ret_val = -1;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+ }
+
+ STATE_CHECK((NULL == loc_eng_data.adapter),
+ "instance already initialized", return 0);
+
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data));
+
+ // Save callbacks
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+ loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+ loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
+ callbacks->location_ext_parser : noProc;
+ loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
+ callbacks->sv_ext_parser : noProc;
+ loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
+ // initial states taken care of by the memset above
+ // loc_eng_data.engine_status -- GPS_STATUS_NONE;
+ // loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
+ // loc_eng_data.mute_session_state -- LOC_MUTE_SESS_NONE;
+
+ if ((event & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) && (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_AP))
+ {
+ event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
+ loc_eng_data.generateNmea = true;
+ }
+ else
+ {
+ loc_eng_data.generateNmea = false;
+ }
+
+ loc_eng_data.adapter =
+ new LocEngAdapter(event, &loc_eng_data, context,
+ (MsgTask::tCreate)callbacks->create_thread_cb);
+
+ LOC_LOGD("loc_eng_init created client, id = %p\n",
+ loc_eng_data.adapter);
+ loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngGnssConstellationConfig(adapter));
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE,
+ sap_conf.SENSOR_PROVIDER));
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+
+ /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
+ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) {
+ adapter->sendMsg(new LocEngSensorProperties(adapter,
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sap_conf.GYRO_BIAS_RANDOM_WALK,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY));
+ }
+
+ adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter,
+ sap_conf.SENSOR_CONTROL_MODE,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK));
+
+ adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0)));
+
+ loc_eng_xtra_version_check(loc_eng_data, gps_conf.XTRA_VERSION_CHECK);
+
+ LOC_LOGD("loc_eng_reinit reinit() successful");
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // XTRA has no state, so we are fine with it.
+
+ // we need to check and clear NI
+#if 0
+ // we need to check and clear ATL
+ if (NULL != loc_eng_data.agnss_nif) {
+ delete loc_eng_data.agnss_nif;
+ loc_eng_data.agnss_nif = NULL;
+ }
+ if (NULL != loc_eng_data.internet_nif) {
+ delete loc_eng_data.internet_nif;
+ loc_eng_data.internet_nif = NULL;
+ }
+#endif
+ if (loc_eng_data.adapter->isInSession())
+ {
+ LOC_LOGD("loc_eng_cleanup: fix not stopped. stop it now.");
+ loc_eng_stop(loc_eng_data);
+ }
+
+#if 0 // can't afford to actually clean up, for many reason.
+
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ delete loc_eng_data.adapter;
+ loc_eng_data.adapter = NULL;
+
+ loc_eng_dmn_conn_loc_api_server_unblock();
+ loc_eng_dmn_conn_loc_api_server_join();
+
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (!loc_eng_data.adapter->isInSession()) {
+ ret_val = loc_eng_data.adapter->startFix();
+
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS ||
+ ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN ||
+ ret_val == LOC_API_ADAPTER_ERR_PHONE_OFFLINE ||
+ ret_val == LOC_API_ADAPTER_ERR_INTERNAL)
+ {
+ loc_eng_data.adapter->setInSession(TRUE);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_stop_wrapper
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (loc_eng_data.adapter->isInSession()) {
+
+ ret_val = loc_eng_data.adapter->stopFix();
+ loc_eng_data.adapter->setInSession(FALSE);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
+
+DESCRIPTION
+ Mutes one session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: Success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ // The position mode for AUTO/GSS/QCA1530 can only be standalone
+ if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) &&
+ !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
+ (params.mode != LOC_POSITION_MODE_STANDALONE)) {
+ params.mode = LOC_POSITION_MODE_STANDALONE;
+ LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530.");
+ }
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
+ {
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngPositionMode(adapter, params));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
+ int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
+ uncertainty));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
+ double longitude, float accuracy)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ if(adapter->mSupportsPositionInjection)
+ {
+ adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
+ accuracy));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData f)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+
+ if (loc_eng_data.status_cb)
+ {
+ GpsStatus gs = { sizeof(gs),status };
+ CALLBACK_LOG_CALLFLOW("status_cb", %s,
+ loc_get_gps_status_name(gs.status));
+ loc_eng_data.status_cb(&gs);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ UlpLocation location;
+ LocPosTechMask tech_mask = LOC_POS_TECH_MASK_DEFAULT;
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+
+ ret_val = loc_eng_data.adapter->getZpp(location.gpsLocation, tech_mask);
+ //Mark the location source as from ZPP
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_ZPP;
+
+ loc_eng_data.adapter->getUlpProxy()->reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_SUCCESS,
+ tech_mask);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*
+ Callback function passed to Data Services State Machine
+ This becomes part of the state machine's servicer and
+ is used to send requests to the data services client
+*/
+static int dataCallCb(void *cb_data)
+{
+ LOC_LOGD("Enter dataCallCb\n");
+ int ret=0;
+ if(cb_data != NULL) {
+ dsCbData *cbData = (dsCbData *)cb_data;
+ LocEngAdapter *locAdapter = (LocEngAdapter *)cbData->mAdapter;
+ if(cbData->action == GPS_REQUEST_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_REQUEST_AGPS_DATA_CONN\n");
+ ret = locAdapter->openAndStartDataCall();
+ }
+ else if(cbData->action == GPS_RELEASE_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_RELEASE_AGPS_DATA_CONN\n");
+ locAdapter->stopDataCall();
+ }
+ }
+ else {
+ LOC_LOGE("NULL argument received. Failing.\n");
+ ret = -1;
+ goto err;
+ }
+
+err:
+ LOC_LOGD("Exit dataCallCb ret = %d\n", ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_reinit
+
+DESCRIPTION
+ 2nd half of loc_eng_agps_init(), singled out for modem restart to use.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+
+ // Set server addresses which came before init
+ if (loc_eng_data.supl_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_SUPL_SERVER,
+ loc_eng_data.supl_host_buf,
+ loc_eng_data.supl_port_buf);
+ }
+
+ if (loc_eng_data.c2k_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_CDMA_PDE_SERVER,
+ loc_eng_data.c2k_host_buf,
+ loc_eng_data.c2k_port_buf);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+ STATE_CHECK((NULL == loc_eng_data.agps_status_cb),
+ "agps instance already initialized",
+ return);
+ if (callbacks == NULL) {
+ LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks);
+ EXIT_LOG(%s, VOID_RET);
+ return;
+ }
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WWAN_ANY,
+ false);
+ loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WIFI,
+ true);
+
+ if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
+ (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) {
+ loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_SUPL,
+ false);
+
+ if (adapter->mSupportsAgpsRequests) {
+ if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data));
+ }
+ loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
+ NULL, NULL, &loc_eng_data);
+ }
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void deleteAidingData(loc_eng_data_s_type &logEng) {
+ if (logEng.engine_status != GPS_STATUS_ENGINE_ON &&
+ logEng.aiding_data_for_deletion != 0) {
+ logEng.adapter->deleteAidingData(logEng.aiding_data_for_deletion);
+ logEng.aiding_data_for_deletion = 0;
+ }
+}
+
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
+ AgpsStateMachine* stateMachine;
+ switch (agpsType) {
+ case AGPS_TYPE_WIFI: {
+ stateMachine = locEng.wifi_nif;
+ break;
+ }
+ case AGPS_TYPE_INVALID:
+ case AGPS_TYPE_SUPL: {
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ case AGPS_TYPE_SUPL_ES: {
+ locEng.ds_nif ?
+ stateMachine = locEng.ds_nif:
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ default:
+ stateMachine = locEng.internet_nif;
+ }
+ return stateMachine;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ if (apn == NULL)
+ {
+ LOC_LOGE("APN Name NULL\n");
+ return 0;
+ }
+
+ LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
+
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+
+ loc_eng_data.adapter->sendMsg(
+ new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform engine about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION resolve_in_addr
+
+DESCRIPTION
+ Translates a hostname to in_addr struct
+
+DEPENDENCIES
+ n/a
+
+RETURN VALUE
+ TRUE if successful
+
+SIDE EFFECTS
+ n/a
+
+===========================================================================*/
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
+{
+ ENTRY_LOG();
+ boolean ret_val = TRUE;
+
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ ret_val = FALSE;
+ }
+ }
+
+ EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server
+
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ int ret = 0;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ char url[MAX_URL_LEN];
+ unsigned int len = 0;
+ const char nohost[] = "NONE";
+ if (hostname == NULL ||
+ strncasecmp(nohost, hostname, sizeof(nohost)) == 0) {
+ url[0] = '\0';
+ } else {
+ len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port);
+ }
+
+ if (sizeof(url) > len) {
+ adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len));
+ }
+ } else if (LOC_AGPS_CDMA_PDE_SERVER == type ||
+ LOC_AGPS_CUSTOM_PDE_SERVER == type ||
+ LOC_AGPS_MPC_SERVER == type) {
+ struct in_addr addr;
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ ret = -2;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ adapter->sendMsg(new LocEngSetServerIpv4(adapter, ip, port, type));
+ }
+ } else {
+ LOC_LOGE("loc_eng_set_server, type %d cannot be resolved.\n", type);
+ }
+
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server_proxy
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type,
+ const char* hostname, int port)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = 0;
+
+ if (NULL != loc_eng_data.adapter)
+ {
+ ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port);
+ } else {
+ LOC_LOGW("set_server called before init. save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case LOC_AGPS_SUPL_SERVER:
+ strlcpy(loc_eng_data.supl_host_buf, hostname,
+ sizeof(loc_eng_data.supl_host_buf));
+ loc_eng_data.supl_port_buf = port;
+ loc_eng_data.supl_host_set = 1;
+ break;
+ case LOC_AGPS_CDMA_PDE_SERVER:
+ strlcpy(loc_eng_data.c2k_host_buf, hostname,
+ sizeof(loc_eng_data.c2k_host_buf));
+ loc_eng_data.c2k_port_buf = port;
+ loc_eng_data.c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int available, const char* apn)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ //This is to store the status of data availability over the network.
+ //If GPS is not enabled, the INIT_CHECK will fail and the modem will
+ //not be updated with the network's availability. Since the data status
+ //can change before GPS is enabled the, storing the status will enable
+ //us to inform the modem after GPS is enabled
+ agpsStatus = available;
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+ if (apn != NULL)
+ {
+ LOC_LOGD("loc_eng_agps_ril_update_network_availability: APN Name = [%s]\n", apn);
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngEnableData(adapter, apn, apn_len, available));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t numberOfCerts)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+
+ uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK;
+ uint32_t slotCount = 0;
+ for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) {
+ slotBitMaskCounter &= slotBitMaskCounter - 1;
+ }
+ LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u",
+ slotBitMask, slotCount, numberOfCerts);
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (numberOfCerts == 0) {
+ LOC_LOGE("No certs to install, since numberOfCerts is zero");
+ ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+ } else if (!adapter) {
+ LOC_LOGE("adapter is null!");
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ } else if (slotCount < numberOfCerts) {
+ LOC_LOGE("Not enough cert slots (%u) to install %u certs!",
+ slotCount, numberOfCerts);
+ ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES;
+ } else {
+ for (int i=0; i < numberOfCerts; ++i)
+ {
+ if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) {
+ LOC_LOGE("cert#(%u) length of %u is too big! greater than %u",
+ certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH);
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ break;
+ }
+ }
+
+ if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) {
+ adapter->sendMsg(new LocEngInstallAGpsCert(adapter,
+ certificates,
+ numberOfCerts,
+ slotBitMask));
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if (config_data && length > 0) {
+ loc_gps_cfg_s_type gps_conf_tmp = gps_conf;
+ UTIL_UPDATE_CONF(config_data, length, gps_conf_table);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ // it is possible that HAL is not init'ed at this time
+ if (adapter) {
+ if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) {
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ }
+ if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) {
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ }
+ if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) {
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter,
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+ }
+ if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) {
+ adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy()));
+ }
+ }
+
+ gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER;
+ gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE;
+ gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT;
+ gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK;
+ gps_conf = gps_conf_tmp;
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+ // Switch from WAIT to MUTE, for "engine on" or "session begin" event
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+
+ // Switch off MUTE session
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION &&
+ (status == GPS_STATUS_SESSION_END || status == GPS_STATUS_ENGINE_OFF))
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+
+ // Session End is not reported during Android navigating state
+ boolean navigating = loc_eng_data.adapter->isInSession();
+ if (status != GPS_STATUS_NONE &&
+ !(status == GPS_STATUS_SESSION_END && navigating) &&
+ !(status == GPS_STATUS_SESSION_BEGIN && !navigating))
+ {
+ if (loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ // Inform GpsLocationProvider about mNavigating status
+ loc_inform_gps_status(loc_eng_data, status);
+ }
+ else {
+ LOC_LOGD("loc_eng_report_status: muting the status report.");
+ }
+ }
+
+ // Only keeps ENGINE ON/OFF in engine_status
+ if (status == GPS_STATUS_ENGINE_ON || status == GPS_STATUS_ENGINE_OFF)
+ {
+ loc_eng_data.engine_status = status;
+ }
+
+ // Only keeps SESSION BEGIN/END in fix_session_status
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = status;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_engine_down
+ loc_eng_handle_engine_up
+
+DESCRIPTION
+ Calls this function when it is detected that modem restart is happening.
+ Either we detected the modem is down or received modem up event.
+ This must be called from the deferred thread to avoid race condition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_reset_on_engine_restart(loc_eng_data);
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_OFF);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_reinit(loc_eng_data);
+
+ loc_eng_data.adapter->requestPowerVote();
+
+ if (loc_eng_data.agps_status_cb != NULL) {
+ if (loc_eng_data.agnss_nif)
+ loc_eng_data.agnss_nif->dropAllSubscribers();
+ if (loc_eng_data.internet_nif)
+ loc_eng_data.internet_nif->dropAllSubscribers();
+
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ // modem is back up. If we crashed in the middle of navigating, we restart.
+ if (loc_eng_data.adapter->isInSession()) {
+ // This sets the copy in adapter to modem
+ loc_eng_data.adapter->setPositionMode(NULL);
+ loc_eng_data.adapter->setInSession(false);
+ loc_eng_start_handler(loc_eng_data);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+#ifdef USE_GLIB
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+#endif /* USE_GLIB */
+
+/*===========================================================================
+FUNCTION loc_eng_read_config
+
+DESCRIPTION
+ Initiates the reading of the gps config file stored in /etc dir
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_read_config(void)
+{
+ ENTRY_LOG_CALLFLOW();
+ if(configAlreadyRead == false)
+ {
+ // Initialize our defaults before reading of configuration file overwrites them.
+ loc_default_parameters();
+ // We only want to parse the conf file once. This is a good place to ensure that.
+ // In fact one day the conf file should go into context.
+ UTIL_READ_CONF(GPS_CONF_FILE, gps_conf_table);
+ UTIL_READ_CONF(SAP_CONF_FILE, sap_conf_table);
+ configAlreadyRead = true;
+ } else {
+ LOC_LOGV("GPS Config file has already been read\n");
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_init
+
+DESCRIPTION
+ Initialize gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb),
+ "gps measurement already initialized",
+ return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
+ STATE_CHECK((callbacks != NULL),
+ "callbacks can not be NULL",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+ STATE_CHECK(loc_eng_data.adapter,
+ "GpsInterface must be initialized first",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_ENABLED));
+ // set up the callback
+ loc_eng_data.gps_measurement_cb = callbacks->measurement_callback;
+ LOC_LOGD ("%s, event masks updated successfully", __func__);
+
+ return GPS_MEASUREMENT_OPERATION_SUCCESS;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_close
+
+DESCRIPTION
+ Close gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_DISABLED));
+ // set up the callback
+ loc_eng_data.gps_measurement_cb = NULL;
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng.h b/msm8994/loc_api/libloc_api_50001/loc_eng.h
new file mode 100644
index 0000000..a203e6b
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng.h
@@ -0,0 +1,270 @@
+/* Copyright (c) 2009-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_ENG_H
+#define LOC_ENG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+#define MAX_NUM_ATL_CONNECTIONS 2
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc.h>
+#include <loc_eng_xtra.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_agps.h>
+#include <loc_cfg.h>
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_eng_agps.h>
+#include <LocEngAdapter.h>
+
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+#define SUCCESS TRUE
+#define FAILURE FALSE
+#define INVALID_ATL_CONNECTION_HANDLE -1
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+enum loc_nmea_provider_e_type {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+};
+
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE = 0,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
+// Module data
+typedef struct loc_eng_data_s
+{
+ LocEngAdapter *adapter;
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ agps_status_extended agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_request_utc_time request_utc_time_cb;
+ gps_measurement_callback gps_measurement_cb;
+ boolean intermediateFix;
+ AGpsStatusValue agps_status;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ loc_eng_ni_data_s_type loc_eng_ni_data;
+
+ // AGPS state machines
+ AgpsStateMachine* agnss_nif;
+ AgpsStateMachine* internet_nif;
+ AgpsStateMachine* wifi_nif;
+ //State machine for Data Services
+ AgpsStateMachine* ds_nif;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // For muting session broadcast
+ loc_mute_session_e_type mute_session_state;
+
+ // For nmea generation
+ boolean generateNmea;
+ uint32_t sv_used_mask;
+ float hdop;
+ float pdop;
+ float vdop;
+
+ // Address buffers, for addressing setting before init
+ int supl_host_set;
+ char supl_host_buf[101];
+ int supl_port_buf;
+ int c2k_host_set;
+ char c2k_host_buf[101];
+ int c2k_port_buf;
+ int mpc_host_set;
+ char mpc_host_buf[101];
+ int mpc_port_buf;
+
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+} loc_eng_data_s_type;
+
+/* 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 CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t XTRA_VERSION_CHECK;
+ char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} loc_sap_cfg_s_type;
+
+extern loc_gps_cfg_s_type gps_conf;
+extern loc_sap_cfg_s_type sap_conf;
+
+
+uint32_t getCarrierCapabilities();
+
+//loc_eng functions
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
+ LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event,
+ ContextBase* context);
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data,
+ GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
+ double latitude, double longitude,
+ float accuracy);
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
+ GpsAidingData f);
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms);
+const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
+ const char* name);
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_read_config(void);
+
+//loc_eng_agps functions
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
+ AGpsExtCallbacks* callbacks);
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType);
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int avaiable, const char* apn);
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t length);
+
+//loc_eng_xtra functions
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks);
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length);
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, int check);
+
+//loc_eng_ni functions
+extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data,
+ GpsNiExtCallbacks *callbacks);
+extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response);
+extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough);
+extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length);
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks);
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // LOC_ENG_H
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_agps.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_agps.cpp
new file mode 100644
index 0000000..5a63b8a
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -0,0 +1,970 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng_agps.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <platform_lib_includes.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_dmn_conn.h>
+#include <sys/time.h>
+
+//======================================================================
+// C callbacks
+//======================================================================
+
+// This is given to linked_list_add as the dealloc callback
+// data -- an instance of Subscriber
+static void deleteObj(void* data)
+{
+ delete (Subscriber*)data;
+}
+
+// This is given to linked_list_search() as the comparison callback
+// when the state manchine needs to process for particular subscriber
+// fromCaller -- caller provides this obj
+// fromList -- linked_list_search() function take this one from list
+static bool hasSubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ return s1->forMe(*notification);
+}
+
+// This is gvien to linked_list_search() to notify subscriber objs
+// when the state machine needs to inform all subscribers of resource
+// status changes, e.g. when resource is GRANTED.
+// fromCaller -- caller provides this ptr to a Notification obj.
+// fromList -- linked_list_search() function take this one from list
+static bool notifySubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ // we notify every subscriber indiscriminatively
+ // each subscriber decides if this notification is interesting.
+ return s1->notifyRsrcStatus(*notification) &&
+ // if we do not want to delete the subscriber from the
+ // the list, we must set this to false so this function
+ // returns false
+ notification->postNotifyDelete;
+}
+
+//======================================================================
+// Notification
+//======================================================================
+const int Notification::BROADCAST_ALL = 0x80000000;
+const int Notification::BROADCAST_ACTIVE = 0x80000001;
+const int Notification::BROADCAST_INACTIVE = 0x80000002;
+const unsigned char DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const unsigned int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+//======================================================================
+// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
+//======================================================================
+bool Subscriber::forMe(Notification ¬ification)
+{
+ if (NULL != notification.rcver) {
+ return equals(notification.rcver);
+ } else {
+ return Notification::BROADCAST_ALL == notification.groupID ||
+ (Notification::BROADCAST_ACTIVE == notification.groupID &&
+ !isInactive()) ||
+ (Notification::BROADCAST_INACTIVE == notification.groupID &&
+ isInactive());
+ }
+}
+bool BITSubscriber::equals(const Subscriber *s) const
+{
+ BITSubscriber* bitS = (BITSubscriber*)s;
+
+ return (ID == bitS->ID &&
+ (INADDR_NONE != (unsigned int)ID ||
+ 0 == strncmp(mIPv6Addr, bitS->mIPv6Addr, sizeof(mIPv6Addr))));
+}
+
+bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ ((LocEngAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_DENIED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ case RSRC_GRANTED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ break;
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+bool DSSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+ LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
+ if(notify) {
+ switch(notification.rsrcStatus) {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ case RSRC_GRANTED:
+ ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
+ break;
+ default:
+ notify = false;
+ }
+ }
+ return notify;
+}
+void DSSubscriber :: setInactive()
+{
+ mIsInactive = true;
+ ((DSStateMachine *)mStateMachine)->informStatus(RSRC_UNSUBSCRIBE, ID);
+}
+//======================================================================
+// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
+//======================================================================
+
+// AgpsReleasedState
+class AgpsReleasedState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasedState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasedState = this; }
+
+ inline ~AgpsReleasedState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasedState";}
+};
+
+AgpsState* AgpsReleasedState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ LOC_LOGD("AgpsReleasedState::onRsrcEvent; event:%d\n", (int)event);
+ if (mStateMachine->hasSubscribers()) {
+ LOC_LOGE("Error: %s subscriber list not empty!!!", whoami());
+ // I don't know how to recover from it. I am adding this rather
+ // for debugging purpose.
+ }
+
+ AgpsState* nextState = this;
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // no notification until we get RSRC_GRANTED
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // request from connecivity service for NIF
+ //The if condition is added so that if the data call setup fails
+ //for DS State Machine, we want to retry in released state.
+ //for AGps State Machine, sendRsrcRequest() will always return success
+ if(!mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN)) {
+ // move the state to PENDING
+ nextState = mPendingState;
+ }
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ // the list should really be empty, nothing to remove.
+ // but we might as well just tell the client it is
+ // unsubscribed. False tolerance, right?
+ Subscriber* subscriber = (Subscriber*) data;
+ Notification notification(subscriber, event, false);
+ subscriber->notifyRsrcStatus(notification);
+ }
+ // break;
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ default:
+ LOC_LOGW("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ break;
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsPendingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsPendingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mPendingState = this; }
+
+ inline ~AgpsPendingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsPendingState";}
+};
+
+AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsPendingState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_ACTIVE, event, false);
+ // notify all subscribers NIF resource GRANTED
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_RELEASED:
+ // no state change.
+ // we are expecting either GRANTED or DENIED. Handling RELEASED
+ // may like break our state machine in race conditions.
+ break;
+
+ case RSRC_DENIED:
+ {
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // notify all subscribers NIF resource RELEASED or DENIED
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+
+class AgpsAcquiredState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsAcquiredState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mAcquiredState = this; }
+
+ inline ~AgpsAcquiredState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() { return (char*)"AgpsAcquiredState"; }
+};
+
+
+AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;
+ LOC_LOGD("AgpsAcquiredState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // we already have the NIF resource, simply notify subscriber
+ Subscriber* subscriber = (Subscriber*) data;
+ // we have rsrc in hand, so grant it right away
+ Notification notification(subscriber, RSRC_GRANTED, false);
+ subscriber->notifyRsrcStatus(notification);
+ // add subscriber to the list
+ mStateMachine->addSubscriber(subscriber);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ LOC_LOGW("%s: %d, RSRC_GRANTED already received", whoami(), event);
+ // no state change.
+ break;
+
+ case RSRC_RELEASED:
+ {
+ LOC_LOGW("%s: %d, a force rsrc release", whoami(), event);
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_DENIED:
+ // no state change.
+ // we are expecting RELEASED. Handling DENIED
+ // may like break our state machine in race conditions.
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsReleasingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasingState = this; }
+
+ inline ~AgpsReleasingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasingState";}
+};
+
+AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsReleasingState::onRsrcEvent; event:%d\n", (int)event);
+
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_DENIED:
+ // A race condition subscriber unsubscribes before AFW denies resource.
+ case RSRC_RELEASED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_INACTIVE, event, true);
+ // notify all subscribers that are active NIF resource RELEASE
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+
+ if (mStateMachine->hasActiveSubscribers()) {
+ nextState = mPendingState;
+ // request from connecivity service for NIF
+ mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN);
+ } else {
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+//======================================================================
+//Servicer
+//======================================================================
+Servicer* Servicer :: getServicer(servicerType type, void *cb_func)
+{
+ LOC_LOGD(" Enter getServicer type:%d\n", (int)type);
+ switch(type) {
+ case servicerTypeNoCbParam:
+ return (new Servicer(cb_func));
+ case servicerTypeExt:
+ return (new ExtServicer(cb_func));
+ case servicerTypeAgps:
+ return (new AGpsServicer(cb_func));
+ default:
+ return NULL;
+ }
+}
+
+int Servicer :: requestRsrc(void *cb_data)
+{
+ callback();
+ return 0;
+}
+
+int ExtServicer :: requestRsrc(void *cb_data)
+{
+ int ret=-1;
+ LOC_LOGD("Enter ExtServicer :: requestRsrc\n");
+ ret = callbackExt(cb_data);
+ LOC_LOGD("Exit ExtServicer :: requestRsrc\n");
+ return(ret);
+}
+
+int AGpsServicer :: requestRsrc(void *cb_data)
+{
+ callbackAGps((AGpsStatus *)cb_data);
+ return 0;
+}
+
+//======================================================================
+// AgpsStateMachine
+//======================================================================
+
+AgpsStateMachine::AgpsStateMachine(servicerType servType,
+ void *cb_func,
+ AGpsExtType type,
+ bool enforceSingleSubscriber) :
+ mStatePtr(new AgpsReleasedState(this)),mType(type),
+ mAPN(NULL),
+ mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID),
+ mEnforceSingleSubscriber(enforceSingleSubscriber),
+ mServicer(Servicer :: getServicer(servType, (void *)cb_func))
+{
+ linked_list_init(&mSubscribers);
+
+ // setting up mReleasedState
+ mStatePtr->mPendingState = new AgpsPendingState(this);
+ mStatePtr->mAcquiredState = new AgpsAcquiredState(this);
+ mStatePtr->mReleasingState = new AgpsReleasingState(this);
+
+ // setting up mAcquiredState
+ mStatePtr->mAcquiredState->mReleasedState = mStatePtr;
+ mStatePtr->mAcquiredState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mAcquiredState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mPendingState
+ mStatePtr->mPendingState->mAcquiredState = mStatePtr->mAcquiredState;
+ mStatePtr->mPendingState->mReleasedState = mStatePtr;
+ mStatePtr->mPendingState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mReleasingState
+ mStatePtr->mReleasingState->mReleasedState = mStatePtr;
+ mStatePtr->mReleasingState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mReleasingState->mAcquiredState = mStatePtr->mAcquiredState;
+}
+
+AgpsStateMachine::~AgpsStateMachine()
+{
+ dropAllSubscribers();
+
+ // free the 3 states. We must read out all 3 pointers first.
+ // Otherwise we run the risk of getting pointers from already
+ // freed memory.
+ AgpsState* acquiredState = mStatePtr->mAcquiredState;
+ AgpsState* releasedState = mStatePtr->mReleasedState;
+ AgpsState* pendindState = mStatePtr->mPendingState;
+ AgpsState* releasingState = mStatePtr->mReleasingState;
+
+ delete acquiredState;
+ delete releasedState;
+ delete pendindState;
+ delete releasingState;
+ delete mServicer;
+ linked_list_destroy(&mSubscribers);
+
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ mAPN = NULL;
+ }
+}
+
+void AgpsStateMachine::setAPN(const char* apn, unsigned int len)
+{
+ if (NULL != mAPN) {
+ delete mAPN;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ memcpy(mAPN, apn, len);
+ mAPN[len] = '\0';
+
+ mAPNLen = len;
+ } else {
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+}
+
+void AgpsStateMachine::onRsrcEvent(AgpsRsrcStatus event)
+{
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+}
+
+void AgpsStateMachine::notifySubscribers(Notification& notification) const
+{
+ if (notification.postNotifyDelete) {
+ // just any non NULL value to get started
+ Subscriber* s = (Subscriber*)~0;
+ while (NULL != s) {
+ s = NULL;
+ // if the last param sets to true, _search will delete
+ // the node from the list for us. But the problem is
+ // once that is done, _search returns, leaving the
+ // rest of the list unprocessed. So we need a loop.
+ linked_list_search(mSubscribers, (void**)&s, notifySubscriber,
+ (void*)¬ification, true);
+ delete s;
+ }
+ } else {
+ // no loop needed if it the last param sets to false, which
+ // mean nothing gets deleted from the list.
+ linked_list_search(mSubscribers, NULL, notifySubscriber,
+ (void*)¬ification, false);
+ }
+}
+
+void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL == s) {
+ linked_list_add(mSubscribers, subscriber->clone(), deleteObj);
+ }
+}
+
+int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+
+ if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) {
+ AGpsExtStatus nifRequest;
+ nifRequest.size = sizeof(nifRequest);
+ nifRequest.type = mType;
+ nifRequest.status = action;
+
+ if (s == NULL) {
+ nifRequest.ipv4_addr = INADDR_NONE;
+ memset(&nifRequest.addr, 0, sizeof(nifRequest.addr));
+ nifRequest.ssid[0] = '\0';
+ nifRequest.password[0] = '\0';
+ } else {
+ s->setIPAddresses(nifRequest.addr);
+ s->setWifiInfo(nifRequest.ssid, nifRequest.password);
+ }
+
+ CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
+ mServicer->requestRsrc((void *)&nifRequest);
+ }
+ return 0;
+}
+
+void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
+{
+ if (mEnforceSingleSubscriber && hasSubscribers()) {
+ Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
+ notifySubscriber(¬ification, subscriber);
+ } else {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
+ }
+}
+
+bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL != s) {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_UNSUBSCRIBE, (void*)s);
+ return true;
+ }
+ return false;
+}
+
+bool AgpsStateMachine::hasActiveSubscribers() const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+ return NULL != s;
+}
+
+//======================================================================
+// DSStateMachine
+//======================================================================
+void delay_callback(void *callbackData, int result)
+{
+ if(callbackData) {
+ DSStateMachine *DSSMInstance = (DSStateMachine *)callbackData;
+ DSSMInstance->retryCallback();
+ }
+ else {
+ LOC_LOGE(" NULL argument received. Failing.\n");
+ goto err;
+ }
+err:
+ return;
+}
+
+DSStateMachine :: DSStateMachine(servicerType type, void *cb_func,
+ LocEngAdapter* adapterHandle):
+ AgpsStateMachine(type, cb_func, AGPS_TYPE_INVALID,false),
+ mLocAdapter(adapterHandle)
+{
+ LOC_LOGD("%s:%d]: New DSStateMachine\n", __func__, __LINE__);
+ mRetries = 0;
+}
+
+void DSStateMachine :: retryCallback(void)
+{
+ DSSubscriber *subscriber = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&subscriber, hasSubscriber,
+ (void*)¬ification, false);
+ if(subscriber)
+ mLocAdapter->requestSuplES(subscriber->ID);
+ else
+ LOC_LOGE("DSStateMachine :: retryCallback: No subscriber found." \
+ "Cannot retry data call\n");
+ return;
+}
+
+int DSStateMachine :: sendRsrcRequest(AGpsStatusValue action) const
+{
+ DSSubscriber* s = NULL;
+ dsCbData cbData;
+ int ret=-1;
+ int connHandle=-1;
+ LOC_LOGD("Enter DSStateMachine :: sendRsrcRequest\n");
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+ if(s) {
+ connHandle = s->ID;
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - subscriber found\n");
+ }
+ else
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - No subscriber found\n");
+
+ cbData.action = action;
+ cbData.mAdapter = mLocAdapter;
+ ret = mServicer->requestRsrc((void *)&cbData);
+ //Only the request to start data call returns a success/failure
+ //The request to stop data call will always succeed
+ //Hence, the below block will only be executed when the
+ //request to start the data call fails
+ switch(ret) {
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - Failure returned: %d\n",ret);
+ ((DSStateMachine *)this)->incRetries();
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+ LOC_LOGE(" Failed to start Data call. Fallback to normal ATL SUPL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ }
+ else {
+ if(loc_timer_start(DATA_CALL_RETRY_DELAY_MSEC, delay_callback, (void *)this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ ret = -1;
+ goto err;
+ }
+ }
+ break;
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No profile found for emergency call. Fallback to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("%s:%d]: Request to start data call sent\n", __func__, __LINE__);
+ break;
+ case -1:
+ //One of the ways this case can be encountered is if the callback function
+ //receives a null argument, it just exits with -1 error
+ LOC_LOGE("Error: Something went wrong somewhere. Falling back to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Unrecognized return value\n", __func__, __LINE__);
+ }
+err:
+ LOC_LOGD("EXIT DSStateMachine :: sendRsrcRequest; ret = %d\n", ret);
+ return ret;
+}
+
+void DSStateMachine :: onRsrcEvent(AgpsRsrcStatus event)
+{
+ void* currState = (void *)mStatePtr;
+ LOC_LOGD("Enter DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_GRANTED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ case RSRC_RELEASED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_RELEASED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ //To handle the case where we get a RSRC_RELEASED in
+ //pending state, we translate that to a RSRC_DENIED state
+ //since the callback from DSI is either RSRC_GRANTED or RSRC_RELEASED
+ //for when the call is connected or disconnected respectively.
+ if((void *)mStatePtr != currState)
+ break;
+ else {
+ event = RSRC_DENIED;
+ LOC_LOGE(" Switching event to RSRC_DENIED\n");
+ }
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+ LOC_LOGD("Exit DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+}
+
+void DSStateMachine :: informStatus(AgpsRsrcStatus status, int ID) const
+{
+ LOC_LOGD("DSStateMachine :: informStatus. Status=%d\n",(int)status);
+ switch(status) {
+ case RSRC_UNSUBSCRIBE:
+ mLocAdapter->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_RELEASED:
+ mLocAdapter->closeDataCall();
+ break;
+ case RSRC_DENIED:
+ ((DSStateMachine *)this)->mRetries = 0;
+ mLocAdapter->requestATL(ID, AGPS_TYPE_SUPL);
+ break;
+ case RSRC_GRANTED:
+ mLocAdapter->atlOpenStatus(ID, 1,
+ NULL,
+ AGPS_APN_BEARER_INVALID,
+ AGPS_TYPE_INVALID);
+ break;
+ default:
+ LOC_LOGW("DSStateMachine :: informStatus - unknown status");
+ }
+ return;
+}
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_agps.h b/msm8994/loc_api/libloc_api_50001/loc_eng_agps.h
new file mode 100644
index 0000000..2d689ce
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -0,0 +1,431 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_ENG_AGPS_H__
+#define __LOC_ENG_AGPS_H__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_core_log.h>
+#include <linked_list.h>
+#include <loc_timer.h>
+#include <LocEngAdapter.h>
+
+// forward declaration
+class AgpsStateMachine;
+class Subscriber;
+
+// NIF resource events
+typedef enum {
+ RSRC_SUBSCRIBE,
+ RSRC_UNSUBSCRIBE,
+ RSRC_GRANTED,
+ RSRC_RELEASED,
+ RSRC_DENIED,
+ RSRC_STATUS_MAX
+} AgpsRsrcStatus;
+
+typedef enum {
+ servicerTypeNoCbParam,
+ servicerTypeAgps,
+ servicerTypeExt
+}servicerType;
+
+//DS Callback struct
+typedef struct {
+ LocEngAdapter *mAdapter;
+ AGpsStatusValue action;
+}dsCbData;
+
+// information bundle for subscribers
+struct Notification {
+ // goes to every subscriber
+ static const int BROADCAST_ALL;
+ // goes to every ACTIVE subscriber
+ static const int BROADCAST_ACTIVE;
+ // goes to every INACTIVE subscriber
+ static const int BROADCAST_INACTIVE;
+
+ // go to a specific subscriber
+ const Subscriber* rcver;
+ // broadcast
+ const int groupID;
+ // the new resource status event
+ const AgpsRsrcStatus rsrcStatus;
+ // should the subscriber be deleted after the notification
+ const bool postNotifyDelete;
+
+ // convenient constructor
+ inline Notification(const int broadcast,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(subscriber), groupID(-1), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const int broadcast) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber) :
+ rcver(subscriber), groupID(-1), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+};
+
+class AgpsState {
+ // allows AgpsStateMachine to access private data
+ // no class members are public. We don't want
+ // anyone but state machine to use state.
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+ // state transitions are done here.
+ // Each state implements its own transitions (of course).
+ inline virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data) = 0;
+
+protected:
+ // handle back to state machine
+ const AgpsStateMachine* mStateMachine;
+ // each state has pointers to all 3 states
+ // one of which is to itself.
+ AgpsState* mReleasedState;
+ AgpsState* mAcquiredState;
+ AgpsState* mPendingState;
+ AgpsState* mReleasingState;
+
+ inline AgpsState(const AgpsStateMachine *stateMachine) :
+ mStateMachine(stateMachine),
+ mReleasedState(NULL),
+ mAcquiredState(NULL),
+ mPendingState(NULL),
+ mReleasingState(NULL) {}
+ virtual ~AgpsState() {}
+
+public:
+ // for logging purpose
+ inline virtual char* whoami() = 0;
+};
+
+class Servicer {
+ void (*callback)(void);
+public:
+ static Servicer* getServicer(servicerType type, void *cb_func);
+ virtual int requestRsrc(void *cb_data);
+ Servicer() {}
+ Servicer(void *cb_func)
+ { callback = (void(*)(void))(cb_func); }
+ virtual ~Servicer(){}
+ inline virtual char *whoami() {return (char*)"Servicer";}
+};
+
+class ExtServicer : public Servicer {
+ int (*callbackExt)(void *cb_data);
+public:
+ int requestRsrc(void *cb_data);
+ ExtServicer() {}
+ ExtServicer(void *cb_func)
+ { callbackExt = (int(*)(void *))(cb_func); }
+ virtual ~ExtServicer(){}
+ inline virtual char *whoami() {return (char*)"ExtServicer";}
+};
+
+class AGpsServicer : public Servicer {
+ void (*callbackAGps)(AGpsStatus* status);
+public:
+ int requestRsrc(void *cb_data);
+ AGpsServicer() {}
+ AGpsServicer(void *cb_func)
+ { callbackAGps = (void(*)(AGpsStatus *))(cb_func); }
+ virtual ~AGpsServicer(){}
+ inline virtual char *whoami() {return (char*)"AGpsServicer";}
+};
+
+class AgpsStateMachine {
+protected:
+ // a linked list of subscribers.
+ void* mSubscribers;
+ //handle to whoever provides the service
+ Servicer *mServicer;
+ // allows AgpsState to access private data
+ // each state is really internal data to the
+ // state machine, so it should be able to
+ // access anything within the state machine.
+ friend class AgpsState;
+ // pointer to the current state.
+ AgpsState* mStatePtr;
+private:
+ // NIF type: AGNSS or INTERNET.
+ const AGpsExtType mType;
+ // apn to the NIF. Each state machine tracks
+ // resource state of a particular NIF. For each
+ // NIF, there is also an active APN.
+ char* mAPN;
+ // for convenience, we don't do strlen each time.
+ unsigned int mAPNLen;
+ // bear
+ AGpsBearerType mBearer;
+ // ipv4 address for routing
+ bool mEnforceSingleSubscriber;
+
+public:
+ AgpsStateMachine(servicerType servType, void *cb_func,
+ AGpsExtType type, bool enforceSingleSubscriber);
+ virtual ~AgpsStateMachine();
+
+ // self explanatory methods below
+ void setAPN(const char* apn, unsigned int len);
+ inline const char* getAPN() const { return (const char*)mAPN; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return (AGpsExtType)mType; }
+
+ // someone, a ATL client or BIT, is asking for NIF
+ void subscribeRsrc(Subscriber *subscriber);
+
+ // someone, a ATL client or BIT, is done with NIF
+ bool unsubscribeRsrc(Subscriber *subscriber);
+
+ // add a subscriber in the linked list, if not already there.
+ void addSubscriber(Subscriber* subscriber) const;
+
+ virtual void onRsrcEvent(AgpsRsrcStatus event);
+
+ // put the data together and send the FW
+ virtual int sendRsrcRequest(AGpsStatusValue action) const;
+
+ //if list is empty, linked_list_empty returns 1
+ //else if list is not empty, returns 0
+ //so hasSubscribers() returns 1 if list is not empty
+ //and returns 0 if list is empty
+ inline bool hasSubscribers() const
+ { return !linked_list_empty(mSubscribers); }
+
+ bool hasActiveSubscribers() const;
+
+ inline void dropAllSubscribers() const
+ { linked_list_flush(mSubscribers); }
+
+ // private. Only a state gets to call this.
+ void notifySubscribers(Notification& notification) const;
+
+};
+
+class DSStateMachine : public AgpsStateMachine {
+ static const unsigned char MAX_START_DATA_CALL_RETRIES;
+ static const unsigned int DATA_CALL_RETRY_DELAY_MSEC;
+ LocEngAdapter* mLocAdapter;
+ unsigned char mRetries;
+public:
+ DSStateMachine(servicerType type,
+ void *cb_func,
+ LocEngAdapter* adapterHandle);
+ int sendRsrcRequest(AGpsStatusValue action) const;
+ void onRsrcEvent(AgpsRsrcStatus event);
+ void retryCallback();
+ void informStatus(AgpsRsrcStatus status, int ID) const;
+ inline void incRetries() {mRetries++;}
+ inline virtual char *whoami() {return (char*)"DSStateMachine";}
+};
+
+// each subscriber is a AGPS client. In the case of ATL, there could be
+// multiple clients from modem. In the case of BIT, there is only one
+// cilent from BIT daemon.
+struct Subscriber {
+ const uint32_t ID;
+ const AgpsStateMachine* mStateMachine;
+ inline Subscriber(const int id,
+ const AgpsStateMachine* stateMachine) :
+ ID(id), mStateMachine(stateMachine) {}
+ inline virtual ~Subscriber() {}
+
+ virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ virtual void setIPAddresses(struct sockaddr_storage& addr) = 0;
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ { ssid[0] = 0; password[0] = 0; }
+
+ inline virtual bool equals(const Subscriber *s) const
+ { return ID == s->ID; }
+
+ // notifies a subscriber a new NIF resource status, usually
+ // either GRANTE, DENIED, or RELEASED
+ virtual bool notifyRsrcStatus(Notification ¬ification) = 0;
+
+ virtual bool waitForCloseComplete() { return false; }
+ virtual void setInactive() {}
+ virtual bool isInactive() { return false; }
+
+ virtual Subscriber* clone() = 0;
+ // checks if this notification is for me, i.e.
+ // either has my id, or has a broadcast id.
+ bool forMe(Notification ¬ification);
+};
+
+// BITSubscriber, created with requests from BIT daemon
+struct BITSubscriber : public Subscriber {
+ char mIPv6Addr[16];
+
+ inline BITSubscriber(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ Subscriber(ipv4, stateMachine)
+ {
+ if (NULL == ipv6) {
+ mIPv6Addr[0] = 0;
+ } else {
+ memcpy(mIPv6Addr, ipv6, sizeof(mIPv6Addr));
+ }
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ }
+
+ virtual Subscriber* clone()
+ {
+ return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
+ }
+
+ virtual bool equals(const Subscriber *s) const;
+ inline virtual ~BITSubscriber(){}
+};
+
+// ATLSubscriber, created with requests from ATL
+struct ATLSubscriber : public Subscriber {
+ const LocEngAdapter* mLocAdapter;
+ const bool mBackwardCompatibleMode;
+ inline ATLSubscriber(const int id,
+ const AgpsStateMachine* stateMachine,
+ const LocEngAdapter* adapter,
+ const bool compatibleMode) :
+ Subscriber(id, stateMachine), mLocAdapter(adapter),
+ mBackwardCompatibleMode(compatibleMode){}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = INADDR_NONE; v6[0] = 0; }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual Subscriber* clone()
+ {
+ return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
+ mBackwardCompatibleMode);
+ }
+ inline virtual ~ATLSubscriber(){}
+};
+
+// WIFISubscriber, created with requests from MSAPM or QuIPC
+struct WIFISubscriber : public Subscriber {
+ char * mSSID;
+ char * mPassword;
+ loc_if_req_sender_id_e_type senderId;
+ bool mIsInactive;
+ inline WIFISubscriber(const AgpsStateMachine* stateMachine,
+ char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
+ Subscriber(sender_id, stateMachine),
+ mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
+ senderId(sender_id)
+ {
+ if (NULL != mSSID)
+ strlcpy(mSSID, ssid, SSID_BUF_SIZE);
+ if (NULL != mPassword)
+ strlcpy(mPassword, password, SSID_BUF_SIZE);
+ mIsInactive = false;
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ {
+ if (NULL != mSSID)
+ strlcpy(ssid, mSSID, SSID_BUF_SIZE);
+ else
+ ssid[0] = '\0';
+ if (NULL != mPassword)
+ strlcpy(password, mPassword, SSID_BUF_SIZE);
+ else
+ password[0] = '\0';
+ }
+
+ inline virtual bool waitForCloseComplete() { return true; }
+
+ inline virtual void setInactive() { mIsInactive = true; }
+ inline virtual bool isInactive() { return mIsInactive; }
+
+ virtual Subscriber* clone()
+ {
+ return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
+ }
+ inline virtual ~WIFISubscriber(){}
+};
+
+struct DSSubscriber : public Subscriber {
+ bool mIsInactive;
+ inline DSSubscriber(const AgpsStateMachine *stateMachine,
+ const int id) :
+ Subscriber(id, stateMachine)
+ {
+ mIsInactive = false;
+ }
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+ virtual Subscriber* clone()
+ {return new DSSubscriber(mStateMachine, ID);}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+ inline virtual bool waitForCloseComplete() { return true; }
+ virtual void setInactive();
+ inline virtual bool isInactive()
+ { return mIsInactive; }
+ inline virtual ~DSSubscriber(){}
+ inline virtual char *whoami() {return (char*)"DSSubscriber";}
+};
+
+#endif //__LOC_ENG_AGPS_H__
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
new file mode 100644
index 0000000..c257dff
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2011-2012, 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 <linux/stat.h>
+#include <fcntl.h>
+#include <linux/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <grp.h>
+#include <sys/stat.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_msg.h"
+
+static int loc_api_server_msgqid;
+static int loc_api_resp_msgqid;
+static int quipc_msgqid;
+static int msapm_msgqid;
+static int msapu_msgqid;
+
+static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
+static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
+static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
+static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
+static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
+
+static int loc_api_server_proc_init(void *context)
+{
+ loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
+ //change mode/group for the global_loc_api_q_path pipe
+ int result = chmod (global_loc_api_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
+ }
+
+ struct group * gps_group = getgrnam("gps");
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_q_path, gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+ else
+ {
+ LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
+ }
+
+ loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
+
+ //change mode/group for the global_loc_api_resp_q_path pipe
+ result = chmod (global_loc_api_resp_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
+ }
+
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_resp_q_path,
+ gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+
+ quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
+ msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
+ msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
+
+ LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
+ return 0;
+}
+
+static int loc_api_server_proc_pre(void *context)
+{
+ return 0;
+}
+
+static int loc_api_server_proc(void *context)
+{
+ int length, sz;
+ int result = 0;
+ static int cnt = 0;
+ struct ctrl_msgbuf * p_cmsgbuf;
+ struct ctrl_msgbuf cmsg_resp;
+
+ sz = sizeof(struct ctrl_msgbuf) + 256;
+ p_cmsgbuf = (struct ctrl_msgbuf *) malloc(sz);
+
+ if (!p_cmsgbuf) {
+ LOC_LOGE("%s:%d] Out of memory\n", __func__, __LINE__);
+ return -1;
+ }
+
+ cnt ++;
+ LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
+ length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
+ if (length <= 0) {
+ free(p_cmsgbuf);
+ LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
+ usleep(1000);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ switch(p_cmsgbuf->ctrl_type) {
+ case GPSONE_LOC_API_IF_REQUEST:
+ result = loc_eng_dmn_conn_loc_api_server_if_request_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_LOC_API_IF_RELEASE:
+ result = loc_eng_dmn_conn_loc_api_server_if_release_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_UNBLOCK:
+ LOC_LOGD("%s:%d] GPSONE_UNBLOCK\n", __func__, __LINE__);
+ break;
+
+ default:
+ LOC_LOGE("%s:%d] unsupported ctrl_type = %d\n",
+ __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ break;
+ }
+
+ free(p_cmsgbuf);
+ return 0;
+}
+
+static int loc_api_server_proc_post(void *context)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
+ return 0;
+}
+
+static int loc_eng_dmn_conn_unblock_proc(void)
+{
+ struct ctrl_msgbuf cmsgbuf;
+ cmsgbuf.ctrl_type = GPSONE_UNBLOCK;
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgsnd(loc_api_server_msgqid, & cmsgbuf, sizeof(cmsgbuf));
+ return 0;
+}
+
+static struct loc_eng_dmn_conn_thelper thelper;
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * resp_q_path, void *agps_handle)
+{
+ int result;
+
+ loc_api_handle = agps_handle;
+
+ if (loc_api_q_path) global_loc_api_q_path = loc_api_q_path;
+ if (resp_q_path) global_loc_api_resp_q_path = resp_q_path;
+
+ result = loc_eng_dmn_conn_launch_thelper( &thelper,
+ loc_api_server_proc_init,
+ loc_api_server_proc_pre,
+ loc_api_server_proc,
+ loc_api_server_proc_post,
+ create_thread_cb,
+ (char *) global_loc_api_q_path);
+ if (result != 0) {
+ LOC_LOGE("%s:%d]\n", __func__, __LINE__);
+ return -1;
+ }
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_unblock(void)
+{
+ loc_eng_dmn_conn_unblock_thelper(&thelper);
+ loc_eng_dmn_conn_unblock_proc();
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_join(void)
+{
+ loc_eng_dmn_conn_join_thelper(&thelper);
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
+ struct ctrl_msgbuf cmsgbuf;
+ LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
+ cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
+ cmsgbuf.cmsg.cmsg_response.result = status;
+ switch (sender_id) {
+ case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapu_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ default: {
+ LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
+ }
+ }
+ return 0;
+}
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
new file mode 100644
index 0000000..1d8c142
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
@@ -0,0 +1,59 @@
+/* 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_ENG_DATA_SERVER_H
+#define LOC_ENG_DATA_SERVER_H
+
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+#ifdef _ANDROID_
+
+#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q"
+
+#else
+
+#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
+
+#endif
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
+int loc_eng_dmn_conn_loc_api_server_unblock(void);
+int loc_eng_dmn_conn_loc_api_server_join(void);
+int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
+
+#endif /* LOC_ENG_DATA_SERVER_H */
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
new file mode 100644
index 0000000..a1076ff
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -0,0 +1,223 @@
+/* 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.
+ *
+ */
+#include <linux/stat.h>
+#include <fcntl.h>
+
+#include <linux/types.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgget
+
+DESCRIPTION
+ This function get a message queue
+
+ q_path - name path of the message queue
+ mode -
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ message queue id
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode)
+{
+ int msgqid;
+ msgqid = loc_eng_dmn_conn_glue_pipeget(q_path, mode);
+ return msgqid;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgremove
+
+DESCRIPTION
+ remove a message queue
+
+ q_path - name path of the message queue
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid)
+{
+ int result;
+ result = loc_eng_dmn_conn_glue_piperemove(q_path, msgqid);
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgsnd
+
+DESCRIPTION
+ Send a message
+
+ msgqid - message queue id
+ msgp - pointer to the message to be sent
+ msgsz - size of the message
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes sent out or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+ pmsg->msgsz = msgsz;
+
+ result = loc_eng_dmn_conn_glue_pipewrite(msgqid, msgp, msgsz);
+ if (result != (int) msgsz) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) msgsz);
+ return -1;
+ }
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgrcv
+
+DESCRIPTION
+ receive a message
+
+ msgqid - message queue id
+ msgp - pointer to the buffer to hold the message
+ msgsz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes received or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgbufsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, &(pmsg->msgsz), sizeof(pmsg->msgsz));
+ if (result != sizeof(pmsg->msgsz)) {
+ LOC_LOGE("%s:%d] pipe broken %d\n", __func__, __LINE__, result);
+ return -1;
+ }
+
+ if (msgbufsz < pmsg->msgsz) {
+ LOC_LOGE("%s:%d] msgbuf is too small %d < %d\n", __func__, __LINE__, (int) msgbufsz, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, (uint8_t *) msgp + sizeof(pmsg->msgsz), pmsg->msgsz - sizeof(pmsg->msgsz));
+ if (result != (int) (pmsg->msgsz - sizeof(pmsg->msgsz))) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ return pmsg->msgsz;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgunblock
+
+DESCRIPTION
+ unblock a message queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid)
+{
+ return loc_eng_dmn_conn_glue_pipeunblock(msgqid);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgflush
+
+DESCRIPTION
+ flush out the message in a queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes that are flushed out.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgflush(int msgqid)
+{
+ int length;
+ char buf[128];
+
+ do {
+ length = loc_eng_dmn_conn_glue_piperead(msgqid, buf, 128);
+ LOC_LOGD("%s:%d] %s\n", __func__, __LINE__, buf);
+ } while(length);
+ return length;
+}
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
new file mode 100644
index 0000000..d685c87
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
@@ -0,0 +1,51 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_MSG_H
+#define LOC_ENG_DMN_CONN_GLUE_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#include <linux/types.h>
+#include "loc_eng_dmn_conn_glue_pipe.h"
+
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode);
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid);
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgflush(int msgqid);
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
new file mode 100644
index 0000000..dffcad0
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -0,0 +1,214 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+// #include <linux/stat.h>
+#include <fcntl.h>
+// #include <linux/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "loc_eng_dmn_conn_glue_pipe.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeget
+
+DESCRIPTION
+ create a named pipe.
+
+ pipe_name - pipe name path
+ mode - mode
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
+{
+ int fd;
+ int result;
+
+ LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
+ result = mkfifo(pipe_name, 0660);
+
+ if ((result == -1) && (errno != EEXIST)) {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ return result;
+ }
+
+ // The mode in mkfifo is not honoured and does not provide the
+ // group permissions. Doing chmod to add group permissions.
+ result = chmod (pipe_name, 0660);
+ if (result != 0){
+ LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
+ pipe_name, strerror(errno));
+ }
+
+ fd = open(pipe_name, mode);
+ if (fd <= 0)
+ {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ }
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return fd;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperemove
+
+DESCRIPTION
+ remove a pipe
+
+ pipe_name - pipe name path
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd)
+{
+ close(fd);
+ if (pipe_name) unlink(pipe_name);
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipewrite
+
+DESCRIPTION
+ write to a pipe
+
+ fd - fd of a pipe
+ buf - buffer for the data to write
+ sz - size of the data in buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes written or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz)
+{
+ int result;
+
+ result = write(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, result = %d\n", fd, (long) buf, (int) sz, (int) result); */
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperead
+
+DESCRIPTION
+ read from a pipe
+
+ fd - fd for the pipe
+ buf - buffer to hold the data read from pipe
+ sz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes read from pipe or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz)
+{
+ int len;
+
+ len = read(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, len = %d\n", fd, (long) buf, (int) sz, len); */
+ return len;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeunblock
+
+DESCRIPTION
+ unblock a pipe
+
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 for success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeunblock(int fd)
+{
+ int result;
+ struct flock flock_v;
+ LOC_LOGD("\n");
+// result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY);
+ flock_v.l_type = F_UNLCK;
+ flock_v.l_len = 32;
+ result = fcntl(fd, F_SETLK, &flock_v);
+ if (result < 0) {
+ LOC_LOGE("fcntl failure, %s\n", strerror(errno));
+ }
+
+ return result;
+}
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
new file mode 100644
index 0000000..b2fa3a0
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
@@ -0,0 +1,50 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_PIPE_H
+#define LOC_ENG_DMN_CONN_GLUE_PIPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <linux/types.h>
+
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode);
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd);
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz);
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz);
+
+int loc_eng_dmn_conn_glue_pipeflush(int fd);
+int loc_eng_dmn_conn_glue_pipeunblock(int fd);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
new file mode 100644
index 0000000..edd53f2
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-2012, 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 <string.h>
+#include <unistd.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_msg.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+void* loc_api_handle = NULL;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ if (NULL == loc_api_handle) {
+ LOC_LOGE("%s:%d] NO agps data handle\n", __func__, __LINE__);
+ return 1;
+ }
+
+ if (NULL != loc_api_handle) {
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ true);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+ }
+
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+#endif
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ false);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+#endif
+ return 0;
+}
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
new file mode 100644
index 0000000..1c0edd5
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_HANDLER
+#define LOC_ENG_DATA_SERVER_HANDLER
+
+#include <linux/types.h>
+#include <arpa/inet.h>
+
+//for SSID_BUF_SIZE
+#include <hardware/gps.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+
+enum {
+ /* 0x0 - 0xEF is reserved for daemon internal */
+ GPSONE_LOC_API_IF_REQUEST = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE,
+ GPSONE_LOC_API_RESPONSE,
+ GPSONE_UNBLOCK,
+};
+
+enum {
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS,
+ GPSONE_LOC_API_IF_FAILURE,
+};
+
+
+struct ctrl_msg_response {
+ int result;
+};
+
+struct ctrl_msg_unblock {
+ int reserved;
+};
+
+typedef enum {
+ IF_REQUEST_TYPE_SUPL = 0,
+ IF_REQUEST_TYPE_WIFI,
+ IF_REQUEST_TYPE_ANY
+} ctrl_if_req_type_e_type;
+
+typedef enum {
+ IF_REQUEST_SENDER_ID_QUIPC = 0,
+ IF_REQUEST_SENDER_ID_MSAPM,
+ IF_REQUEST_SENDER_ID_MSAPU,
+ IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ IF_REQUEST_SENDER_ID_MODEM
+} ctrl_if_req_sender_id_e_type;
+
+struct ctrl_msg_if_request {
+ ctrl_if_req_type_e_type type;
+ ctrl_if_req_sender_id_e_type sender_id;
+ unsigned long ipv4_addr;
+ unsigned char ipv6_addr[16];
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+};
+
+/* do not change this structure */
+struct ctrl_msgbuf {
+ size_t msgsz;
+ uint16_t reserved1;
+ uint32_t reserved2;
+ uint8_t ctrl_type;
+ union {
+ struct ctrl_msg_response cmsg_response;
+ struct ctrl_msg_unblock cmsg_unblock;
+ struct ctrl_msg_if_request cmsg_if_request;
+ } cmsg;
+};
+
+extern void* loc_api_handle;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
+
+#endif /* LOC_ENG_DATA_SERVER_HANDLER */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
new file mode 100644
index 0000000..9fed9d4
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -0,0 +1,399 @@
+/* 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.
+ *
+ */
+#include <stdio.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+/*===========================================================================
+FUNCTION thelper_signal_init
+
+DESCRIPTION
+ This function will initialize the conditional variable resources.
+
+ thelper - thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+ thelper->thread_exit = 0;
+ thelper->thread_ready = 0;
+ result = pthread_cond_init( &thelper->thread_cond, NULL);
+ if (result) {
+ return result;
+ }
+
+ result = pthread_mutex_init(&thelper->thread_mutex, NULL);
+ if (result) {
+ pthread_cond_destroy(&thelper->thread_cond);
+ }
+ return result;
+}
+
+/*===========================================================================
+FUNCTION
+
+DESCRIPTION
+ This function will destroy the conditional variable resources
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result, ret_result = 0;
+ result = pthread_cond_destroy( &thelper->thread_cond);
+ if (result) {
+ ret_result = result;
+ }
+
+ result = pthread_mutex_destroy(&thelper->thread_mutex);
+ if (result) {
+ ret_result = result;
+ }
+
+ return ret_result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_wait
+
+DESCRIPTION
+ This function will be blocked on the conditional variable until thelper_signal_ready
+ is called
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = 0;
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ if (!thelper->thread_ready && !thelper->thread_exit) {
+ result = pthread_cond_wait(&thelper->thread_cond, &thelper->thread_mutex);
+ }
+
+ if (thelper->thread_exit) {
+ result = -1;
+ }
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_ready
+
+DESCRIPTION
+ This function will wake up the conditional variable
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 1;
+ result = pthread_cond_signal(&thelper->thread_cond);
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_block
+
+DESCRIPTION
+ This function will set the thread ready to 0 to block the thelper_signal_wait
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ if thread_ready is set
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = thelper->thread_ready;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 0;
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_main
+
+DESCRIPTION
+ This function is the main thread. It will be launched as a child thread
+
+ data - pointer to the instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ NULL
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void * thelper_main(void *data)
+{
+ int result = 0;
+ struct loc_eng_dmn_conn_thelper * thelper = (struct loc_eng_dmn_conn_thelper *) data;
+
+ if (thelper->thread_proc_init) {
+ result = thelper->thread_proc_init(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ thelper_signal_ready(thelper);
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ thelper_signal_ready(thelper);
+
+ if (thelper->thread_proc_pre) {
+ result = thelper->thread_proc_pre(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ do {
+ if (thelper->thread_proc) {
+ result = thelper->thread_proc(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ }
+ } while (thelper->thread_exit == 0);
+
+ if (thelper->thread_proc_post) {
+ result = thelper->thread_proc_post(thelper->thread_context);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ return NULL;
+}
+
+static void thelper_main_2(void *data)
+{
+ thelper_main(data);
+ return;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_launch_thelper
+
+DESCRIPTION
+ This function will initialize the thread context and launch the thelper_main
+
+ thelper - pointer to thelper instance
+ thread_proc_init - The initialization function pointer
+ thread_proc_pre - The function to call before task loop and after initialization
+ thread_proc - The task loop
+ thread_proc_post - The function to call after the task loop
+ context - the context for the above four functions
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context)
+{
+ int result;
+
+ thelper_signal_init(thelper);
+
+ if (context) {
+ thelper->thread_context = context;
+ }
+
+ thelper->thread_proc_init = thread_proc_init;
+ thelper->thread_proc_pre = thread_proc_pre;
+ thelper->thread_proc = thread_proc;
+ thelper->thread_proc_post = thread_proc_post;
+
+ LOC_LOGD("%s:%d] 0x%lx call pthread_create\n", __func__, __LINE__, (long) thelper);
+ if (create_thread_cb) {
+ result = 0;
+ thelper->thread_id = create_thread_cb("loc_eng_dmn_conn",
+ thelper_main_2, (void *)thelper);
+ } else {
+ result = pthread_create(&thelper->thread_id, NULL,
+ thelper_main, (void *)thelper);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] 0x%lx pthread_create done\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_wait(thelper);
+
+ LOC_LOGD("%s:%d] 0x%lx pthread ready\n", __func__, __LINE__, (long) thelper);
+ return thelper->thread_exit;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_unblock_thelper
+
+DESCRIPTION
+ This function unblocks thelper_main to release the thread
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ thelper->thread_exit = 1;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_join_thelper
+
+ thelper - pointer to thelper instance
+
+DESCRIPTION
+ This function will wait for the thread of thelper_main to finish
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ result = pthread_join(thelper->thread_id, NULL);
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_destroy(thelper);
+
+ return result;
+}
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
new file mode 100644
index 0000000..89e598b
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+#define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+
+struct loc_eng_dmn_conn_thelper {
+ unsigned char thread_exit;
+ unsigned char thread_ready;
+ pthread_cond_t thread_cond;
+ pthread_mutex_t thread_mutex;
+ pthread_t thread_id;
+ void * thread_context;
+ int (*thread_proc_init) (void * context);
+ int (*thread_proc_pre) (void * context);
+ int (*thread_proc) (void * context);
+ int (*thread_proc_post) (void * context);
+};
+
+typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg);
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context);
+
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+
+/* if only need to use signal */
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_log.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_log.cpp
new file mode 100644
index 0000000..3a34167
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_log.cpp
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include "loc_log.h"
+#include "loc_eng_log.h"
+
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_log.h b/msm8994/loc_api/libloc_api_50001/loc_eng_log.h
new file mode 100644
index 0000000..a68bd84
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_log.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_msg.h b/msm8994/loc_api/libloc_api_50001/loc_eng_msg.h
new file mode 100644
index 0000000..5626c34
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -0,0 +1,306 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_ENG_MSG_H
+#define LOC_ENG_MSG_H
+
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <stdlib.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_eng_log.h>
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include <LocEngAdapter.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+#ifdef USE_GLIB
+
+#include <glib.h>
+
+#endif /* USE_GLIB */
+#include "platform_lib_includes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+using namespace loc_core;
+
+struct LocEngPositionMode : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const LocPosMode mPosMode;
+ LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
+ virtual void proc() const;
+ virtual void log() const;
+ void send() const;
+};
+
+
+struct LocEngStartFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStartFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngStopFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStopFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportPosition : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const UlpLocation mLocation;
+ const GpsLocationExtended mLocationExtended;
+ const void* mLocationExt;
+ const enum loc_sess_status mStatus;
+ const LocPosTechMask mTechMask;
+ LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportSv : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsSvStatus mSvStatus;
+ const GpsLocationExtended mLocationExtended;
+ const void* mSvExt;
+ LocEngReportSv(LocAdapterBase* adapter,
+ GpsSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExtended);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportStatus : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsStatusValue mStatus;
+ LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportNmea : public LocMsg {
+ void* mLocEng;
+ char* const mNmea;
+ const int mLen;
+ LocEngReportNmea(void* locEng,
+ const char* data, int len);
+ inline virtual ~LocEngReportNmea()
+ {
+ delete[] mNmea;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportXtraServer : public LocMsg {
+ void* mLocEng;
+ int mMaxLen;
+ char *mServers;
+ LocEngReportXtraServer(void* locEng,
+ const char *url1, const char *url2,
+ const char *url3, const int maxlength);
+ inline virtual ~LocEngReportXtraServer()
+ {
+ delete[] mServers;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsOpened : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsOpened(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsClosed : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsClosed(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestSuplEs : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngRequestSuplEs(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ const AGpsExtType mType;
+ LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReleaseATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngReleaseATL(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReqRelBIT : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const int mIPv4Addr;
+ char* const mIPv6Addr;
+ const bool mIsReq;
+ LocEngReqRelBIT(void* instance, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq);
+ virtual ~LocEngReqRelBIT();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReqRelWifi : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const loc_if_req_sender_id_e_type mSenderId;
+ char* const mSSID;
+ char* const mPassword;
+ const bool mIsReq;
+ LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq);
+ virtual ~LocEngReqRelWifi();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngRequestXtra : public LocMsg {
+ void* mLocEng;
+ LocEngRequestXtra(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestTime : public LocMsg {
+ void* mLocEng;
+ LocEngRequestTime(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestNi : public LocMsg {
+ void* mLocEng;
+ const GpsNiNotification mNotify;
+ const void *mPayload;
+ LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngDown : public LocMsg {
+ void* mLocEng;
+ LocEngDown(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngUp : public LocMsg {
+ void* mLocEng;
+ LocEngUp(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngGetZpp : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngGetZpp(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportGpsMeasurement : public LocMsg {
+ void* mLocEng;
+ const GpsData mGpsData;
+ LocEngReportGpsMeasurement(void* locEng,
+ GpsData &gpsData);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_MSG_H */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_ni.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_ni.cpp
new file mode 100644
index 0000000..4597b98
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -0,0 +1,414 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <MsgTask.h>
+
+#include <loc_eng.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+static void* ni_thread_proc(void *args);
+
+struct LocEngInformNiResponse : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUserResponseType mResponse;
+ const void *mPayload;
+ inline LocEngInformNiResponse(LocEngAdapter* adapter,
+ GpsUserResponseType resp,
+ const void* data) :
+ LocMsg(), mAdapter(adapter),
+ mResponse(resp), mPayload(data)
+ {
+ locallog();
+ }
+ inline ~LocEngInformNiResponse()
+ {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const
+ {
+ mAdapter->informNiResponse(mResponse, mPayload);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInformNiResponse - "
+ "response: %s\n mPayload: %p",
+ loc_get_ni_response_name(mResponse),
+ mPayload);
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough)
+{
+ ENTRY_LOG();
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) {
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ }
+ } else {
+ if (NULL != loc_eng_ni_data_p->session.rawRequest ||
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+ }
+
+
+ if (pSession) {
+ /* Save request */
+ pSession->rawRequest = (void*)passThrough;
+ pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter;
+ pSession->adapter = loc_eng_data.adapter;
+
+ /* Fill in notification */
+ ((GpsNiNotification*)notif)->notification_id = pSession->reqID;
+
+ if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session(loc_eng_data);
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif->ni_type, notif->timeout, notif->default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif->requestor_id, notif->requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif->text, notif->text_encoding);
+ if (notif->extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif->extras);
+ }
+
+ /* 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 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft);
+
+ int rc = 0;
+ rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(pSession->thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+
+ CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
+ loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION ni_thread_proc
+
+===========================================================================*/
+static void* ni_thread_proc(void *args)
+{
+ ENTRY_LOG();
+
+ loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n",
+ (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 = GPS_NI_RESPONSE_NORESP;
+ LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/
+
+ LOC_LOGD("pSession->resp is %d\n",pSession->resp);
+
+ // 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()
+ LocEngAdapter* adapter = pSession->adapter;
+ LocEngInformNiResponse *msg = NULL;
+
+ if (NULL != pSession->rawRequest) {
+ if (pSession->resp != GPS_NI_RESPONSE_IGNORE) {
+ LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n");
+ msg = new LocEngInformNiResponse(adapter,
+ pSession->resp,
+ pSession->rawRequest);
+ } else {
+ LOC_LOGD("this is the ignore reply for SUPL ES\n");
+ free(pSession->rawRequest);
+ }
+ pSession->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&pSession->tLock);
+
+ pSession->respTimeLeft = 0;
+ pSession->reqID = 0;
+
+ if (NULL != msg) {
+ LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n");
+ adapter->sendMsg(msg);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+ return NULL;
+}
+
+void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ // only if modem has requested but then died.
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ free(loc_eng_ni_data_p->sessionEs.rawRequest);
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->sessionEs.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock);
+ }
+
+ if (NULL != loc_eng_ni_data_p->session.rawRequest) {
+ free(loc_eng_ni_data_p->session.rawRequest);
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if(callbacks == NULL)
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
+ else if (NULL == callbacks->notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
+ } else if (NULL != loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
+ } else {
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_data_p->sessionEs.respTimeLeft = 0;
+ loc_eng_ni_data_p->sessionEs.respRecvd = FALSE;
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+ loc_eng_ni_data_p->sessionEs.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL);
+
+ loc_eng_ni_data_p->session.respTimeLeft = 0;
+ loc_eng_ni_data_p->session.respRecvd = FALSE;
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+ loc_eng_ni_data_p->session.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL);
+
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ EXIT_LOG(%s, VOID_RET);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function receives user response from upper layer framework
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG_CALLFLOW();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif_id == loc_eng_ni_data_p->sessionEs.reqID &&
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (user_response == GPS_NI_RESPONSE_ACCEPT &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE;
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+ } else if (notif_id == loc_eng_ni_data_p->session.reqID &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+
+ if (pSession) {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ pthread_mutex_lock(&pSession->tLock);
+ pSession->resp = user_response;
+ pSession->respRecvd = TRUE;
+ pthread_cond_signal(&pSession->tCond);
+ pthread_mutex_unlock(&pSession->tLock);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_ni.h b/msm8994/loc_api/libloc_api_50001/loc_eng_ni.h
new file mode 100644
index 0000000..068f5cd
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_ni.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009,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 LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <stdbool.h>
+#include <LocEngAdapter.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+#define GPS_NI_RESPONSE_IGNORE 4
+
+typedef struct {
+ pthread_t thread; /* NI thread */
+ int respTimeLeft; /* examine time for NI response */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ int reqID; /* ID to check against response */
+ GpsUserResponseType resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+ LocEngAdapter* adapter;
+} loc_eng_ni_session_s_type;
+
+typedef struct {
+ loc_eng_ni_session_s_type session; /* SUPL NI Session */
+ loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */
+ int reqIDCounter;
+} loc_eng_ni_data_s_type;
+
+
+#endif /* LOC_ENG_NI_H */
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_nmea.cpp
new file mode 100644
index 0000000..4c6b9a3
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -0,0 +1,836 @@
+/* Copyright (c) 2012, 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng_nmea"
+#define GPS_PRN_START 1
+#define GPS_PRN_END 32
+#define GLONASS_PRN_START 65
+#define GLONASS_PRN_END 96
+#include <loc_eng.h>
+#include <loc_eng_nmea.h>
+#include <math.h>
+#include "log_util.h"
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_send
+
+DESCRIPTION
+ send out NMEA sentence
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
+{
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ CALLBACK_LOG_CALLFLOW("nmea_cb", %p, pNmea);
+ if (loc_eng_data_p->nmea_cb != NULL)
+ loc_eng_data_p->nmea_cb(now, pNmea, length);
+ LOC_LOGD("NMEA <%s", pNmea);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_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
+
+===========================================================================*/
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 0;
+
+ pNmea++; //skip the $
+ while (*pNmea != '\0')
+ {
+ checksum ^= *pNmea++;
+ length++;
+ }
+
+ int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum);
+ return (length + checksumLength);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ unsigned char generate_nmea)
+{
+ ENTRY_LOG();
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ if (NULL == pTm) {
+ LOC_LOGE("gmtime failed");
+ return;
+ }
+
+ char sentence[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;
+
+ if (generate_nmea) {
+ // ------------------
+ // ------$GPGSA------
+ // ------------------
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+ uint32_t mask = loc_eng_data_p->sv_used_mask;
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i;
+ mask = mask >> 1;
+ }
+ // clear the cache so they can't be used again
+ loc_eng_data_p->sv_used_mask = 0;
+
+ char fixType;
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ {
+ 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;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPVTG------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & 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, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPRMC------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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 & 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 & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPGGA------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," ,
+ utcHours, utcMinutes, utcSeconds);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ gpsQuality = '1'; // 1 means GPS fix
+ else
+ gpsQuality = '2'; // 2 means DGPS fix
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, loc_eng_data_p->hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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 & GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ // clear the dop cache so they can't be used again
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
+ const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int svCount = svStatus.num_svs;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+ int gpsCount = 0;
+ int glnCount = 0;
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+
+ for(svNumber=1; svNumber <= svCount; svNumber++) {
+ if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&&
+ (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+ {
+ gpsCount++;
+ }
+ else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) )
+ {
+ glnCount++;
+ }
+ }
+
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ if (gpsCount <= 0)
+ {
+ // no svs in view, so just send a blank $GPGSV sentence
+ strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = gpsCount/4 + (gpsCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, gpsCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) )
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ } //if
+
+ // ------------------
+ // ------$GLGSV------
+ // ------------------
+
+ if (glnCount <= 0)
+ {
+ // no svs in view, so just send a blank $GLGSV sentence
+ strlcpy(sentence, "$GLGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = glnCount/4 + (glnCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GLGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, glnCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) &&
+ (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) {
+
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.sv_list[svNumber-1].prn,
+ (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.sv_list[svNumber-1].snr > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ }//if
+
+ if (svStatus.used_in_fix_mask == 0)
+ { // No sv used, so there will be no position report, so send
+ // blank NMEA sentences
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ { // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask;
+
+ // For RPC, the DOP are sent during sv report, so cache them
+ // now to be sent during position report.
+ // For QMI, the DOP will be in position report.
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ loc_eng_data_p->pdop = locationExtended.pdop;
+ loc_eng_data_p->hdop = locationExtended.hdop;
+ loc_eng_data_p->vdop = locationExtended.vdop;
+ }
+ else
+ {
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+ }
+
+ }
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_nmea.h b/msm8994/loc_api/libloc_api_50001/loc_eng_nmea.h
new file mode 100644
index 0000000..40c6dbb
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2012, 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 <hardware/gps.h>
+
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
+
+#endif // LOC_ENG_NMEA_H
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/msm8994/loc_api/libloc_api_50001/loc_eng_xtra.cpp
new file mode 100644
index 0000000..7bb8083
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -0,0 +1,213 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+struct LocEngRequestXtraServer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngRequestXtraServer(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->requestXtraServer();
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngRequestXtraServer");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInjectXtraData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ char* mData;
+ const int mLen;
+ inline LocEngInjectXtraData(LocEngAdapter* adapter,
+ char* data, int len):
+ LocMsg(), mAdapter(adapter),
+ mData(new char[len]), mLen(len)
+ {
+ memcpy((void*)mData, (void*)data, len);
+ locallog();
+ }
+ inline ~LocEngInjectXtraData()
+ {
+ delete[] mData;
+ }
+ inline virtual void proc() const {
+ mAdapter->setXtraData(mData, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("length: %d\n data: %p", mLen, mData);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSetXtraVersionCheck : public LocMsg {
+ LocEngAdapter *mAdapter;
+ int mCheck;
+ inline LocEngSetXtraVersionCheck(LocEngAdapter* adapter,
+ int check):
+ mAdapter(adapter), mCheck(check) {}
+ inline virtual void proc() const {
+ locallog();
+ mAdapter->setXtraVersionCheck(mCheck);
+ }
+ inline void locallog() const {
+ LOC_LOGD("%s:%d]: mCheck: %d",
+ __func__, __LINE__, mCheck);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks)
+{
+ int ret_val = -1;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+ ENTRY_LOG();
+
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
+ } else {
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr->report_xtra_server_cb = callbacks->report_xtra_server_cb;
+
+ ret_val = 0;
+ }
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_inject_data
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_request_server
+
+DESCRIPTION
+ Request the Xtra server url from the modem
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngRequestXtraServer(adapter));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_version_check
+
+DESCRIPTION
+ Injects the enable/disable value for checking XTRA version
+ that is specified in gps.conf
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data,
+ int check)
+{
+ ENTRY_LOG();
+ LocEngAdapter *adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngSetXtraVersionCheck(adapter, check));
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8994/loc_api/libloc_api_50001/loc_eng_xtra.h b/msm8994/loc_api/libloc_api_50001/loc_eng_xtra.h
new file mode 100644
index 0000000..175f497
--- /dev/null
+++ b/msm8994/loc_api/libloc_api_50001/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2009,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 LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ report_xtra_server report_xtra_server_cb;
+
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H
diff --git a/msm8994/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/msm8994/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/msm8994/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/msm8994/platform_lib_abstractions/platform_lib_includes.h b/msm8994/platform_lib_abstractions/platform_lib_includes.h
new file mode 100644
index 0000000..5858674
--- /dev/null
+++ b/msm8994/platform_lib_abstractions/platform_lib_includes.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_INCLUDES_H_
+#define _PLATFORM_LIB_INCLUDES_H_
+
+#include "platform_lib_time.h"
+#include "platform_lib_macros.h"
+
+#endif
diff --git a/msm8994/platform_lib_abstractions/platform_lib_macros.h b/msm8994/platform_lib_abstractions/platform_lib_macros.h
new file mode 100644
index 0000000..bc48dd9
--- /dev/null
+++ b/msm8994/platform_lib_abstractions/platform_lib_macros.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#include <sys/time.h>
+
+#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); \
+}
+
+
+#ifdef USE_GLIB
+
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+
+#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)
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
+
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
+
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+pid_t gettid(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
+
+#endif
+
+#endif
diff --git a/msm8994/platform_lib_abstractions/platform_lib_time.h b/msm8994/platform_lib_abstractions/platform_lib_time.h
new file mode 100644
index 0000000..ce013af
--- /dev/null
+++ b/msm8994/platform_lib_abstractions/platform_lib_time.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_TIME_H_
+#define _PLATFORM_LIB_TIME_H_
+
+int64_t systemTime(int clock);
+int64_t elapsedMillisSinceBoot();
+
+#endif
diff --git a/msm8994/utils/Android.mk b/msm8994/utils/Android.mk
new file mode 100644
index 0000000..f34e101
--- /dev/null
+++ b/msm8994/utils/Android.mk
@@ -0,0 +1,61 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ loc_timer.c \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ loc_misc_utils.cpp
+
+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_C_INCLUDES:= \
+ $(LOCAL_PATH)/../platform_lib_abstractions
+
+LOCAL_COPY_HEADERS_TO:= gps.utils/
+LOCAL_COPY_HEADERS:= \
+ loc_log.h \
+ loc_cfg.h \
+ log_util.h \
+ linked_list.h \
+ msg_q.h \
+ loc_target.h \
+ loc_timer.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h \
+ loc_misc_utils.h
+
+LOCAL_MODULE := libgps.utils
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8994/utils/Makefile.am b/msm8994/utils/Makefile.am
new file mode 100644
index 0000000..e5935f0
--- /dev/null
+++ b/msm8994/utils/Makefile.am
@@ -0,0 +1,44 @@
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I../platform_lib_abstractions
+
+libgps_utils_so_la_h_sources = log_util.h \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
+
+libgps_utils_so_la_c_sources = linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
+
+library_includedir = $(pkgincludedir)/utils
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lstdc++ -lcutils
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
diff --git a/msm8994/utils/linked_list.c b/msm8994/utils/linked_list.c
new file mode 100644
index 0000000..92617fe
--- /dev/null
+++ b/msm8994/utils/linked_list.c
@@ -0,0 +1,328 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include <stdlib.h>
+#include <stdint.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*))
+{
+ LOC_LOGD("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, 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;
+ 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)
+{
+ LOC_LOGD("%s: Removing from list\n", __FUNCTION__);
+ 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)
+{
+ LOC_LOGD("%s: Search the list\n", __FUNCTION__);
+ 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/msm8994/utils/linked_list.h b/msm8994/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/msm8994/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/msm8994/utils/loc_cfg.cpp b/msm8994/utils/loc_cfg.cpp
new file mode 100644
index 0000000..5c33320
--- /dev/null
+++ b/msm8994/utils/loc_cfg.cpp
@@ -0,0 +1,400 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 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 <loc_cfg.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint32_t DEBUG_LEVEL = 0xff;
+static uint32_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
+};
+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;
+
+/*===========================================================================
+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(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 + 1);
+ }
+ /* 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,
+ 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, "=", &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, 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,
+ 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, loc_param_s_type* config_table,
+ uint32_t table_length)
+{
+ FILE *conf_fp = NULL;
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ if((conf_fp = fopen(conf_file_name, "r")) != NULL)
+ {
+ 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);
+}
diff --git a/msm8994/utils/loc_cfg.h b/msm8994/utils/loc_cfg.h
new file mode 100644
index 0000000..ea4865b
--- /dev/null
+++ b/msm8994/utils/loc_cfg.h
@@ -0,0 +1,91 @@
+/* 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 LOC_CFG_H
+#define LOC_CFG_H
+
+#include <stdio.h>
+#include <stdint.h>
+
+#define LOC_MAX_PARAM_NAME 80
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING)
+
+#define 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
+{
+ char param_name[LOC_MAX_PARAM_NAME];
+ void *param_ptr;
+ uint8_t *param_set; /* was this value set by config file? */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for float */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+void loc_read_conf(const char* conf_file_name,
+ loc_param_s_type* config_table,
+ uint32_t table_length);
+int loc_read_conf_r(FILE *conf_fp, loc_param_s_type* config_table,
+ uint32_t table_length);
+int loc_update_conf(const char* conf_data, int32_t length,
+ loc_param_s_type* config_table, uint32_t table_length);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/msm8994/utils/loc_log.cpp b/msm8994/utils/loc_log.cpp
new file mode 100644
index 0000000..e0f8478
--- /dev/null
+++ b/msm8994/utils/loc_log.cpp
@@ -0,0 +1,242 @@
+/* Copyright (c) 2011-2012, 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_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#ifdef USE_GLIB
+#include <time.h>
+#endif /* USE_GLIB */
+#include "log_util.h"
+#include "platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static loc_name_val_s_type 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 )
+};
+static int loc_msg_q_status_num = sizeof(loc_msg_q_status) / sizeof(loc_name_val_s_type);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+loc_name_val_s_type target_name[] =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_QCA1530),
+ NAME_VAL(GNSS_AUTO),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ static char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index >= target_name_num || index < 0)
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ snprintf(ret, sizeof(ret), " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ snprintf(ret, sizeof(ret), " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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, unsigned long 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/msm8994/utils/loc_log.h b/msm8994/utils/loc_log.h
new file mode 100644
index 0000000..82dc636
--- /dev/null
+++ b/msm8994/utils/loc_log.h
@@ -0,0 +1,68 @@
+/* Copyright (c) 2011-2012, 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
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ char name[128];
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#define CHECK_MASK(type, value, mask_var, mask) \
+ ((mask_var & mask) ? (type) value : (type) (-1))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask);
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, unsigned long buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/msm8994/utils/loc_misc_utils.cpp b/msm8994/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..7e96313
--- /dev/null
+++ b/msm8994/utils/loc_misc_utils.cpp
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#include <ctype.h>
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+
+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;
+}
diff --git a/msm8994/utils/loc_misc_utils.h b/msm8994/utils/loc_misc_utils.h
new file mode 100644
index 0000000..7d66d84
--- /dev/null
+++ b/msm8994/utils/loc_misc_utils.h
@@ -0,0 +1,99 @@
+/* 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/msm8994/utils/loc_target.cpp b/msm8994/utils/loc_target.cpp
new file mode 100644
index 0000000..b14ec42
--- /dev/null
+++ b/msm8994/utils/loc_target.cpp
@@ -0,0 +1,247 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <hardware/gps.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include "log_util.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_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
+/* When system server is started, it uses 20 seconds as ActivityManager
+ * timeout. After that it sends SIGSTOP signal to process.
+ */
+#define QCA1530_DETECT_TIMEOUT 15
+#define QCA1530_DETECT_PRESENT "yes"
+#define QCA1530_DETECT_PROGRESS "detect"
+
+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);
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+/*!
+ * \brief Checks if QCA1530 is avalable.
+ *
+ * Function verifies if qca1530 SoC is configured on the device. The test is
+ * based on property value. For 1530 scenario, the value shall be one of the
+ * following: "yes", "no", "detect". All other values are treated equally to
+ * "no". When the value is "detect" the system waits for SoC detection to
+ * finish before returning result.
+ *
+ * \retval true - QCA1530 is available.
+ * \retval false - QCA1530 is not available.
+ */
+static bool is_qca1530(void)
+{
+ static const char qca1530_property_name[] = "sys.qca1530";
+ bool res = false;
+ int ret, i;
+ char buf[PROPERTY_VALUE_MAX];
+
+ memset(buf, 0, sizeof(buf));
+
+ for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
+ {
+ ret = property_get(qca1530_property_name, buf, NULL);
+ if (ret < 0)
+ {
+ LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
+ qca1530_property_name,
+ ret);
+
+ break;
+ }
+
+ LOC_LOGV( "qca1530: property %s is set to %s",
+ qca1530_property_name,
+ buf);
+
+ if (!memcmp(buf, QCA1530_DETECT_PRESENT,
+ sizeof(QCA1530_DETECT_PRESENT)))
+ {
+ res = true;
+ break;
+ }
+ if (!memcmp(buf, QCA1530_DETECT_PROGRESS,
+ sizeof(QCA1530_DETECT_PROGRESS)))
+ {
+ LOC_LOGV("qca1530: SoC detection is in progress.");
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+
+ LOC_LOGD("qca1530: detected=%s", res ? "true" : "false");
+ return res;
+}
+
+/*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__);
+ }
+}
+
+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 id[] = "/sys/devices/soc0/soc_id";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
+ static const char mdm[] = "/dev/mdm"; // No such file or directory
+
+ char rd_hw_platform[LINE_LEN];
+ char rd_id[LINE_LEN];
+ char rd_mdm[LINE_LEN];
+ char baseband[LINE_LEN];
+
+ if (is_qca1530()) {
+ gTarget = TARGET_QCA1530;
+ goto detected;
+ }
+
+ 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);
+ }
+ if (!access(id, F_OK)) {
+ read_a_line(id, rd_id, LINE_LEN);
+ } else {
+ read_a_line(id_dep, rd_id, LINE_LEN);
+ }
+ if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) )
+ {
+ gTarget = TARGET_AUTO;
+ goto detected;
+ }
+ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
+
+ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
+ && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
+ gTarget = TARGET_MPQ;
+ 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)]))) {
+
+ if (!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
+ gTarget = TARGET_UNKNOWN;
+ }
+
+detected:
+ LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
+ return gTarget;
+}
diff --git a/msm8994/utils/loc_target.h b/msm8994/utils/loc_target.h
new file mode 100644
index 0000000..873ddfc
--- /dev/null
+++ b/msm8994/utils/loc_target.h
@@ -0,0 +1,77 @@
+/* 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_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
+#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
+#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, 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);
+
+/* 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_QCA1530,
+ 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/msm8994/utils/loc_timer.c b/msm8994/utils/loc_timer.c
new file mode 100644
index 0000000..56db489
--- /dev/null
+++ b/msm8994/utils/loc_timer.c
@@ -0,0 +1,203 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<sys/time.h>
+#include "loc_timer.h"
+#include<time.h>
+#include<errno.h>
+
+enum timer_state {
+ READY = 100,
+ WAITING,
+ DONE,
+ ABORT
+};
+
+typedef struct {
+ loc_timer_callback callback_func;
+ void *user_data;
+ unsigned int time_msec;
+ pthread_cond_t timer_cond;
+ pthread_mutex_t timer_mutex;
+ enum timer_state state;
+}timer_data;
+
+static void *timer_thread(void *thread_data)
+{
+ int ret = -ETIMEDOUT;
+ struct timespec ts;
+ struct timeval tv;
+ timer_data* t = (timer_data*)thread_data;
+
+ LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t->time_msec);
+
+ gettimeofday(&tv, NULL);
+ clock_gettime(CLOCK_REALTIME, &ts);
+ if(t->time_msec >= 1000) {
+ ts.tv_sec += t->time_msec/1000;
+ t->time_msec = t->time_msec % 1000;
+ }
+ if(t->time_msec)
+ ts.tv_nsec += t->time_msec * 1000000;
+ if(ts.tv_nsec > 999999999) {
+ LOC_LOGD("%s:%d]: Large nanosecs\n", __func__, __LINE__);
+ ts.tv_sec += 1;
+ ts.tv_nsec -= 1000000000;
+ }
+ LOC_LOGD("%s:%d]: ts.tv_sec:%d; ts.tv_nsec:%d\n"
+ "\t Current time: %d sec; %d nsec",
+ __func__, __LINE__, (int)ts.tv_sec, (int)ts.tv_nsec,
+ (int)tv.tv_sec, (int)tv.tv_usec*1000);
+
+ pthread_mutex_lock(&(t->timer_mutex));
+ if (READY == t->state) {
+ t->state = WAITING;
+ ret = pthread_cond_timedwait(&t->timer_cond, &t->timer_mutex, &ts);
+ t->state = DONE;
+ }
+ pthread_mutex_unlock(&(t->timer_mutex));
+
+ switch (ret) {
+ case ETIMEDOUT:
+ LOC_LOGV("%s:%d]: loc_timer timed out", __func__, __LINE__);
+ break;
+ case 0:
+ LOC_LOGV("%s:%d]: loc_timer stopped", __func__, __LINE__);
+ break;
+ case -ETIMEDOUT:
+ LOC_LOGV("%s:%d]: loc_timer cancelled", __func__, __LINE__);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Call to pthread timedwait failed; ret=%d\n",
+ __func__, __LINE__, ret);
+ break;
+ }
+
+ if(ETIMEDOUT == ret)
+ t->callback_func(t->user_data, ret);
+
+ // A (should be rare) race condition is that, when the loc_time_stop is called
+ // and acquired mutex, we reach here. pthread_mutex_destroy will fail with
+ // error code EBUSY. We give it 6 tries in 5 seconds. Should be eanough time
+ // for loc_timer_stop to complete. With the 7th try, we also perform unlock
+ // prior to destroy.
+ {
+ int i;
+ for (i = 0; EBUSY == pthread_mutex_destroy(&t->timer_mutex) && i <= 5; i++) {
+ if (i < 5) {
+ sleep(1);
+ } else {
+ // nah, forget it, something is seriously wrong. Mutex has been
+ // held too long. Unlock the mutext here.
+ pthread_mutex_unlock(&t->timer_mutex);
+ }
+ }
+ }
+ pthread_cond_destroy(&t->timer_cond);
+
+ free(t);
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return NULL;
+}
+
+void* loc_timer_start(unsigned int msec, loc_timer_callback cb_func,
+ void* caller_data)
+{
+ timer_data *t=NULL;
+ pthread_attr_t tattr;
+ pthread_t id;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ if(cb_func == NULL || msec == 0) {
+ LOC_LOGE("%s:%d]: Error: Wrong parameters\n", __func__, __LINE__);
+ goto _err;
+ }
+ t = (timer_data *)calloc(1, sizeof(timer_data));
+ if(t == NULL) {
+ LOC_LOGE("%s:%d]: Could not allocate memory. Failing.\n",
+ __func__, __LINE__);
+ goto _err;
+ }
+
+ if(pthread_cond_init(&(t->timer_cond), NULL)) {
+ LOC_LOGE("%s:%d]: Pthread cond init failed\n", __func__, __LINE__);
+ goto t_err;
+ }
+ if(pthread_mutex_init(&(t->timer_mutex), NULL)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ goto cond_err;
+ }
+
+ t->callback_func = cb_func;
+ t->user_data = caller_data;
+ t->time_msec = msec;
+ t->state = READY;
+
+ if (pthread_attr_init(&tattr)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ goto mutex_err;
+ }
+ pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+
+ if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) {
+ LOC_LOGE("%s:%d]: Could not create thread\n", __func__, __LINE__);
+ goto attr_err;
+ }
+
+ LOC_LOGD("%s:%d]: Created thread with id: %d\n",
+ __func__, __LINE__, (int)id);
+ goto _err;
+
+attr_err:
+ pthread_attr_destroy(&tattr);
+mutex_err:
+ pthread_mutex_destroy(&t->timer_mutex);
+cond_err:
+ pthread_cond_destroy(&t->timer_cond);
+t_err:
+ free(t);
+ t = NULL;
+_err:
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return t;
+}
+
+void loc_timer_stop(void* handle) {
+ timer_data* t = (timer_data*)handle;
+
+ if (NULL != t && (READY == t->state || WAITING == t->state) &&
+ pthread_mutex_lock(&(t->timer_mutex)) == 0) {
+ if (READY == t->state || WAITING == t->state) {
+ pthread_cond_signal(&t->timer_cond);
+ t->state = ABORT;
+ }
+ pthread_mutex_unlock(&(t->timer_mutex));
+ }
+}
diff --git a/msm8994/utils/loc_timer.h b/msm8994/utils/loc_timer.h
new file mode 100644
index 0000000..0034d27
--- /dev/null
+++ b/msm8994/utils/loc_timer.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_DELAY_H__
+#define __LOC_DELAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#include<pthread.h>
+#include "log_util.h"
+
+/*
+ Return values:
+ Success = 0
+ Failure = Non zero
+*/
+typedef void(*loc_timer_callback)(void *user_data, int result);
+
+
+/*
+ Returns the handle, which can be used to stop the timer
+*/
+void* loc_timer_start(unsigned int delay_msec,
+ loc_timer_callback,
+ void* user_data);
+
+/*
+ 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/msm8994/utils/log_util.h b/msm8994/utils/log_util.h
new file mode 100644
index 0000000..42ef961
--- /dev/null
+++ b/msm8994/utils/log_util.h
@@ -0,0 +1,159 @@
+/* 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__
+
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#endif /* USE_GLIB */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
+#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
+#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
+#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
+#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE(__VA_ARGS__)
+#define LOC_LOGW(...) ALOGW(__VA_ARGS__)
+#define LOC_LOGI(...) ALOGI(__VA_ARGS__)
+#define LOC_LOGD(...) ALOGD(__VA_ARGS__)
+#define LOC_LOGV(...) ALOGV(__VA_ARGS__)
+
+#endif /* DEBUG_DMN_LOC_API */
+
+/*=============================================================================
+ *
+ * LOGGING IMPROVEMENT MACROS
+ *
+ *============================================================================*/
+#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \
+ do { \
+ if (loc_logger.TIMESTAMP) { \
+ char ts[32]; \
+ LOC_LOG("[%s] %s %s line %d " #SPEC, \
+ get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \
+ } else { \
+ LOC_LOG("%s %s line %d " #SPEC, \
+ ID, WHAT, __LINE__, VAL); \
+ } \
+ } while(0)
+
+
+#define 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 ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow to Android Framework
+#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __LOG_UTIL_H__
diff --git a/msm8994/utils/msg_q.c b/msm8994/utils/msg_q.c
new file mode 100644
index 0000000..f82d4c0
--- /dev/null
+++ b/msm8994/utils/msg_q.c
@@ -0,0 +1,336 @@
+/* Copyright (c) 2011-2012, 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 "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.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_LOGD("%s: Sending message with handle = 0x%08X\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_LOGD("%s: Finished Sending message with handle = 0x%08X\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;
+
+ LOC_LOGD("%s: Waiting on message\n", __FUNCTION__);
+
+ 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_LOGD("%s: Received message 0x%08X 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/msm8994/utils/msg_q.h b/msm8994/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/msm8994/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/msm8996/Android.mk b/msm8996/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/msm8996/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/msm8996/CleanSpec.mk b/msm8996/CleanSpec.mk
new file mode 100644
index 0000000..dd1849d
--- /dev/null
+++ b/msm8996/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/msm8996/Makefile.am b/msm8996/Makefile.am
new file mode 100644
index 0000000..f374a5c
--- /dev/null
+++ b/msm8996/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am - Automake script for gps loc_api
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = utils loc_api/libloc_api_50001 loc_api/loc_api_v02
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-api.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/msm8996/configure.ac b/msm8996/configure.ac
new file mode 100644
index 0000000..dca18a1
--- /dev/null
+++ b/msm8996/configure.ac
@@ -0,0 +1,85 @@
+# configure.ac -- Autoconf script for gps loc_api
+#
+# 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 package version 1.0.0
+AC_INIT([loc-api],1.0.0)
+# Does not strictly follow GNU Coding standards
+AM_INIT_AUTOMAKE([foreign])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([utils/loc_cfg.cpp])
+# 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([QMIF], [qmi-framework])
+AC_SUBST([QMIF_CFLAGS])
+AC_SUBST([QMIF_LIBS])
+
+AC_ARG_WITH([libhardware_includes],
+ AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@],
+ [Specify the location of the libhardware headers]),
+ [libhardware_incdir=$withval],
+ with_libhardware_includes=no)
+
+if test "x$with_libhardware_includes" != "xno"; then
+ CPPFLAGS="${CPPFLAGS} -I${libhardware_incdir}"
+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_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 \
+ utils/Makefile \
+ loc_api/libloc_api_50001/Makefile \
+ loc_api/loc_api_v02/Makefile \
+ loc-api.pc \
+ ])
+
+AC_OUTPUT
diff --git a/msm8996/core/Android.mk b/msm8996/core/Android.mk
new file mode 100644
index 0000000..fac5092
--- /dev/null
+++ b/msm8996/core/Android.mk
@@ -0,0 +1,54 @@
+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_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_PROPRIETARY_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 := \
+ liblog \
+ libutils \
+ libcutils \
+ libgps.utils \
+ libdl
+
+LOCAL_SRC_FILES += \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils
+
+LOCAL_HEADER_LIBRARIES := libgps.utils_headers
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_core_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/msm8996/core/ContextBase.cpp b/msm8996/core/ContextBase.cpp
new file mode 100644
index 0000000..971354d
--- /dev/null
+++ b/msm8996/core/ContextBase.cpp
@@ -0,0 +1,135 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+loc_gps_cfg_s_type ContextBase::mGps_conf {0};
+loc_sap_cfg_s_type ContextBase::mSap_conf {0};
+
+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)();
+ }
+ }
+ 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;
+
+ // first if can not be MPQ
+ if (TARGET_MPQ != loc_get_target()) {
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
+ if(getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__);
+ locApi = (*getter)(mMsgTask, 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)(mMsgTask, exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, 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())
+{
+}
+
+}
diff --git a/msm8996/core/ContextBase.h b/msm8996/core/ContextBase.h
new file mode 100644
index 0000000..d1f2b61
--- /dev/null
+++ b/msm8996/core/ContextBase.h
@@ -0,0 +1,136 @@
+/* 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 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>
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+/* 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 CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t XTRA_VERSION_CHECK;
+ char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} 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);
+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() { delete mLocApi; delete mLBSProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+ inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
+ inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mLBSProxy->requestUlp(adapter, capabilities);
+ }
+ 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 uint32_t getCarrierCapabilities();
+
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/msm8996/core/LBSProxyBase.h b/msm8996/core/LBSProxyBase.h
new file mode 100644
index 0000000..eeb70e2
--- /dev/null
+++ b/msm8996/core/LBSProxyBase.h
@@ -0,0 +1,65 @@
+/* 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>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {}
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual bool hasCPIExtendedCapabilities() const { return false; }
+ inline virtual void modemPowerVote(bool power) const {}
+ virtual void injectFeatureConfig(ContextBase* context) const {}
+ inline virtual bool hasNativeXtraClient() const { return false; }
+};
+
+typedef LBSProxyBase* (getLBSProxy_t)();
+
+} // namespace loc_core
+
+#endif // IZAT_PROXY_BASE_H
diff --git a/msm8996/core/LocAdapterBase.cpp b/msm8996/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..d4727d8
--- /dev/null
+++ b/msm8996/core/LocAdapterBase.cpp
@@ -0,0 +1,142 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 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, LocAdapterProxyBase *adapterProxyBase) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask())
+{
+ mLocApi->addAdapter(this);
+}
+
+void LocAdapterBase::handleEngineUpEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineUpEvent();
+ }
+}
+
+void LocAdapterBase::handleEngineDownEvent()
+{
+ if (mLocAdapterProxyBase) {
+ mLocAdapterProxyBase->handleEngineDownEvent();
+ }
+}
+
+void LocAdapterBase::
+ reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ if (mLocAdapterProxyBase == NULL ||
+ !mLocAdapterProxyBase->reportPosition(location,
+ locationExtended,
+ status,
+ loc_technology_mask)) {
+ DEFAULT_IMPL()
+ }
+}
+
+void LocAdapterBase::
+ reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportStatus(GpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmea(const char* nmea, int length)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestXtraData()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestTime()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestLocation()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestATL(int connHandle, AGpsType agps_type)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotify(GpsNiNotification ¬ify, const void* data)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportGnssMeasurementData(GnssData &gnssMeasurementData)
+DEFAULT_IMPL()
+} // namespace loc_core
diff --git a/msm8996/core/LocAdapterBase.h b/msm8996/core/LocAdapterBase.h
new file mode 100644
index 0000000..3334bda
--- /dev/null
+++ b/msm8996/core/LocAdapterBase.h
@@ -0,0 +1,119 @@
+/* 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 LOC_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+protected:
+ LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ 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 isEnabled)
+ {
+ mEvtMask =
+ isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event);
+
+ mLocApi->updateEvtMask();
+ }
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxy(UlpProxyBase* ulp) {}
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeInt(LocPosMode& posMode) {}
+ virtual void startFixInt() {}
+ virtual void stopFixInt() {}
+ virtual void getZppInt() {}
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotify(GpsNiNotification ¬ify,
+ const void* data);
+ inline virtual bool isInSession() { return false; }
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/msm8996/core/LocAdapterProxyBase.h b/msm8996/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..e1d0ccf
--- /dev/null
+++ b/msm8996/core/LocAdapterProxyBase.h
@@ -0,0 +1,70 @@
+/* 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_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):
+ mLocAdapterBase(new LocAdapterBase(mask, context, 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);
+ }
+
+public:
+ inline ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
+ inline virtual void handleEngineUpEvent() {};
+ inline virtual void handleEngineDownEvent() {};
+ inline virtual bool reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif //LOC_ADAPTER_PROXY_BASE_H
diff --git a/msm8996/core/LocApiBase.cpp b/msm8996/core/LocApiBase.cpp
new file mode 100644
index 0000000..3a274ed
--- /dev/null
+++ b/msm8996/core/LocApiBase.cpp
@@ -0,0 +1,551 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <log_util.h>
+#include <LocDualContext.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ inline LocOpenMsg(LocApiBase* locApi,
+ LOC_API_ADAPTER_EVENT_MASK_T mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->open(mMask);
+ }
+ inline void locallog() {
+ LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
+ __func__, __LINE__, mMask);
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask),
+ mMask(0), mSupportedMsg(0), mContext(context)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ mMsgTask->sendMsg(new LocOpenMsg(this,
+ (adapter->getEvtMask())));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ }
+ }
+ }
+}
+
+void LocApiBase::updateEvtMask()
+{
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ LocDualContext::injectFeatureConfig(mContext);
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
+}
+
+void LocApiBase::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ // print the location info before delivering
+ LOC_LOGV("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: %lld\n rawDataSize: %d\n rawData: %p\n "
+ "Session status: %d\n Technology mask: %u",
+ 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, location.rawDataSize,
+ location.rawData, status, loc_technology_mask);
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask)
+ );
+}
+
+void LocApiBase::reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+ // print the SV info before delivering
+ LOC_LOGV("num sv: %d", svStatus.num_svs);
+ for (int i = 0; i < svStatus.num_svs && i < GNSS_MAX_SVS; i++) {
+ LOC_LOGV(" %03d: %02d %d %f %f %f 0x%02X",
+ i,
+ svStatus.gnss_sv_list[i].svid,
+ svStatus.gnss_sv_list[i].constellation,
+ svStatus.gnss_sv_list[i].c_n0_dbhz,
+ svStatus.gnss_sv_list[i].elevation,
+ svStatus.gnss_sv_list[i].azimuth,
+ svStatus.gnss_sv_list[i].flags);
+ }
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSv(svStatus,
+ locationExtended,
+ svExt)
+ );
+}
+
+void LocApiBase::reportStatus(GpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+void LocApiBase::reportNmea(const char* nmea, int length)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmea(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::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, AGpsType agps_type)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
+}
+
+void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
+{
+ mSupportedMsg = supportedMsgList;
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGnssMeasurementData(GnssData &gnssMeasurementData)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementData(gnssMeasurementData));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ deleteAidingData(GpsAidingData f)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int enable)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* apn, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double latitude, double longitude, float accuracy)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, AGpsType agpsType)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int handle, int is_succ)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(const char* url, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSUPLVersion(uint32_t version)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setLPPConfig(uint32_t profile)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage,
+ int sensorProvider)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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)
+
+enum loc_api_adapter_err LocApiBase::
+ setExtPowerConfig(int isBatteryCharging)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix(GpsLocation& zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation& zppLoc)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ memset(&tech_mask, 0, sizeof(tech_mask));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+int LocApiBase::
+ initDataServiceClient()
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+int LocApiBase::
+ setGpsLock(LOC_GPS_LOCK_MASK lock)
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+DEFAULT_IMPL()
+
+int LocApiBase::
+ getGpsLock()
+DEFAULT_IMPL(-1)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraVersionCheck(enum xtra_version_check check)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+int LocApiBase::
+ updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+DEFAULT_IMPL(-1)
+
+bool LocApiBase::
+ gnssConstellationConfig()
+DEFAULT_IMPL(false)
+
+} // namespace loc_core
diff --git a/msm8996/core/LocApiBase.h b/msm8996/core/LocApiBase.h
new file mode 100644
index 0000000..7658f1f
--- /dev/null
+++ b/msm8996/core/LocApiBase.h
@@ -0,0 +1,261 @@
+/* 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 LOC_API_BASE_H
+#define LOC_API_BASE_H
+
+#include <stddef.h>
+#include <ctype.h>
+#include <gps_extended.h>
+#include <MsgTask.h>
+#include <log_util.h>
+
+namespace loc_core {
+class ContextBase;
+
+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 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;
+
+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 class ContextBase;
+ const MsgTask* mMsgTask;
+ ContextBase *mContext;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+ uint64_t mSupportedMsg;
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+
+ void addAdapter(LocAdapterBase* adapter);
+ void removeAdapter(LocAdapterBase* adapter);
+
+ // upward calls
+ void handleEngineUpEvent();
+ void handleEngineDownEvent();
+ void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask =
+ LOC_POS_TECH_MASK_DEFAULT);
+ void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ void reportStatus(GpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, AGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ void saveSupportedMsgList(uint64_t supportedMsgList);
+ void reportGnssMeasurementData(GnssData &gnssMeasurementData);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging);
+ virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol);
+ virtual enum loc_api_adapter_err
+ getWwanZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient();
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+ virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+ inline virtual void setInSession(bool inSession) {}
+ inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
+ if (msgID > (sizeof(mSupportedMsg) << 3)) {
+ return false;
+ } else {
+ uint32_t messageChecker = 1 << msgID;
+ return (messageChecker & mSupportedMsg) == messageChecker;
+ }
+ }
+ void updateEvtMask();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+
+ virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check);
+
+ /*
+ Update gps reporting events
+ */
+ virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+ /*
+ Check if the modem support the service
+ */
+ virtual bool gnssConstellationConfig();
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/msm8996/core/LocDualContext.cpp b/msm8996/core/LocDualContext.cpp
new file mode 100644
index 0000000..578421c
--- /dev/null
+++ b/msm8996/core/LocDualContext.cpp
@@ -0,0 +1,147 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+ContextBase* LocDualContext::mInjectContext = NULL;
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
+
+pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
+
+const MsgTask* LocDualContext::getMsgTask(LocThread::tCreate tCreator,
+ const char* name, bool joinable)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name, joinable);
+ }
+ return mMsgTask;
+}
+
+inline
+const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) {
+ return getMsgTask((LocThread::tCreate)NULL, name, joinable);
+}
+
+ContextBase* LocDualContext::getLocFgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mFgContext->sendMsg(firstMsg);
+ }
+
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mBgContext->sendMsg(firstMsg);
+ }
+
+ return mBgContext;
+}
+
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Enter", __func__, __LINE__);
+ if(curContext == mInjectContext) {
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+ }
+ LOC_LOGD("%s:%d]: Exit", __func__, __LINE__);
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mLBSLibName)
+{
+}
+
+}
diff --git a/msm8996/core/LocDualContext.h b/msm8996/core/LocDualContext.h
new file mode 100644
index 0000000..ce77a1a
--- /dev/null
+++ b/msm8996/core/LocDualContext.h
@@ -0,0 +1,76 @@
+/* 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 __LOC_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+ static ContextBase* mInjectContext;
+ 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:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) {
+ return getLocFgContext(NULL, NULL, name, joinable);
+ }
+ static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) {
+ return getLocBgContext(NULL, NULL, name, joinable);
+ }
+
+ static void injectFeatureConfig(ContextBase *context);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/msm8996/core/UlpProxyBase.h b/msm8996/core/UlpProxyBase.h
new file mode 100644
index 0000000..7e3c4be
--- /dev/null
+++ b/msm8996/core/UlpProxyBase.h
@@ -0,0 +1,75 @@
+/* Copyright (c) 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 ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ LocPosMode mPosMode;
+ bool mFixSet;
+ inline UlpProxyBase() {
+ mPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mFixSet = false;
+ }
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { mFixSet = true; return false; }
+ inline virtual bool sendStopFix() { mFixSet = false; return false; }
+ inline virtual bool sendFixMode(LocPosMode ¶ms) {
+ mPosMode = params;
+ return false;
+ }
+
+ inline virtual bool reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ return false;
+ }
+ inline virtual bool reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt) {
+ return false;
+ }
+ inline virtual bool reportStatus(GpsStatusValue status) {
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* adapter) {}
+ inline virtual void setCapabilities(unsigned long capabilities) {}
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/msm8996/core/gps_extended.h b/msm8996/core/gps_extended.h
new file mode 100644
index 0000000..88b0415
--- /dev/null
+++ b/msm8996/core/gps_extended.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GPS_EXTENDED_H
+#define GPS_EXTENDED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <gps_extended_c.h>
+
+struct LocPosMode
+{
+ LocPositionMode mode;
+ GpsPositionRecurrence recurrence;
+ uint32_t min_interval;
+ uint32_t preferred_accuracy;
+ uint32_t preferred_time;
+ char credentials[14];
+ char provider[8];
+ LocPosMode(LocPositionMode m, GpsPositionRecurrence recr,
+ uint32_t gap, uint32_t accu, uint32_t time,
+ const char* cred, const char* prov) :
+ mode(m), recurrence(recr),
+ min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap),
+ preferred_accuracy(accu), preferred_time(time) {
+ 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(GPS_POSITION_RECURRENCE_PERIODIC),
+ min_interval(MIN_POSSIBLE_FIX_INTERVAL),
+ preferred_accuracy(50), preferred_time(120000) {
+ 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 &&
+ !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/msm8996/core/gps_extended_c.h b/msm8996/core/gps_extended_c.h
new file mode 100644
index 0000000..f6513cc
--- /dev/null
+++ b/msm8996/core/gps_extended_c.h
@@ -0,0 +1,395 @@
+/* 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 GPS_EXTENDED_C_H
+#define GPS_EXTENDED_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <hardware/gps.h>
+
+/** Location has valid source information. */
+#define LOCATION_HAS_SOURCE_INFO 0x0020
+/** GpsLocation has valid "is indoor?" flag */
+#define GPS_LOCATION_HAS_IS_INDOOR 0x0040
+/** GpsLocation has valid floor number */
+#define GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080
+/** GpsLocation has valid map URL*/
+#define GPS_LOCATION_HAS_MAP_URL 0x0100
+/** GpsLocation has valid map index */
+#define GPS_LOCATION_HAS_MAP_INDEX 0x0200
+
+/** 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 source is ZPP only */
+#define ULP_LOCATION_IS_FROM_ZPP 0x0004
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+/** Position is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+/** Position is from NLP */
+#define ULP_LOCATION_IS_FROM_NLP 0x0020
+/** Position is from PIP */
+#define ULP_LOCATION_IS_FROM_PIP 0x0040
+
+#define ULP_MIN_INTERVAL_INVALID 0xffffffff
+
+/*Emergency SUPL*/
+#define GPS_NI_TYPE_EMERGENCY_SUPL 4
+
+#define AGPS_CERTIFICATE_MAX_LENGTH 2000
+#define AGPS_CERTIFICATE_MAX_SLOTS 10
+
+enum loc_registration_mask_status {
+ LOC_REGISTRATION_MASK_ENABLED,
+ LOC_REGISTRATION_MASK_DISABLED
+};
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ GpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+/** AGPS type */
+typedef int16_t AGpsExtType;
+#define AGPS_TYPE_INVALID -1
+#define AGPS_TYPE_ANY 0
+#define AGPS_TYPE_SUPL 1
+#define AGPS_TYPE_C2K 2
+#define AGPS_TYPE_WWAN_ANY 3
+#define AGPS_TYPE_WIFI 4
+#define AGPS_TYPE_SUPL_ES 5
+
+/** SSID length */
+#define SSID_BUF_SIZE (32+1)
+
+typedef int16_t AGpsBearerType;
+#define AGPS_APN_BEARER_INVALID -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(GpsCallbacks) */
+ size_t size;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ 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 {
+ gps_xtra_download_request download_request_cb;
+ 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) */
+ size_t size;
+
+ AGpsExtType type;
+ AGpsStatusValue 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;
+ gps_create_thread create_thread_cb;
+} AGpsExtCallbacks;
+
+
+/** GPS NI callback structure. */
+typedef struct
+{
+ /**
+ * Sends the notification request from HAL to GPSLocationProvider.
+ */
+ gps_ni_notify_callback notify_cb;
+ gps_create_thread create_thread_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
+} 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;
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+
+/** Flags to indicate which values are valid in a GpsLocationExtended. */
+typedef uint16_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
+
+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;
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+} GpsLocationExtended;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+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)
+
+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_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_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_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)
+
+typedef unsigned int 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_MAX
+} LocCheckingMessagesID;
+
+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)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
diff --git a/msm8996/core/loc_core_log.cpp b/msm8996/core/loc_core_log.cpp
new file mode 100644
index 0000000..3ca6c0a
--- /dev/null
+++ b/msm8996/core/loc_core_log.cpp
@@ -0,0 +1,243 @@
+/* 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 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_core_log.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static const loc_name_val_s_type gps_status_name[] =
+{
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
+};
+static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(GpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
+};
+static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( GPS_DELETE_ALMANAC ),
+ NAME_VAL( GPS_DELETE_POSITION ),
+ NAME_VAL( GPS_DELETE_TIME ),
+ NAME_VAL( GPS_DELETE_IONO ),
+ NAME_VAL( GPS_DELETE_UTC ),
+ NAME_VAL( GPS_DELETE_HEALTH ),
+ NAME_VAL( GPS_DELETE_SVDIR ),
+ NAME_VAL( GPS_DELETE_SVSTEER ),
+ NAME_VAL( GPS_DELETE_SADATA ),
+ NAME_VAL( GPS_DELETE_RTI ),
+ NAME_VAL( GPS_DELETE_CELLDB_INFO ),
+ NAME_VAL( GPS_DELETE_ALL)
+};
+static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(GpsAidingData data)
+{
+ return NULL;
+}
+
+
+static const loc_name_val_s_type loc_eng_agps_types[] =
+{
+ NAME_VAL( AGPS_TYPE_INVALID ),
+ NAME_VAL( AGPS_TYPE_ANY ),
+ NAME_VAL( AGPS_TYPE_SUPL ),
+ NAME_VAL( AGPS_TYPE_C2K ),
+ NAME_VAL( AGPS_TYPE_WWAN_ANY )
+};
+static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(AGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type loc_eng_ni_types[] =
+{
+ NAME_VAL( GPS_NI_TYPE_VOICE ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
+ NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ),
+ NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL )
+};
+static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(GpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type loc_eng_ni_responses[] =
+{
+ NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY ),
+ NAME_VAL( GPS_NI_RESPONSE_DENY )
+};
+static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(GpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static const loc_name_val_s_type loc_eng_ni_encodings[] =
+{
+ NAME_VAL( GPS_ENC_NONE ),
+ NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
+ NAME_VAL( GPS_ENC_SUPL_UTF8 ),
+ NAME_VAL( GPS_ENC_SUPL_UCS2 ),
+ NAME_VAL( GPS_ENC_UNKNOWN )
+};
+static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static const loc_name_val_s_type loc_eng_agps_status_names[] =
+{
+ NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
+ NAME_VAL( GPS_AGPS_DATA_CONNECTED ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
+ NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
+};
+static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(AGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/msm8996/core/loc_core_log.h b/msm8996/core/loc_core_log.h
new file mode 100644
index 0000000..8a1825a
--- /dev/null
+++ b/msm8996/core/loc_core_log.h
@@ -0,0 +1,58 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_CORE_LOG_H
+#define LOC_CORE_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <gps_extended.h>
+
+const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+const char* loc_get_position_mode_name(GpsPositionMode mode);
+const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur);
+const char* loc_get_aiding_data_mask_names(GpsAidingData data);
+const char* loc_get_agps_type_name(AGpsType type);
+const char* loc_get_ni_type_name(GpsNiType type);
+const char* loc_get_ni_response_name(GpsUserResponseType response);
+const char* loc_get_ni_encoding_name(GpsNiEncodingType 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(AGpsStatusValue status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CORE_LOG_H */
diff --git a/msm8996/etc/Android.mk b/msm8996/etc/Android.mk
new file mode 100644
index 0000000..d439494
--- /dev/null
+++ b/msm8996/etc/Android.mk
@@ -0,0 +1,12 @@
+ifneq ($(BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET),true)
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/
+LOCAL_SRC_FILES := gps.conf
+
+include $(BUILD_PREBUILT)
+endif
diff --git a/msm8996/etc/gps.conf b/msm8996/etc/gps.conf
new file mode 100644
index 0000000..b52ea11
--- /dev/null
+++ b/msm8996/etc/gps.conf
@@ -0,0 +1,111 @@
+#Uncommenting these urls would only enable
+#the power up auto injection and force injection(test case).
+#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
+#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
+#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
+
+#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
+
+# 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 = 2
+
+# Intermediate position report, 1=enable, 0=disable
+INTERMEDIATE_POS=0
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# Emergency SUPL, 1=enable, 0=disable
+SUPL_ES=0
+
+#Choose PDN for Emergency SUPL
+#1 - Use emergency PDN
+#0 - Use regular SUPL PDN for Emergency SUPL
+USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=1
+
+#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
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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 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
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=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
diff --git a/msm8996/loc-api.pc.in b/msm8996/loc-api.pc.in
new file mode 100644
index 0000000..3b4f81b
--- /dev/null
+++ b/msm8996/loc-api.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-api
+Description: Qualcomm GPS Location API
+Version: @VERSION@
+Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_eng_so -lgps_default_so -lloc_api
+Cflags: -I${includedir}/loc-api/libloc_api_50001 -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api
diff --git a/msm8996/loc_api/Android.mk b/msm8996/loc_api/Android.mk
new file mode 100644
index 0000000..743b386
--- /dev/null
+++ b/msm8996/loc_api/Android.mk
@@ -0,0 +1,17 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+
+LOCAL_PATH := $(call my-dir)
+
+# add RPC dirs if RPC is available
+ifneq ($(TARGET_NO_RPC),true)
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/
+
+endif #TARGET_NO_RPC
+
+GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/
+
+#call the subfolders
+include $(addsuffix Android.mk, $(GPS_DIR_LIST))
+
+endif#BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/Android.mk b/msm8996/loc_api/libloc_api-rpc-50001/Android.mk
new file mode 100644
index 0000000..6c5d533
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/Android.mk
@@ -0,0 +1,3 @@
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001)
+include $(call all-subdir-makefiles)
+endif
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
new file mode 100644
index 0000000..70d3e85
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk
@@ -0,0 +1,59 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+RPC_INC:=rpc_inc
+
+source_files:= \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpc.cpp
+
+LOCAL_SRC_FILES:= $(source_files)
+
+LOCAL_CFLAGS:=-fno-short-enums
+LOCAL_CFLAGS+=-DDEBUG -DUSE_QCOM_AUTO_RPC -DUSE_QCOM_AUTO_RPC
+LOCAL_CFLAGS+=$(GPS_FEATURES)
+
+# for loc_api_fixup.c
+LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL
+
+LOCAL_SHARED_LIBRARIES:= \
+ librpc \
+ libutils \
+ libcutils \
+ libcommondefs \
+ libgps.utils \
+ libloc_core
+
+LOCAL_STATIC_LIBRARIES := \
+ libloc_api_rpcgen
+
+LOCAL_PRELINK_MODULE:= false
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH) \
+ $(LOCAL_PATH)/rpc_inc \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/loc_api/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc \
+ $(TARGET_OUT_HEADERS)/librpc \
+ $(TARGET_OUT_HEADERS)/libloc-rpc/rpc_inc \
+ $(TOP)/hardware/msm7k/librpc
+
+
+LOCAL_MODULE:= libloc_api-rpc-qc
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_api-rpc-qc_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH/$(RPC_INC))
+include $(BUILD_HEADER_LIBRARY)
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
new file mode 100644
index 0000000..f5c5136
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am
@@ -0,0 +1,46 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I../../../platform_lib_abstractions \
+ -I./rpc_inc \
+ -I../libloc_api-rpc-stub/inc \
+ -I../../libloc_api_50001 \
+ $(MSM7K_CFLAGS) \
+ -DUSE_QCOM_AUTO_RPC
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ rpc_inc/loc_api_rpc_glue.h \
+ rpc_inc/loc_api_fixup.h \
+ rpc_inc/loc_api_sync_call.h \
+ rpc_inc/loc_apicb_appinit.h \
+
+c_sources = \
+ src/loc_api_rpc_glue.c \
+ src/loc_api_sync_call.c \
+ src/loc_apicb_appinit.c \
+ src/loc_api_fixup.c \
+ src/loc_api_log.c \
+ src/LocApiRpcAdapter.cpp \
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpc_qc_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpc_qc_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpc_qc_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpc_qc_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpc_qc_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpc_qc_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpc_qc_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpc_qc.la
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
new file mode 100644
index 0000000..01d67f4
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h
@@ -0,0 +1,140 @@
+/* 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 LOC_API_RPC_H
+#define LOC_API_RPC_H
+
+#include <rpc/rpc.h>
+#include <loc_api_rpcgen_common_rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <LocApiBase.h>
+#include <loc_log.h>
+
+using namespace loc_core;
+
+class LocApiRpc : public LocApiBase {
+protected:
+ // RPC communication establishment
+ rpc_loc_client_handle_type client_handle;
+
+private:
+ int dataEnableLastSet;
+ char apnLastSet[MAX_APN_LEN];
+
+ static const LOC_API_ADAPTER_EVENT_MASK_T maskAll;
+ static const rpc_loc_event_mask_type locBits[];
+ static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ static rpc_loc_lock_e_type convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask);
+ static enum loc_api_adapter_err convertErr(int rpcErr);
+ static GpsNiEncodingType convertNiEncodingType(int loc_encoding);
+ static int NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv);
+
+ void reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr);
+ void reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+ void reportStatus(const rpc_loc_status_event_s_type *status_report_ptr);
+ void reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+ void ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr);
+ void NIEvent(const rpc_loc_ni_event_s_type *ni_req_ptr);
+
+protected:
+ virtual enum loc_api_adapter_err
+ open(LOC_API_ADAPTER_EVENT_MASK_T mask);
+ virtual enum loc_api_adapter_err
+ close();
+
+public:
+ LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ ~LocApiRpc();
+
+ virtual int locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+
+ void locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event);
+
+ // RPC adapter interface implementations
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& mode);
+ inline virtual enum loc_api_adapter_err
+ enableData(int enable) { return enableData(enable, false); }
+ virtual enum loc_api_adapter_err
+ enableData(int enable, boolean force);
+ virtual enum loc_api_adapter_err
+ setTime(GpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f);
+ virtual enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData);
+ inline virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len) { return setAPN(apn, len, false); }
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len, boolean force);
+ virtual enum loc_api_adapter_err
+ setServer(const char* url, int len);
+ virtual enum loc_api_adapter_err
+ setServer(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 enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version);
+ virtual void setInSession(bool inSession);
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ virtual int setGpsLock(LOC_GPS_LOCK_MASK lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+};
+
+extern "C" LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+#endif //LOC_API_RPC_H
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
new file mode 100644
index 0000000..49a6d0b
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h
@@ -0,0 +1,69 @@
+/* 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 DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "LocSvc_rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ ALOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ ALOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ ALOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
new file mode 100644
index 0000000..c483b4a
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h
@@ -0,0 +1,226 @@
+/* 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 LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RPC failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+// Special return value for modem restart incurred RPC failure
+#define RPC_LOC_API_RPC_MODEM_RESTART (-1235)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE 0x00000200
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* EFS data access */
+#define RPC_LOC_EFS_MAX_PATH_LEN_BYTES 64 /* Max file name length in bytes that can be written*/
+#define RPC_LOC_EFS_MAX_FILE_LEN_BYTES 2000 /* Max file size in bytes that can be written */
+
+/* WIPER valid information flag in log report */
+#define RPC_LOC_WIPER_LOG_TIME_VALID 0x01
+#define RPC_LOC_WIPER_LOG_POS_VALID 0x02
+#define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04
+
+/* General WIPER defines */
+#define RPC_LOC_WIPER_MAC_ADDR_LENGTH 6 // Do not change this number since it affects RPC and log packet sizes
+#define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes
+
+/* WIPER AP Qualifier */
+#define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1 /* AP is being used by WPS */
+#define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */
+#define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4 /* AP has encryption turned on */
+#define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8 /* AP is in infrastructure mode and not in ad-hoc/unknown mode */
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+/* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */
+/* values for apn_profiles[0].srv_system_type */
+#define LOC_APN_PROFILE_SRV_SYS_CDMA 0x01
+#define LOC_APN_PROFILE_SRV_SYS_HDR 0x02
+#define LOC_APN_PROFILE_SRV_SYS_GSM 0x04
+#define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08
+#define LOC_APN_PROFILE_SRV_SYS_LTE 0x10
+#define LOC_APN_PROFILE_SRV_SYS_MAX 0x1F
+/* values for apn_profiles[0].pdp_type */
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4 0x01
+#define LOC_APN_PROFILE_PDN_TYPE_IPV6 0x02
+#define LOC_APN_PROFILE_PDN_TYPE_IPV4V6 0x03
+#define LOC_APN_PROFILE_PDN_TYPE_PPP 0x04
+#define LOC_APN_PROFILE_PDN_TYPE_MAX 0x04
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
new file mode 100644
index 0000000..f037428
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h
@@ -0,0 +1,59 @@
+/* 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 LOC_API_LOG_H
+#define LOC_API_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include "loc_api_rpcgen_common_rpc.h"
+
+extern int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open);
+extern const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask);
+extern const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type);
+extern const char* loc_get_ioctl_status_name(uint32 status);
+extern const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status);
+extern const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state);
+extern const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state);
+extern const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_LOG_H */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
new file mode 100644
index 0000000..6df33ae
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h
@@ -0,0 +1,123 @@
+/* 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 LOC_API_RPC_GLUE_H
+#define LOC_API_RPC_GLUE_H
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+/* Boolean */
+/* Other data types in comdef.h are defined in rpc stubs, so fix it here */
+typedef unsigned char boolean;
+#define TRUE 1
+#define FALSE 0
+
+#include "loc_api_fixup.h"
+#include "loc_api_sync_call.h"
+#include <rpc/clnt.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern int loc_api_glue_init(void);
+extern int loc_api_null(void);
+
+typedef int32 (loc_event_cb_f_type)(
+ void* userData,
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+typedef void (loc_reset_notif_cb_f_type)(
+ void* userData,
+ CLIENT* clnt,
+ enum rpc_reset_event event
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_global_cb,
+ void* userData
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern void loc_clear
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+extern int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
new file mode 100644
index 0000000..43208bd
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h
@@ -0,0 +1,90 @@
+/* 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 LOC_API_CB_SYNC_H
+#define LOC_API_CB_SYNC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include "loc_api_rpc_glue.h"
+#define LOC_SYNC_CALL_SLOTS_MAX 8
+
+typedef struct {
+ pthread_mutex_t lock;
+
+ /* Client ID */
+ rpc_loc_client_handle_type loc_handle;
+
+ /* Callback waiting conditional variable */
+ pthread_cond_t loc_cb_arrived_cond;
+
+ /* Callback waiting data block, protected by loc_cb_data_mutex */
+ boolean in_use;
+ boolean signal_sent;
+ boolean not_available;
+ rpc_loc_event_mask_type loc_cb_wait_event_mask; /* event to wait for */
+ rpc_loc_ioctl_e_type ioctl_type; /* ioctl to wait for */
+ rpc_loc_event_payload_u_type loc_cb_received_payload; /* received payload */
+ rpc_loc_event_mask_type loc_cb_received_event_mask; /* received event */
+} loc_sync_call_slot_s_type;
+
+typedef struct {
+ int num_of_slots;
+ loc_sync_call_slot_s_type slots[LOC_SYNC_CALL_SLOTS_MAX];
+} loc_sync_call_slot_array_s_type;
+
+/* Init function */
+void loc_api_sync_call_init();
+
+/* Destroy function */
+void loc_api_sync_call_destroy();
+
+/* Process Loc API callbacks to wake up blocked user threads */
+void loc_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+/* Reentrant synchronous IOCTL call, using Loc API return code */
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..ba41d08
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h
@@ -0,0 +1,45 @@
+/* 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 LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
new file mode 100644
index 0000000..b946aec
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp
@@ -0,0 +1,1465 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc"
+
+#include <unistd.h>
+#include <math.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#endif /* USE_GLIB */
+#include <LocApiRpc.h>
+#include <LocAdapterBase.h>
+#include <loc_api_fixup.h>
+#include <loc_api_rpc_glue.h>
+#include <log_util.h>
+#include <loc_log.h>
+#include <loc_api_log.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include <librpc.h>
+#include <platform_lib_includes.h>
+
+using namespace loc_core;
+
+#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
+#define XTRA_BLOCK_SIZE (3072)
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
+/*===========================================================================
+FUNCTION loc_event_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int32 loc_event_cb
+(
+ void* user,
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event));
+ loc_callback_log(loc_event, loc_event_payload);
+ int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_rpc_global_cb
+
+DESCRIPTION
+ This is the callback function registered by loc_open for RPC global events
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event)
+{
+ MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event));
+ ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event);
+ EXIT_LOG(%p, VOID_RET);
+}
+
+const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll =
+ LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+const rpc_loc_event_mask_type LocApiRpc::locBits[] =
+{
+ RPC_LOC_EVENT_PARSED_POSITION_REPORT,
+ RPC_LOC_EVENT_SATELLITE_REPORT,
+ RPC_LOC_EVENT_NMEA_1HZ_REPORT,
+ RPC_LOC_EVENT_NMEA_POSITION_REPORT,
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST,
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST,
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST,
+ RPC_LOC_EVENT_IOCTL_REPORT,
+ RPC_LOC_EVENT_STATUS_REPORT,
+ RPC_LOC_EVENT_WPS_NEEDED_REQUEST
+};
+
+// constructor
+LocApiRpc::LocApiRpc(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) :
+ LocApiBase(msgTask, exMask, context),
+ client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
+ dataEnableLastSet(-1)
+{
+ memset(apnLastSet, 0, sizeof(apnLastSet));
+ loc_api_glue_init();
+}
+
+LocApiRpc::~LocApiRpc()
+{
+ close();
+}
+
+rpc_loc_event_mask_type
+LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ rpc_loc_event_mask_type newMask = 0;
+
+ for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) {
+ if (mask & bit) {
+ newMask |= locBits[i];
+ mask ^= bit;
+ }
+ }
+
+ return newMask;
+}
+
+rpc_loc_lock_e_type
+LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask)
+{
+ if (isGpsLockAll(lockMask))
+ return RPC_LOC_LOCK_ALL;
+ if (isGpsLockMO(lockMask))
+ return RPC_LOC_LOCK_MI;
+ if (isGpsLockMT(lockMask))
+ return RPC_LOC_LOCK_MT;
+ if (isGpsLockNone(lockMask))
+ return RPC_LOC_LOCK_NONE;
+ return (rpc_loc_lock_e_type)lockMask;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::convertErr(int rpcErr)
+{
+ switch(rpcErr)
+ {
+ case RPC_LOC_API_SUCCESS:
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+ case RPC_LOC_API_GENERAL_FAILURE:
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ case RPC_LOC_API_UNSUPPORTED:
+ return LOC_API_ADAPTER_ERR_UNSUPPORTED;
+ case RPC_LOC_API_INVALID_HANDLE:
+ return LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ case RPC_LOC_API_INVALID_PARAMETER:
+ return LOC_API_ADAPTER_ERR_INVALID_PARAMETER;
+ case RPC_LOC_API_ENGINE_BUSY:
+ return LOC_API_ADAPTER_ERR_ENGINE_BUSY;
+ case RPC_LOC_API_PHONE_OFFLINE:
+ return LOC_API_ADAPTER_ERR_PHONE_OFFLINE;
+ case RPC_LOC_API_TIMEOUT:
+ return LOC_API_ADAPTER_ERR_TIMEOUT;
+ case RPC_LOC_API_RPC_MODEM_RESTART:
+ return LOC_API_ADAPTER_ERR_ENGINE_DOWN;
+ case RPC_LOC_API_RPC_FAILURE:
+ return LOC_API_ADAPTER_ERR_FAILURE;
+ default:
+ return LOC_API_ADAPTER_ERR_UNKNOWN;
+ }
+}
+
+void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event)
+{
+ static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX;
+
+ switch (event) {
+ case RPC_SUBSYSTEM_RESTART_BEGIN:
+ if (RPC_LOC_ENGINE_STATE_OFF != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_OFF;
+ handleEngineDownEvent();
+ }
+ break;
+ case RPC_SUBSYSTEM_RESTART_END:
+ if (RPC_LOC_ENGINE_STATE_ON != last_state) {
+ last_state = RPC_LOC_ENGINE_STATE_ON;
+ handleEngineUpEvent();
+ }
+ break;
+ }
+}
+
+int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ // Parsed report
+ if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
+ {
+ reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ parsed_location_report);
+ }
+
+ // Satellite report
+ if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
+ {
+ reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report);
+ }
+
+ // Status report
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report);
+ }
+
+ // NMEA
+ if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
+ {
+ reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
+ }
+ // XTRA support: supports only XTRA download
+ if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST)
+ {
+ if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ)
+ {
+ requestXtraData();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_TIME_REQ)
+ {
+ requestTime();
+ } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ)
+ {
+ requestLocation();
+ }
+ }
+
+ // AGPS data request
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ loc_server_request);
+ }
+
+ // NI notify request
+ if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request);
+ }
+
+ return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to
+ // cause any issues in RPC thread context
+}
+
+enum loc_api_adapter_err
+LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask)
+{
+ enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ // RPC does not dynamically update the event mask. And in the
+ // case of RPC, all we support are positioning (gps + agps)
+ // masks anyways, so we simply mask all of them on always.
+ // After doing so the first time in a power cycle, we know there
+ // will the following if condition will never be true any more.
+ mask = maskAll;
+
+ if (mask != mMask) {
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ close();
+ }
+
+ mMask = mask;
+ // it is important to cap the mask here, because not all LocApi's
+ // can enable the same bits, e.g. foreground and bckground.
+ client_handle = loc_open(convertMask(mask),
+ loc_event_cb,
+ loc_rpc_global_cb, this);
+
+ if (client_handle < 0) {
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+ ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE;
+ }
+ }
+
+ return ret_val;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::close()
+{
+ if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) {
+ loc_clear(client_handle);
+ }
+
+ loc_close(client_handle);
+ mMask = 0;
+ client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::startFix(const LocPosMode& posMode) {
+ LOC_LOGD("LocApiRpc::startFix() called");
+ return convertErr(
+ loc_start_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::stopFix() {
+ LOC_LOGD("LocApiRpc::stopFix() called");
+ return convertErr(
+ loc_stop_fix(client_handle)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setPositionMode(const LocPosMode& posMode)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ rpc_loc_operation_mode_e_type op_mode;
+ int ret_val;
+ const LocPosMode* fixCriteria = &posMode;
+
+ ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode);
+
+ switch (fixCriteria->mode)
+ {
+ case LOC_POSITION_MODE_MS_BASED:
+ op_mode = RPC_LOC_OPER_MODE_MSB;
+ break;
+ case LOC_POSITION_MODE_MS_ASSISTED:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ break;
+ case LOC_POSITION_MODE_RESERVED_1:
+ op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_2:
+ op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_3:
+ op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL;
+ break;
+ case LOC_POSITION_MODE_RESERVED_4:
+ case LOC_POSITION_MODE_RESERVED_5:
+ op_mode = RPC_LOC_OPER_MODE_MSA;
+ fix_criteria_ptr->preferred_response_time = 0;
+ break;
+ default:
+ op_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ }
+
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->preferred_operation_mode = op_mode;
+
+ fix_criteria_ptr->min_interval = fixCriteria->min_interval;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+
+ if (fixCriteria->preferred_accuracy > 0) {
+ fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+ }
+ if (fixCriteria->preferred_time > 0) {
+ fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
+ }
+
+ switch (fixCriteria->recurrence) {
+ case GPS_POSITION_RECURRENCE_SINGLE:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
+ break;
+ case GPS_POSITION_RECURRENCE_PERIODIC:
+ default:
+ fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
+ break;
+ }
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_time_s_type *time_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+ int ret_val;
+
+ LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+
+ time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time;
+ time_info_ptr->time_utc = time;
+ time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+
+ ioctl_data.disc = ioctl_type;
+
+ ret_val = loc_eng_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::injectPosition(double latitude, double longitude, float accuracy)
+{
+ /* IOCTL data */
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_pos_s_type *assistance_data_position =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position;
+ int ret_val;
+
+ /************************************************
+ * Fill in latitude, longitude & accuracy
+ ************************************************/
+
+ /* This combo is required */
+ assistance_data_position->valid_mask =
+ RPC_LOC_ASSIST_POS_VALID_LATITUDE |
+ RPC_LOC_ASSIST_POS_VALID_LONGITUDE |
+ RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR |
+ RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL;
+
+ assistance_data_position->latitude = latitude;
+ assistance_data_position->longitude = longitude;
+ assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */
+ assistance_data_position->confidence_horizontal = 63; /* 63% (1 std dev) assumed */
+
+ /* Log */
+ LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n",
+ (double) assistance_data_position->latitude,
+ (double) assistance_data_position->longitude,
+ (double) assistance_data_position->hor_unc_circular);
+
+ ret_val = loc_eng_ioctl( client_handle,
+ RPC_LOC_IOCTL_INJECT_POSITION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+ return convertErr(ret_val);
+}
+
+enum loc_api_adapter_err
+LocApiRpc::informNiResponse(GpsUserResponseType userResponse,
+ const void* passThroughData)
+{
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+
+ memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back,
+ passThroughData, sizeof (rpc_loc_ni_event_s_type));
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ default:
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp =
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ }
+
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setAPN(char* apn, int len, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ int size = sizeof(apnLastSet);
+ if (force || memcmp(apnLastSet, apn, size)) {
+ if (len < size) {
+ // size will be not larger than its original value
+ size = len + 1;
+ }
+ memcpy(apnLastSet, apn, size);
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX;
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4;
+ memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size);
+
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+void LocApiRpc::setInSession(bool inSession)
+{
+ if (!inSession) {
+ enableData(dataEnableLastSet, true);
+ setAPN(apnLastSet, sizeof(apnLastSet)-1, true);
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(const char* url, int len)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len;
+#if (AMSS_VERSION==3200)
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len;
+#else
+ strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url,
+ sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", url);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setServer(unsigned int ip, int port, LocServerType type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ rpc_loc_ioctl_e_type ioctl_cmd;
+
+ switch (type) {
+ case LOC_AGPS_MPC_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR;
+ break;
+ case LOC_AGPS_CUSTOM_PDE_SERVER:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR;
+ break;
+ default:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
+ break;
+ }
+ ioctl_data.disc = ioctl_cmd;
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4;
+ server_info_ptr->addr_info.disc = server_info_ptr->addr_type;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
+ LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port);
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::enableData(int enable, boolean force)
+{
+ enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS;
+ if (force || dataEnableLastSet != enable) {
+ dataEnableLastSet = enable;
+
+ if (!isInSession()) {
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}};
+
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable;
+ rtv = convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+ }
+ }
+ return rtv;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::deleteAidingData(GpsAidingData bits)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits;
+
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr)
+{
+ LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT;
+
+ UlpLocation location = {0};
+ GpsLocationExtended locationExtended = {0};
+
+ location.size = sizeof(location);
+ locationExtended.size = sizeof(locationExtended);
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
+ {
+ // Process the position from final and intermediate reports
+ if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS ||
+ location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS)
+ {
+ // Latitude & Longitude
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) &&
+ (location_report_ptr->latitude != 0 ||
+ location_report_ptr->longitude != 0))
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.gpsLocation.latitude = location_report_ptr->latitude;
+ location.gpsLocation.longitude = location_report_ptr->longitude;
+
+ // Time stamp (UTC)
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.gpsLocation.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ // Altitude
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ // Speed
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED;
+ location.gpsLocation.speed = location_report_ptr->speed_horizontal;
+ }
+
+ // Heading
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_BEARING;
+ location.gpsLocation.bearing = location_report_ptr->heading;
+ }
+
+ // Uncertainty (circular)
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
+ {
+ location.gpsLocation.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ // Technology Mask
+
+ tech_Mask |= location_report_ptr->technology_mask;
+ //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->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL;
+ locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION )
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV;
+ locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC;
+ locationExtended.vert_unc = location_report_ptr->vert_unc;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC)
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC;
+ locationExtended.speed_unc = location_report_ptr->speed_unc;
+ }
+
+ LOC_LOGV("reportPosition: fire callback\n");
+ enum loc_sess_status fixStatus =
+ (location_report_ptr->session_status
+ == RPC_LOC_SESS_STATUS_IN_PROGESS ?
+ LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS);
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ (void*)location_report_ptr,
+ fixStatus,
+ tech_Mask);
+ }
+ }
+ else
+ {
+ LocApiBase::reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_FAILURE);
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status = %d\n",
+ location_report_ptr->session_status);
+ }
+ }
+ else
+ {
+ LOC_LOGV("loc_eng_report_position: ignore position report "
+ "when session status is not set\n");
+ }
+}
+
+void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr)
+{
+ QtiGnssSvStatus SvStatus = {0};
+ GpsLocationExtended locationExtended = {0};
+ locationExtended.size = sizeof(locationExtended);
+ int num_svs_max = 0;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ num_svs_max = gnss_report_ptr->sv_count;
+ if (num_svs_max > GPS_MAX_SVS)
+ {
+ num_svs_max = GPS_MAX_SVS;
+ }
+ }
+
+ if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ SvStatus.num_svs = 0;
+
+ for (int i = 0; i < num_svs_max; i++)
+ {
+ sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
+ {
+ if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+ }
+ // SBAS: GPS RPN: 120-151,
+ // In exteneded measurement report, we follow nmea standard, which is from 33-64.
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
+ }
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
+ {
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
+ }
+ // Unsupported SV system
+ else
+ {
+ continue;
+ }
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ }
+
+ SvStatus.num_svs++;
+ }
+ }
+
+ if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) &&
+ (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP))
+ {
+ locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP;
+ locationExtended.pdop = gnss_report_ptr->position_dop;
+ locationExtended.hdop = gnss_report_ptr->horizontal_dop;
+ locationExtended.vdop = gnss_report_ptr->vertical_dop;
+ }
+
+ if (SvStatus.num_svs >= 0)
+ {
+ LocApiBase::reportSv(SvStatus,
+ locationExtended,
+ (void*)gnss_report_ptr);
+ }
+}
+
+void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr)
+{
+
+ if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) {
+ if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON);
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN);
+ }
+ else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ LocApiBase::reportStatus(GPS_STATUS_SESSION_END);
+ LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF);
+ }
+ else
+ {
+ LocApiBase::reportStatus(GPS_STATUS_NONE);
+ }
+ }
+
+}
+
+void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+{
+
+#if (AMSS_VERSION==3200)
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#else
+ LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences,
+ nmea_report_ptr->length);
+ LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n",
+ nmea_report_ptr->nmea_sentences[3],
+ nmea_report_ptr->nmea_sentences[4],
+ nmea_report_ptr->nmea_sentences[5]);
+#endif /* #if (AMSS_VERSION==3200) */
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setXtraData(char* data, int length)
+{
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ int total_parts;
+ uint8 part;
+ uint16 part_len;
+ uint16 len_injected;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA;
+ rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data);
+
+ predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data;
+ predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA;
+ predicted_orbits_data_ptr->total_size = length;
+ total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1;
+ predicted_orbits_data_ptr->total_parts = total_parts;
+
+ len_injected = 0; // O bytes injected
+ ioctl_data.disc = ioctl_type;
+
+ // XTRA injection starts with part 1
+ for (part = 1; part <= total_parts; part++)
+ {
+ predicted_orbits_data_ptr->part = part;
+ predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE;
+ if (XTRA_BLOCK_SIZE > (length - len_injected))
+ {
+ predicted_orbits_data_ptr->part_len = length - len_injected;
+ }
+ predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len;
+ predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected;
+
+ LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n",
+ predicted_orbits_data_ptr->part,
+ total_parts,
+ predicted_orbits_data_ptr->part_len,
+ len_injected);
+
+ if (part < total_parts)
+ {
+ // No callback in this case
+ rpc_ret_val = loc_ioctl (client_handle,
+ ioctl_type,
+ &ioctl_data);
+
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
+ break;
+ }
+ //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor
+ usleep(10 * 1000);
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ if (!loc_eng_ioctl(client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
+ NULL))
+ {
+ rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ }
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
+ }
+
+ return convertErr(rpc_ret_val);
+}
+
+/* Request the Xtra Server Url from the modem */
+enum loc_api_adapter_err
+LocApiRpc::requestXtraServer()
+{
+ loc_api_adapter_err err;
+ rpc_loc_ioctl_data_u_type data;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ err = convertErr(loc_eng_ioctl(client_handle,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_data));
+
+ if (LOC_API_ADAPTER_ERR_SUCCESS != err)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err);
+ return err;
+ }
+ else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+ else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc)
+ {
+ LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc);
+ return LOC_API_ADAPTER_ERR_GENERAL_FAILURE;
+ }
+
+ reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[0],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[1],
+ callback_data.data.rpc_loc_ioctl_callback_data_u_type_u.
+ predicted_orbits_data_source.servers[2],
+ 255);
+
+ return LOC_API_ADAPTER_ERR_SUCCESS;
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+{
+ rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+
+ if (AGPS_TYPE_INVALID == agpsType) {
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr->conn_handle = handle;
+ conn_open_status_ptr->open_status = open_status;
+#if (AMSS_VERSION==3200)
+ conn_open_status_ptr->apn_name = apn; /* requires APN */
+#else
+ if (is_succ) {
+ strlcpy(conn_open_status_ptr->apn_name, apn,
+ sizeof conn_open_status_ptr->apn_name);
+ } else {
+ conn_open_status_ptr->apn_name[0] = 0;
+ }
+#endif /* #if (AMSS_VERSION==3200) */
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n",
+ log_succ_fail_string(is_succ),
+ apn);
+ } else {
+ rpc_loc_server_multi_open_status_s_type *conn_multi_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS;
+ conn_multi_open_status_ptr->conn_handle = handle;
+ conn_multi_open_status_ptr->open_status = open_status;
+ if (is_succ) {
+ strlcpy(conn_multi_open_status_ptr->apn_name, apn,
+ sizeof conn_multi_open_status_ptr->apn_name);
+ } else {
+ conn_multi_open_status_ptr->apn_name[0] = 0;
+ }
+
+ switch(bearer)
+ {
+ case AGPS_APN_BEARER_IPV4:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP;
+ break;
+ case AGPS_APN_BEARER_IPV6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6;
+ break;
+ case AGPS_APN_BEARER_IPV4V6:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6;
+ break;
+ default:
+ conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP;
+ }
+
+ LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n",
+ log_succ_fail_string(is_succ),
+ apn,
+ conn_multi_open_status_ptr->pdp_type);
+ }
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+enum loc_api_adapter_err
+LocApiRpc::atlCloseStatus(int handle, int is_succ)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
+ conn_close_status_ptr->conn_handle = handle;
+ conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;
+
+ // Make the IOCTL call
+ return convertErr(
+ loc_eng_ioctl(client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr)
+{
+ int connHandle;
+ AGpsType agps_type;
+
+ LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)",
+ loc_get_event_atl_open_name(server_request_ptr->event));
+ switch (server_request_ptr->event)
+ {
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle;
+ if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type
+ == RPC_LOC_SERVER_CONNECTION_LBS) {
+ agps_type = AGPS_TYPE_SUPL;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle);
+ } else {
+ agps_type = AGPS_TYPE_WWAN_ANY;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle);
+ }
+ requestATL(connHandle, agps_type);
+ break;
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle);
+ requestATL(connHandle, AGPS_TYPE_INVALID);
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle);
+ releaseATL(connHandle);
+ break;
+ default:
+ LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event);
+ }
+}
+
+void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req)
+{
+ GpsNiNotification notif = {0};
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ LOC_LOGI("VX Notification");
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ // Requestor ID
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ vx_req->requester_id.requester_id,
+ vx_req->requester_id.requester_id_length);
+ notif.text_encoding = 0; // No text and no encoding
+ notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme);
+ NIEventFillVerfiyType(notif, vx_req->notification_priv_type);
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ LOC_LOGI("UMTS CP Notification\n");
+ notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE; // Stores notification text
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text.notification_text_val,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+ umts_cp_req->requestor_id.string_len);
+#else
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text,
+ umts_cp_req->notification_length);
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string,
+ umts_cp_req->requestor_id.string_len);
+#endif
+ notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type);
+
+ // LCS address (using extras field)
+ if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0)
+ {
+ // 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;
+
+#if (AMSS_VERSION==3200)
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
+#else
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address;
+#endif /* #if (AMSS_VERSION==3200) */
+
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source,
+ umts_cp_req->ext_client_address_data.ext_client_address_len);
+
+ // The address is ASCII string
+ if (addr_len)
+ {
+ strlcat(notif.extras, lcs_addr, sizeof notif.extras);
+ }
+ }
+ }
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ {
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req =
+ &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ LOC_LOGI("SUPL Notification\n");
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#else
+ hexcode(notif.text, sizeof notif.text,
+ supl_req->client_name.client_name_string, /* buffer */
+ supl_req->client_name.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
+ {
+#if (AMSS_VERSION==3200)
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#else
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ supl_req->requestor_id.requestor_id_string, /* buffer */
+ supl_req->requestor_id.string_len /* length */
+ );
+#endif /* #if (AMSS_VERSION==3200) */
+ LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+ }
+ else {
+ LOC_LOGV("SUPL NI: requestor_id not present.");
+ }
+
+ // Encoding type
+ if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
+ {
+ notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = notif.text_encoding;
+ }
+ else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+ }
+ break;
+
+ default:
+ LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ return;
+ }
+
+ // this copy will get freed in loc_eng_ni when loc_ni_respond() is called
+ rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy));
+ memcpy(copy, ni_req, sizeof(*copy));
+ requestNiNotify(notif, (const void*)copy);
+}
+
+int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification ¬if,
+ rpc_loc_ni_notify_verify_e_type notif_priv)
+{
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif.notify_flags = 0;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_ACCEPT;
+ return 1;
+ case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP:
+ notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY;
+ notif.default_response = GPS_NI_RESPONSE_DENY;
+ return 1;
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ notif.default_response = GPS_NI_RESPONSE_NORESP;
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+enum loc_api_adapter_err
+LocApiRpc::setSUPLVersion(uint32_t version)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}};
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version;
+ return convertErr(
+ loc_eng_ioctl (client_handle,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL)
+ );
+}
+
+GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
+{
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ return GPS_ENC_SUPL_UTF8;
+ case RPC_LOC_NI_SUPL_UCS2:
+ return GPS_ENC_SUPL_UCS2;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ return GPS_ENC_SUPL_GSM_DEFAULT;
+ case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
+ return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ default:
+ return GPS_ENC_UNKNOWN;
+ }
+}
+
+LocApiBase* getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context) {
+ return new LocApiRpc(msgTask, exMask, context);
+}
+
+/*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+*/
+int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+ LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask);
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask);
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val);
+ return (ret_val == TRUE ? 0 : -1);
+}
+
+/*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+*/
+int LocApiRpc :: getGpsLock()
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_callback_s_type callback_payload;
+ boolean ret_val;
+ int ret=0;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload);
+ if(ret_val == TRUE) {
+ ret = (int)callback_payload.data.engine_lock;
+ LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret);
+ }
+ else {
+ LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__);
+ ret = -1;
+ }
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return ret;
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
new file mode 100644
index 0000000..837ef11
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
new file mode 100644
index 0000000..1c48232
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c
@@ -0,0 +1,345 @@
+/* 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_api_rpc_glue"
+
+#include "loc_api_log.h"
+#include "loc_log.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "rpc/rpc.h"
+#include "loc_api_fixup.h"
+
+/* Event names */
+loc_name_val_s_type loc_event_name[] =
+ {
+ NAME_VAL( RPC_LOC_EVENT_PARSED_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_SATELLITE_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_1HZ_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NMEA_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_LOCATION_SERVER_REQUEST ),
+ NAME_VAL( RPC_LOC_EVENT_IOCTL_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_STATUS_REPORT ),
+ NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ),
+ };
+int loc_event_num = sizeof loc_event_name / sizeof(loc_name_val_s_type);
+
+/* Event names */
+loc_name_val_s_type loc_event_atl_open_name[] =
+ {
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_OPEN ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_CLOSE ),
+ NAME_VAL( RPC_LOC_SERVER_REQUEST_MULTI_OPEN )
+ };
+int loc_event_atl_open_num = sizeof loc_event_atl_open_name / sizeof(loc_name_val_s_type);
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open)
+{
+ return loc_get_name_from_val(loc_event_atl_open_name, loc_event_atl_open_num,
+ (long) loc_event_atl_open);
+}
+
+/* IOCTL Type names */
+loc_name_val_s_type loc_ioctl_type_name[] =
+ {
+ NAME_VAL( RPC_LOC_IOCTL_GET_API_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_FIX_CRITERIA ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_UTC_TIME ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_RTC_VALUE ),
+ NAME_VAL( RPC_LOC_IOCTL_INJECT_POSITION ),
+ NAME_VAL( RPC_LOC_IOCTL_QUERY_ENGINE_STATE ),
+ NAME_VAL( RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ENGINE_LOCK ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SBAS_CONFIG ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_NMEA_TYPES ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_ON_DEMAND_LPM ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_LBS_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_DATA_ENABLE ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_SUPL_VERSION ),
+ NAME_VAL( RPC_LOC_IOCTL_DELETE_ASSIST_DATA ),
+ NAME_VAL( RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR ),
+ NAME_VAL( RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR ),
+ };
+int loc_ioctl_type_num = sizeof loc_ioctl_type_name / sizeof(loc_name_val_s_type);
+
+/* IOCTL Status names */
+loc_name_val_s_type loc_ioctl_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_API_SUCCESS ),
+ NAME_VAL( RPC_LOC_API_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_API_UNSUPPORTED ),
+ NAME_VAL( RPC_LOC_API_INVALID_HANDLE ),
+ NAME_VAL( RPC_LOC_API_INVALID_PARAMETER ),
+ NAME_VAL( RPC_LOC_API_ENGINE_BUSY ),
+ NAME_VAL( RPC_LOC_API_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_API_TIMEOUT ),
+ NAME_VAL( RPC_LOC_API_RPC_FAILURE ),
+ NAME_VAL( RPC_LOC_API_RPC_MODEM_RESTART )
+ };
+int loc_ioctl_status_num = sizeof loc_ioctl_status_name / sizeof(loc_name_val_s_type);
+
+/* Fix session status names */
+loc_name_val_s_type loc_sess_status_name[] =
+ {
+ NAME_VAL( RPC_LOC_SESS_STATUS_SUCCESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_IN_PROGESS ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_GENERAL_FAILURE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_TIMEOUT ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_BAD_PARAMETER ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_PHONE_OFFLINE ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ),
+ NAME_VAL( RPC_LOC_SESS_STATUS_ENGINE_LOCKED )
+ };
+int loc_sess_status_num = sizeof loc_sess_status_name / sizeof(loc_name_val_s_type);
+
+/* Engine state names */
+loc_name_val_s_type loc_engine_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_ENGINE_STATE_ON ),
+ NAME_VAL( RPC_LOC_ENGINE_STATE_OFF )
+ };
+int loc_engine_state_num = sizeof loc_engine_state_name / sizeof(loc_name_val_s_type);
+
+/* Fix session state names */
+loc_name_val_s_type loc_fix_session_state_name[] =
+ {
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_BEGIN ),
+ NAME_VAL( RPC_LOC_FIX_SESSION_STATE_END )
+ };
+int loc_fix_session_state_num = sizeof loc_fix_session_state_name / sizeof(loc_name_val_s_type);
+
+
+static const char* log_final_interm_string(int is_final)
+{
+ return is_final ? "final" : "intermediate";
+}
+
+/* Logs parsed report */
+static void log_parsed_report(const rpc_loc_parsed_position_s_type *parsed_report)
+{
+ rpc_loc_session_status_e_type status = parsed_report->session_status;
+ LOC_LOGD("Session status: %s Valid mask: 0x%X\n",
+ loc_get_sess_status_name(status),
+ (uint) parsed_report->valid_mask);
+ LOC_LOGD("Latitude: %.7f (%s)\n", parsed_report->latitude,
+ log_final_interm_string(
+ (parsed_report->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ parsed_report->session_status == RPC_LOC_SESS_STATUS_SUCCESS));
+ LOC_LOGD("Longitude: %.7f\n", parsed_report->longitude);
+ LOC_LOGD("Accuracy: %.7f\n", parsed_report->hor_unc_circular);
+}
+
+/* Logs status report */
+static void log_status_report(const rpc_loc_status_event_s_type *status_event)
+{
+ rpc_loc_status_event_e_type event = status_event->event;
+ switch (event) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ LOC_LOGD("Engine state: %s\n",
+ loc_get_engine_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.engine_state));
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ LOC_LOGD("Fix session state: %s\n",
+ loc_get_fix_session_state_name(
+ status_event->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state));
+ break;
+ default:
+ break;
+ }
+}
+
+/* Logs valid fields in the GNSS SV constellation report */
+static void log_satellite_report(const rpc_loc_gnss_info_s_type *gnss)
+{
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP)
+ {
+ LOC_LOGV("position dop: %.3f\n", (float) gnss->position_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP)
+ {
+ LOC_LOGV("horizontal dop: %.3f\n", (float) gnss->horizontal_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP)
+ {
+ LOC_LOGV("vertical dop: %.3f\n", (float) gnss->vertical_dop);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED)
+ {
+ LOC_LOGV("altitude assumed: %d\n", (int) gnss->altitude_assumed);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT)
+ {
+ LOC_LOGD("sv count: %d\n", (int) gnss->sv_count);
+ }
+ if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST)
+ {
+ LOC_LOGV("sv list: ");
+
+ if (gnss->sv_count)
+ {
+ LOC_LOGV("\n\tsys\tprn\thlth\tproc\teph\talm\telev\tazi\tsnr\n");
+ }
+ else {
+ LOC_LOGV("empty\n");
+ }
+
+ int i;
+ for (i = 0; i < gnss->sv_count; i++)
+ {
+ const rpc_loc_sv_info_s_type *sv = &gnss->sv_list.sv_list_val[i];
+ rpc_loc_sv_info_valid_mask_type mask = sv->valid_mask;
+ LOC_LOGV(" %d: \t%d\t%d\t%d\t%d\t%d\t%d\t%.3f\t%.3f\t%.3f\n", i,
+ CHECK_MASK(int, sv->system, mask, RPC_LOC_SV_INFO_VALID_SYSTEM),
+ CHECK_MASK(int, sv->prn, mask, RPC_LOC_SV_INFO_VALID_PRN),
+ CHECK_MASK(int, sv->health_status, mask, RPC_LOC_SV_INFO_VALID_HEALTH_STATUS),
+ CHECK_MASK(int, sv->process_status, mask, RPC_LOC_SV_INFO_VALID_PROCESS_STATUS),
+ CHECK_MASK(int, sv->has_eph, mask, RPC_LOC_SV_INFO_VALID_HAS_EPH),
+ CHECK_MASK(int, sv->has_alm, mask, RPC_LOC_SV_INFO_VALID_HAS_ALM),
+ CHECK_MASK(float, sv->elevation, mask, RPC_LOC_SV_INFO_VALID_ELEVATION),
+ CHECK_MASK(float, sv->azimuth, mask, RPC_LOC_SV_INFO_VALID_AZIMUTH),
+ CHECK_MASK(float, sv->snr, mask, RPC_LOC_SV_INFO_VALID_SNR)
+ );
+ }
+ }
+}
+
+/* Logs a callback event */
+int loc_callback_log(
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ switch (loc_event)
+ {
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ log_satellite_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.gnss_report);
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ log_status_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.status_report);
+ break;
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ log_parsed_report(&loc_event_payload->
+ rpc_loc_event_payload_u_type_u.parsed_location_report);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask)
+{
+ return loc_get_name_from_mask(loc_event_name, loc_event_num,
+ (long) loc_event_mask);
+}
+
+/* Finds IOCTL type name */
+const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type)
+{
+ return loc_get_name_from_val(loc_ioctl_type_name, loc_ioctl_type_num,
+ (long) ioctl_type);
+}
+
+/* Finds IOCTL status name */
+const char* loc_get_ioctl_status_name(uint32 status)
+{
+ return loc_get_name_from_val(loc_ioctl_status_name, loc_ioctl_status_num,
+ (long) status);
+}
+
+/* Finds session status name */
+const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status)
+{
+ return loc_get_name_from_val(loc_sess_status_name, loc_sess_status_num,
+ (long) status);
+}
+
+/* Find engine state name */
+const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state)
+{
+ return loc_get_name_from_val(loc_engine_state_name, loc_engine_state_num,
+ (long) state);
+}
+
+/* Find engine state name */
+const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state)
+{
+ return loc_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num,
+ (long) state);
+}
+
+/* Event names */
+loc_name_val_s_type rpc_reset_event_name[] =
+{
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_BEGIN ),
+ NAME_VAL( RPC_SUBSYSTEM_RESTART_END )
+};
+int rpc_reset_event_num = sizeof rpc_reset_event_name / sizeof(loc_name_val_s_type);
+
+const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event)
+{
+ return loc_get_name_from_val(rpc_reset_event_name, rpc_reset_event_num, event);
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
new file mode 100644
index 0000000..e0f400c
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c
@@ -0,0 +1,636 @@
+/* Copyright (c) 2011-2012, 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 FILES FOR MODULE
+
+======================================================================*/
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <loc_api_log.h>
+
+#include <rpc/rpc.h>
+
+/* Include RPC headers */
+#include "rpc_inc/loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "rpc_inc/loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+#define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/* Logging Improvement */
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/*Maximum number of Modem init*/
+#define RPC_TRY_NUM 10
+
+/* Uncomment to force ALOGD messages */
+// #define ALOGD ALOGI
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_MAX_CLIENTS 16
+typedef struct
+{
+ uint32 cb_id; /* same as rpc/types.h */
+ loc_event_cb_f_type *cb_func; /* callback func */
+ loc_reset_notif_cb_f_type *rpc_cb; /* callback from RPC */
+ rpc_loc_client_handle_type handle; /* stores handle for client closing */
+ void* user; /* user's own data handle */
+} loc_glue_cb_entry_s_type;
+
+loc_glue_cb_entry_s_type loc_glue_callback_table[LOC_API_CB_MAX_CLIENTS];
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) a ## v ## b
+#define RPC_CALLBACK_FUNC_VERSION(a,v,b) RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { EXIT_LOG_CALLFLOW(%d, RPC_LOC_API_RPC_FAILURE); return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { \
+ LOC_LOGE("%s:%d] failure code %d", __func__, __LINE__, stat); \
+ return (ret_type)((stat == RPC_SUBSYSTEM_RESTART) ? \
+ RPC_LOC_API_RPC_MODEM_RESTART : RPC_LOC_API_RPC_FAILURE); \
+ }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ // The lower word of cd_id is the index
+ int index = argp->cb_id & 0xFFFF;
+
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (index >= LOC_API_CB_MAX_CLIENTS || loc_glue_callback_table[index].cb_func == NULL)
+ {
+ LOC_LOGE("Warning: No callback handler %d.\n", index);
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOC_LOGV("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOC_LOGV("Callback received: %x (cb_id=%p handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ argp->cb_id,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ /* Gives control to synchronous call handler */
+ loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload);
+
+ int32 rc = (loc_glue_callback_table[index].cb_func)(loc_glue_callback_table[index].user,
+ loc_handle, loc_event, loc_event_payload);
+
+ LOC_LOGV("cb_func=%p", loc_glue_callback_table[index].cb_func);
+
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOC_LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+/*===========================================================================
+
+FUNCTION rpc_loc_event_cb_f_type_<version>_svc (MACRO)
+
+DESCRIPTION
+ Callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_event_cb_f_type_, RPC_LOC_EVENT_CB_F_TYPE_VERSION, _svc) (
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ return rpc_loc_event_cb_f_type_svc(argp, ret, req);
+}
+
+/*===========================================================================
+
+FUNCTION loc_apicbprog_<version>_freeresult (MACRO)
+
+DESCRIPTION
+ Free up RPC data structure
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+#define VERSION_CONCAT(MAJOR,MINOR) MAJOR##MINOR
+#define loc_apicb_prog_VER_freeresult(M,N) \
+int RPC_CALLBACK_FUNC_VERSION(loc_apicbprog_, VERSION_CONCAT(M,N), _freeresult) \
+(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) \
+{ \
+ return loc_apicbprog_freeresult(transp, xdr_result, result); \
+}
+
+/* Define all of the possible minors */
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0001);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0002);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0003);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0004);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0005);
+loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+/*===========================================================================
+
+FUNCTION rpc_loc_api_cb_null_<version>_svc (MACRO) [Patch for wrong RPCGEN stubs]
+
+DESCRIPTION
+ Null callback function for Loc API
+
+RETURN VALUE
+ 1 for success
+
+===========================================================================*/
+#define rpc_loc_api_cb_null_VER_svc(M,N) \
+bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_api_cb_null_, VERSION_CONCAT(M,N), _svc) ( \
+ void *a, int *b, struct svc_req *req) \
+{ \
+ return 1; \
+}
+
+/* Define all of the possible minors */
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0001);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0002);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0003);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0004);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0005);
+rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0006);
+
+static void loc_api_glue_rpc_cb(CLIENT* client, enum rpc_reset_event event)
+{
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) {
+ if (NULL != loc_glue_callback_table[i].rpc_cb) {
+ loc_glue_callback_table[i].rpc_cb(loc_glue_callback_table[i].user, client, event);
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Initialize data */
+ int i;
+ int pid = getpid();
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ loc_glue_callback_table[i].cb_id = i | (pid << 16);
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].user = NULL;
+ }
+
+ /* Print msg */
+ LOC_LOGV("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOC_LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ LOC_LOGE("Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ loc_api_sync_call_init();
+
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOC_LOGD("Loc API RPC client initialized.\n");
+ clnt_register_reset_notification_cb(loc_api_clnt, loc_api_glue_rpc_cb);
+ }
+ else {
+ LOC_LOGE("Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback,
+ loc_reset_notif_cb_f_type *rpc_cb,
+ void* userData
+)
+{
+ int try_num = RPC_TRY_NUM;
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_client_handle_type ret_val;
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+
+ int i, j = LOC_API_CB_MAX_CLIENTS;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].user == userData)
+ {
+ LOC_LOGW("Client already opened service (callback=%p)...\n",
+ event_callback);
+ break;
+ } else if (j == LOC_API_CB_MAX_CLIENTS &&
+ loc_glue_callback_table[i].user == NULL) {
+ j = i;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ i = j;
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGE("Too many clients opened at once...\n");
+ return RPC_LOC_CLIENT_HANDLE_INVALID;
+ }
+
+ loc_glue_callback_table[i].cb_func = event_callback;
+ loc_glue_callback_table[i].rpc_cb = rpc_cb;
+ loc_glue_callback_table[i].user = userData;
+
+ args.event_callback = loc_glue_callback_table[i].cb_id;
+ LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client open");
+
+ /*try more for rpc_loc_open_xx()*/
+
+ do
+ {
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
+ ret_val = (rpc_loc_client_handle_type) rets.loc_open_result;
+ try_num--;
+
+ }while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num );
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ /* save the handle in the table */
+ loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result;
+
+ return ret_val;
+
+}
+
+int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc client close");
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt);
+
+ loc_clear(handle);
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ ret_val = (int32) rets.loc_close_result;
+
+ return ret_val;
+}
+
+void loc_clear(rpc_loc_client_handle_type handle) {
+ /* Clean the client's callback function in callback table */
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].handle == handle)
+ {
+ /* Found the client */
+ loc_glue_callback_table[i].cb_func = NULL;
+ loc_glue_callback_table[i].rpc_cb = NULL;
+ loc_glue_callback_table[i].handle = -1;
+ loc_glue_callback_table[i].user = NULL;
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOC_LOGW("Handle not found (handle=%d)...\n", (int) handle);
+ }
+}
+
+int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc start fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_start_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, "loc stop fix");
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_stop_fix_result;
+
+ return ret_val;
+}
+
+int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+)
+{
+ ENTRY_LOG();
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 ret_val;
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ break;
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ break;
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ break;
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ break;
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ EXIT_LOG_CALLFLOW(%s, loc_get_ioctl_type_name(ioctl_type));
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ ret_val = (int32) rets.loc_ioctl_result;
+
+ return ret_val;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ clnt_unregister_reset_notification_cb(loc_api_clnt);
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl
+
+DESCRIPTION
+ This function calls loc_ioctl and waits for the callback result before
+ returning back to the user.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS;
+
+ ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr);
+
+ LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, returt %s\n",
+ (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type),
+ loc_get_ioctl_status_name(ret_val) );
+
+ return ret_val;
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
new file mode 100644
index 0000000..ae629d7
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c
@@ -0,0 +1,565 @@
+/* Copyright (c) 2011-2012, 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 <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include "loc_api_sync_call.h"
+
+/* Logging */
+#define LOG_TAG "LocSvc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_slot_array_s_type loc_sync_data;
+
+pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
+boolean loc_sync_call_inited = 0;
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_init
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_init()
+{
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 1) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 1;
+
+ loc_sync_data.num_of_slots = LOC_SYNC_CALL_SLOTS_MAX;
+
+ int i;
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->not_available = 0;
+ slot->in_use = 0;
+ slot->loc_handle = -1;
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_call_destroy
+
+DESCRIPTION
+ Initialize this module
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_api_sync_call_destroy()
+{
+ int i;
+
+ pthread_mutex_lock(&loc_sync_call_mutex);
+ if (loc_sync_call_inited == 0) {
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+ return;
+ }
+ loc_sync_call_inited = 0;
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->not_available = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ pthread_cond_destroy(&slot->loc_cb_arrived_cond);
+ pthread_mutex_destroy(&slot->lock);
+ }
+
+ pthread_mutex_unlock(&loc_sync_call_mutex);
+}
+
+/*===========================================================================
+
+FUNCTION loc_match_callback
+
+DESCRIPTION
+ Checks if an awaited event has arrived
+
+RETURN VALUE
+ TRUE arrived
+ FALSE not matching
+
+===========================================================================*/
+static boolean loc_match_callback(
+ rpc_loc_event_mask_type wait_mask,
+ rpc_loc_ioctl_e_type wait_ioctl,
+ rpc_loc_event_mask_type event_mask,
+ const rpc_loc_event_payload_u_type *callback_payload
+)
+{
+ if ((event_mask & wait_mask) == 0) return FALSE;
+
+ if (event_mask != RPC_LOC_EVENT_IOCTL_REPORT || wait_ioctl == 0 ||
+ ( (callback_payload != NULL) &&
+ callback_payload->rpc_loc_event_payload_u_type_u.ioctl_report.type == wait_ioctl) )
+ return TRUE;
+
+ return FALSE;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_callback_process_sync_call
+
+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_api_callback_process_sync_call(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ int i;
+
+ ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event);
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->in_use &&
+ slot->signal_sent == 0 &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload))
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+
+ slot->loc_cb_received_event_mask = loc_event;
+
+ ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type);
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ slot->signal_sent = 1;
+
+ pthread_mutex_unlock(&slot->lock);
+ break;
+ } else {
+ /* do nothing */
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_a_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_lock_a_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ for (i = 0; i < loc_sync_data.num_of_slots; i++)
+ {
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i];
+ if (pthread_mutex_trylock(&slot->lock) == EBUSY)
+ {
+ ALOGV("trylock EBUSY : %d", i);
+ continue;
+ }
+
+ if (!slot->in_use && !slot->not_available)
+ {
+ select_id = i;
+ /* Return from here and leave the mutex locked.
+ * will unlock it in loc_unlock_slot()
+ */
+ break;
+ }
+ /* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_unlock_slot
+
+DESCRIPTION
+ Unlocks a buffer slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_unlock_slot(int select_id)
+{
+ pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_lock_slot
+
+DESCRIPTION
+ Locks a specific slot that was previously locked from loc_lock_a_slot
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_lock_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.slots[select_id].lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_set_slot_in_use
+
+DESCRIPTION
+ Sets the in_use flag of slot to true or false.
+ Should be called only after the slot is locked
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_set_slot_in_use(int select_id, boolean in_use)
+{
+ loc_sync_data.slots[select_id].in_use = in_use;
+ if (in_use == 1)
+ loc_sync_data.slots[select_id].signal_sent = 0;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_save_callback
+
+DESCRIPTION
+ Selects which callback or IOCTL event to wait for.
+
+ The event_mask specifies the event(s). If it is RPC_LOC_EVENT_IOCTL_REPORT,
+ then ioctl_type specifies the IOCTL event.
+
+ If ioctl_type is non-zero, RPC_LOC_EVENT_IOCTL_REPORT is automatically added.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : out of buffer
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_api_save_callback(
+ int select_id, /* Selected slot */
+ rpc_loc_client_handle_type loc_handle, /* Client handle */
+ rpc_loc_event_mask_type event_mask, /* Event mask to wait for */
+ rpc_loc_ioctl_e_type ioctl_type /* IOCTL type to wait for */
+)
+{
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ slot->loc_handle = loc_handle;
+
+ slot->loc_cb_wait_event_mask = event_mask;
+ slot->ioctl_type = ioctl_type;
+ if (ioctl_type) slot->loc_cb_wait_event_mask |= RPC_LOC_EVENT_IOCTL_REPORT;
+
+ return;
+}
+
+/*===========================================================================
+
+FUNCTION loc_save_user_payload
+
+DESCRIPTION
+ Saves received payload into user data structures
+
+RETURN VALUE
+ None
+
+===========================================================================*/
+static void loc_save_user_payload(
+ rpc_loc_event_payload_u_type *user_cb_payload,
+ rpc_loc_ioctl_callback_s_type *user_ioctl_buffer,
+ const rpc_loc_event_payload_u_type *received_cb_payload
+)
+{
+ if (user_cb_payload)
+ {
+ memcpy(user_cb_payload, received_cb_payload,
+ sizeof (rpc_loc_event_payload_u_type));
+ }
+ if (user_ioctl_buffer)
+ {
+ memcpy(user_ioctl_buffer,
+ &received_cb_payload->rpc_loc_event_payload_u_type_u.ioctl_report,
+ sizeof *user_ioctl_buffer);
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_wait_callback
+
+DESCRIPTION
+ Waits for a selected callback. The wait expires in timeout_seconds seconds.
+
+ If the function is called before an existing wait has finished, it will
+ immediately return EBUSY.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS if successful (0)
+ RPC_LOC_API_TIMEOUT if timed out
+ RPC_LOC_API_ENGINE_BUSY if already in a wait
+ RPC_LOC_API_INVALID_PARAMETER if callback is not yet selected
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_api_wait_callback(
+ int select_id, /* ID from loc_select_callback() */
+ int timeout_seconds, /* Timeout in this number of seconds */
+ rpc_loc_event_payload_u_type *callback_payload, /* Pointer to callback payload buffer, can be NULL */
+ rpc_loc_ioctl_callback_s_type *ioctl_payload /* Pointer to IOCTL payload, can be NULL */
+)
+{
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc = 0; /* return code from pthread calls */
+
+ struct timespec expire_time;
+
+ loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id];
+
+ clock_gettime(CLOCK_REALTIME, &expire_time);
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Waiting */
+ while (slot->signal_sent == 0 && rc != ETIMEDOUT) {
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+ }
+
+ if (rc == ETIMEDOUT)
+ {
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ ALOGE("TIMEOUT: %d", select_id);
+ }
+ else {
+ /* Obtained the first awaited callback */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_sync_ioctl
+
+DESCRIPTION
+ Synchronous IOCTL call (reentrant version)
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Loc API error code (0 = success)
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+)
+{
+ int rc = -1;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ select_id = loc_lock_a_slot();
+
+ if (select_id < 0 || select_id >= loc_sync_data.num_of_slots)
+ {
+ ALOGE("slot not available ioctl_type = %s",
+ loc_get_ioctl_type_name(ioctl_type));
+ return rc;
+ }
+
+ loc_set_slot_in_use(select_id, 1); // set slot in use to true
+
+ // Select the callback we are waiting for
+ loc_api_save_callback(select_id, handle, 0, ioctl_type);
+
+ loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true
+
+ // we want to avoid keeping the slot locked during the loc_ioctl because the rpc
+ // framework will also lock a different mutex during this call, and typically
+ // locking two different mutexes at the same time can lead to deadlock.
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+
+ loc_lock_slot(select_id);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else {
+ ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS",
+ select_id, ioctl_type);
+ // Wait for the callback of loc_ioctl
+ if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0)
+ {
+ // Callback waiting failed
+ ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ }
+ else
+ {
+ if (cb_data_ptr) memcpy(cb_data_ptr, &callback_data, sizeof *cb_data_ptr);
+ if (callback_data.status != RPC_LOC_API_SUCCESS)
+ {
+ rc = callback_data.status;
+ ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s",
+ select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc));
+ } else {
+ ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d",
+ select_id, ioctl_type, rc);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+
+ loc_set_slot_in_use(select_id, 0); // set slot in use to false
+ loc_unlock_slot(select_id);
+
+ return rc;
+}
+
+
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..db5b291
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c
@@ -0,0 +1,86 @@
+/* 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.
+ */
+
+#include "rpc/rpc.h"
+
+/* Include RPC headers */
+#ifdef USE_LOCAL_RPC
+#include "rpc_inc/loc_api_common.h"
+#include "rpc_inc/loc_api.h"
+#include "rpc_inc/loc_api_cb.h"
+#endif
+
+#ifdef USE_QCOM_AUTO_RPC
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+#endif
+
+#include "rpc_inc/loc_api_fixup.h"
+#include "loc_apicb_appinit.h"
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_* function */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+ if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+
+void loc_apicb_app_deinit(void)
+{
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+ svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
+ xprt_unregister(svrPort);
+ svc_destroy(svrPort);
+ svrPort = NULL;
+}
+
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
new file mode 100644
index 0000000..1c2b16b
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk
@@ -0,0 +1,35 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# functions
+LOC_RPCGEN_APIS_PATH := $(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+LOC_RPCGEN_APIS_PATH_FL := ../../../../../$(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates
+
+LOCAL_MODULE := libloc_api_rpcgen
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_SHARED_LIBRARIES := \
+ librpc \
+ libcommondefs
+
+LOCAL_SRC_FILES += \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+LOCAL_C_INCLUDES += hardware/msm7k/librpc
+LOCAL_C_INCLUDES += $(LOC_RPCGEN_APIS_PATH)/../../SHARED_LIBRARIES/libcommondefs_intermediates/inc
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc
+
+LOCAL_LDLIBS += -lpthread
+LOCAL_PRELINK_MODULE := false
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_api_rpcgen_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
+include $(BUILD_HEADER_LIBRARY)
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
new file mode 100644
index 0000000..4ac8c8a
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am
@@ -0,0 +1,42 @@
+AM_CFLAGS = \
+ -I../../../utils \
+ -I./inc \
+ $(MSM7K_CFLAGS)
+
+requiredlibs = \
+ ../../../utils/libgps_utils_so.la \
+ $(MSM7K_LIBS)
+
+h_sources = \
+ inc/loc_api_rpcgen_rpc.h \
+ inc/loc_api_rpcgen_common_rpc.h \
+ inc/loc_api_rpcgen_cb_rpc.h \
+ inc/loc_apicb_appinit.h
+
+c_sources = \
+ src/loc_api_rpcgen_cb_xdr.c \
+ src/loc_api_rpcgen_common_xdr.c \
+ src/loc_api_rpcgen_cb_svc.c \
+ src/loc_api_rpcgen_clnt.c \
+ src/loc_api_rpcgen_xdr.c
+
+
+
+library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-stub/inc
+library_include_HEADERS = $(h_sources)
+libloc_api_rpcgen_la_SOURCES = $(c_sources) $(h_sources)
+
+if USE_GLIB
+libloc_api_rpcgen_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_api_rpcgen_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_api_rpcgen_la_CFLAGS = $(AM_CFLAGS)
+libloc_api_rpcgen_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_api_rpcgen_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_api_rpcgen_la_LIBADD = $(requiredlibs) -lstdc++
+
+#Create and Install Libraries
+lib_LTLIBRARIES = libloc_api_rpcgen.la
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
new file mode 100644
index 0000000..87f2c37
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h
@@ -0,0 +1,156 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_RPC_H_RPCGEN
+#define _LOC_API_CB_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00050006
+
+#define LOC_APICBPROG 0x3100008C
+#define LOC_APICBVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001();
+extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc();
+extern int loc_apicbprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_cb_null 0xffffff00
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050002();
+extern bool_t rpc_loc_api_cb_null_0x00050002_svc();
+extern int loc_apicbprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050003();
+extern bool_t rpc_loc_api_cb_null_0x00050003_svc();
+extern int loc_apicbprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050004();
+extern bool_t rpc_loc_api_cb_null_0x00050004_svc();
+extern int loc_apicbprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050005();
+extern bool_t rpc_loc_api_cb_null_0x00050005_svc();
+extern int loc_apicbprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APICBVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(void *, int *, CLIENT *);
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc(void *, int *, struct svc_req *);
+extern int loc_apicbprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_cb_null_0x00050006();
+extern bool_t rpc_loc_api_cb_null_0x00050006_svc();
+extern int loc_apicbprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_RPC_H_RPCGEN */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
new file mode 100644
index 0000000..8107de2
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h
@@ -0,0 +1,1261 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_RPC_H_RPCGEN
+#define _LOC_API_COMMON_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040030
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_API_CB_NULL_VERSION 0x00050002
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001
+#define RPC_LOC_API_API_VERSIONS_VERSION 0x00050001
+#define RPC_LOC_STOP_FIX_VERSION 0x00050001
+#define RPC_LOC_START_FIX_VERSION 0x00050001
+#define RPC_LOC_IOCTL_VERSION 0x00050001
+#define RPC_LOC_CLOSE_VERSION 0x00050001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001
+#define RPC_LOC_OPEN_VERSION 0x00050001
+#define RPC_LOC_API_NULL_VERSION 0x00050001
+#define RPC_LOC_API_API_MAJOR_NUM 0x0005
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[200];
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+typedef struct rpc_loc_server_addr_ipv6_type rpc_loc_server_addr_ipv6_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ rpc_loc_server_addr_ipv6_type ipv6;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+typedef struct rpc_loc_pos_inj_request_s_type rpc_loc_pos_inj_request_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET = 0 + 1,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216,
+};
+typedef enum rpc_loc_server_connection_e_type rpc_loc_server_connection_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+typedef struct rpc_loc_server_multi_open_req_s_type rpc_loc_server_multi_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP = 0 + 1,
+ RPC_LOC_SERVER_PDP_IPV6 = 0 + 2,
+ RPC_LOC_SERVER_PDP_IPV4V6 = 0 + 3,
+ RPC_LOC_SERVER_PDP_MAX = 268435456,
+};
+typedef enum rpc_loc_server_pdp_type_e_type rpc_loc_server_pdp_type_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_multi_open_status_s_type rpc_loc_server_multi_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456,
+};
+typedef enum rpc_loc_error_estimate_config_e_type rpc_loc_error_estimate_config_e_type;
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ char apn_name[100];
+};
+typedef struct rpc_loc_apn_profiles_type rpc_loc_apn_profiles_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_boolean data_enable;
+ rpc_uint32 supl_version;
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ rpc_uint8 xtra_t_session_control;
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ rpc_uint32 supl_version;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type (XDR *, rpc_loc_server_addr_ipv6_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type (XDR *, rpc_loc_pos_inj_request_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_connection_e_type (XDR *, rpc_loc_server_connection_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (XDR *, rpc_loc_server_multi_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type (XDR *, rpc_loc_server_pdp_type_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (XDR *, rpc_loc_server_multi_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type (XDR *, rpc_loc_error_estimate_config_e_type*);
+extern bool_t xdr_rpc_loc_apn_profiles_type (XDR *, rpc_loc_apn_profiles_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv6_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_pos_inj_request_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_connection_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_pdp_type_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_multi_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_error_estimate_config_e_type ();
+extern bool_t xdr_rpc_loc_apn_profiles_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_RPC_H_RPCGEN */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
new file mode 100644
index 0000000..6138432
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h
@@ -0,0 +1,288 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_RPC_H_RPCGEN
+#define _LOC_API_RPC_H_RPCGEN
+
+#include "librpc.h"
+#include "commondefs_rpcgen_rpc.h"
+#include "loc_api_rpcgen_common_rpc.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00050006
+
+#define LOC_APIPROG 0x3000008C
+#define LOC_APIVERS_0001 0x00050001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050001_svc(void *, void *, struct svc_req *);
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *);
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00050001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00050001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *);
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00050001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *);
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00050001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *);
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00050001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *);
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00050001();
+extern bool_t rpc_loc_api_null_0x00050001_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00050001();
+extern bool_t rpc_loc_open_0x00050001_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00050001();
+extern bool_t rpc_loc_close_0x00050001_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00050001();
+extern bool_t rpc_loc_start_fix_0x00050001_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00050001();
+extern bool_t rpc_loc_stop_fix_0x00050001_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00050001();
+extern bool_t rpc_loc_ioctl_0x00050001_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00050001();
+extern bool_t rpc_loc_api_api_versions_0x00050001_svc();
+extern int loc_apiprog_0x00050001_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0002 0x00050002
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050002_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050002();
+extern bool_t rpc_loc_api_null_0x00050002_svc();
+extern int loc_apiprog_0x00050002_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0003 0x00050003
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050003(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050003_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050003();
+extern bool_t rpc_loc_api_null_0x00050003_svc();
+extern int loc_apiprog_0x00050003_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0004 0x00050004
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050004(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050004_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050004();
+extern bool_t rpc_loc_api_null_0x00050004_svc();
+extern int loc_apiprog_0x00050004_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0005 0x00050005
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050005(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050005_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050005();
+extern bool_t rpc_loc_api_null_0x00050005_svc();
+extern int loc_apiprog_0x00050005_freeresult ();
+#endif /* K&R C */
+#define LOC_APIVERS_0006 0x00050006
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern enum clnt_stat rpc_loc_api_null_0x00050006(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00050006_svc(void *, void *, struct svc_req *);
+extern int loc_apiprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+extern enum clnt_stat rpc_loc_api_null_0x00050006();
+extern bool_t rpc_loc_api_null_0x00050006_svc();
+extern int loc_apiprog_0x00050006_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_RPC_H_RPCGEN */
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
new file mode 100644
index 0000000..875c4f0
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* 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.
+ *
+ */
+
+/* Initialization function for callbacks */
+int loc_apicb_app_init();
+
+void loc_apicb_app_deinit();
+
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
new file mode 100644
index 0000000..2ef5852
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c
@@ -0,0 +1,327 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00050001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00050001_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00050001_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_event_cb_f_type:
+ _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args;
+ _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00050001_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050002(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050002_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050002_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050002_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050003(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050003_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050003_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050003_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050004(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050004_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050004_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050004_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050005(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050005_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050005_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050005_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
+
+void
+loc_apicbprog_0x00050006(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ int fill;
+ } argument;
+ union {
+ int rpc_loc_api_cb_null_0x00050006_res;
+ } result;
+ bool_t retval;
+ xdrproc_t _xdr_argument, _xdr_result;
+ bool_t (*local)(char *, void *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case rpc_loc_api_cb_null:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_int;
+ local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050006_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp);
+ if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ if (!loc_apicbprog_0x00050006_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
new file mode 100644
index 0000000..ad171dc
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c
@@ -0,0 +1,60 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_cb_rpc.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
new file mode 100644
index 0000000..3e39576
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c
@@ -0,0 +1,155 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api_rpcgen_rpc.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00050001(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_open_0x00050001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_open,
+ (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_close_0x00050001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_close,
+ (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_start_fix,
+ (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_stop_fix,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_ioctl,
+ (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_api_versions_0x00050001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050002(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050003(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050004(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050005(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
+
+enum clnt_stat
+rpc_loc_api_null_0x00050006(void *argp, void *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_null,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_void, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
new file mode 100644
index 0000000..21be8f4
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c
@@ -0,0 +1,1775 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_common_rpc.h"
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv6_type (XDR *xdrs, rpc_loc_server_addr_ipv6_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_vector (xdrs, (char *)objp->addr, 8,
+ sizeof (rpc_uint16), (xdrproc_t) xdr_rpc_uint16))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ if (!xdr_rpc_loc_server_addr_ipv6_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv6))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_inj_request_s_type (XDR *xdrs, rpc_loc_pos_inj_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->position_uncertainty))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ if (!xdr_rpc_loc_pos_inj_request_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.pos_injection))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_e_type (XDR *xdrs, rpc_loc_server_connection_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_req_s_type (XDR *xdrs, rpc_loc_server_multi_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ if (!xdr_rpc_loc_server_connection_e_type (xdrs, &objp->connection_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ if (!xdr_rpc_loc_server_multi_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.multi_open_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_pdp_type_e_type (XDR *xdrs, rpc_loc_server_pdp_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_multi_open_status_s_type (XDR *xdrs, rpc_loc_server_multi_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_rpc_loc_server_pdp_type_e_type (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_error_estimate_config_e_type (XDR *xdrs, rpc_loc_error_estimate_config_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_apn_profiles_type (XDR *xdrs, rpc_loc_apn_profiles_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint32 (xdrs, &objp->srv_system_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->pdp_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ if (!xdr_rpc_loc_error_estimate_config_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.error_estimate_config))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.data_enable))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_multi_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.multi_conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.xtra_t_session_control))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_callback_data_u_type_u.apn_profiles, 6,
+ sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.supl_version))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
new file mode 100644
index 0000000..a0fdcab
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c
@@ -0,0 +1,199 @@
+/* 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.
+ *
+ */
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_rpcgen_rpc.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
new file mode 100644
index 0000000..b469eb0
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c
@@ -0,0 +1,74 @@
+/* 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.
+ *
+ */
+#include "librpc.h"
+#include "loc_api_rpcgen_rpc.h"
+#include "loc_api_rpcgen_cb_rpc.h"
+
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+
+static SVCXPRT* svrPort = NULL;
+
+extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
+
+int loc_apicb_app_init(void)
+{
+
+ /* Register a callback server to use the loc_apicbprog_0x00010001 */
+ if (svrPort == NULL) {
+ svrPort = svcrtr_create();
+ }
+ if (!svrPort) return -1;
+
+ xprt_register(svrPort);
+
+
+
+ if(svc_register(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
+ {
+ return 0;
+ }
+ else
+ {
+ return -1;
+ }
+}
+void loc_apicb_app_deinit(void)
+{
+
+ if (svrPort == NULL)
+ {
+ return;
+ }
+
+
+ svc_unregister(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001);
+}
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
new file mode 100644
index 0000000..82dca56
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr
@@ -0,0 +1,261 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00050006 )
+ */
+
+program LOC_APIPROG {
+ version LOC_APIVERS_0001 {
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ rpc_loc_api_rpc_glue_code_info_remote_rets
+ rpc_loc_api_rpc_glue_code_info_remote( void ) = 1;
+
+ rpc_loc_open_rets
+ rpc_loc_open( rpc_loc_open_args ) = 2;
+
+ rpc_loc_close_rets
+ rpc_loc_close( rpc_loc_close_args ) = 3;
+
+ rpc_loc_start_fix_rets
+ rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4;
+
+ rpc_loc_stop_fix_rets
+ rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5;
+
+ rpc_loc_ioctl_rets
+ rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6;
+
+ rpc_loc_api_api_versions_rets
+ rpc_loc_api_api_versions( void ) = 0xFFFFFFFF;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APIVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050002;
+
+version LOC_APIVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050003;
+
+version LOC_APIVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050004;
+
+version LOC_APIVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APIVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ void
+ rpc_loc_api_null( void ) = 0;
+
+ } = 0x00050006;
+
+
+} = 0x3000008C;
+
+const LOC_APIVERS = 0x00050006;
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
new file mode 100644
index 0000000..4756c6c
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr
@@ -0,0 +1,187 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00050006 )
+ */
+
+program LOC_APICBPROG {
+ version LOC_APICBVERS_0001 {
+
+ rpc_loc_event_cb_f_type_rets
+ rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1;
+
+
+
+
+ } = 0x00050001;
+
+version LOC_APICBVERS_0002 {
+
+/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002
+RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002
+RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL
+RPC_LOC_IOCTL_RESERVED_CMD
+RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050002;
+
+version LOC_APICBVERS_0003 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003
+RPC_LOC_IOCTL_SET_DATA_ENABLE
+RPC_LOC_IOCTL_SET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE
+RPC_LOC_IOCTL_GET_LBS_APN_PROFILE
+RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050003;
+
+version LOC_APICBVERS_0004 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004
+RPC_LOC_IOCTL_GET_SUPL_VERSION
+RPC_LOC_IOCTL_SET_SUPL_VERSION
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050004;
+
+version LOC_APICBVERS_0005 {
+
+/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005
+RPC_LOC_SERVER_ADDR_IPV6
+*/
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005
+RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050005;
+
+
+
+ version LOC_APICBVERS_0006 {
+
+/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006
+RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS
+*/
+/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006
+RPC_LOC_SERVER_REQUEST_MULTI_OPEN
+*/
+
+ int
+ rpc_loc_api_cb_null( void ) = 0xffffff00;
+
+ } = 0x00050006;
+
+
+} = 0x3100008C;
+
+const LOC_APICBVERS = 0x00050006;
diff --git a/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
new file mode 100644
index 0000000..e059c66
--- /dev/null
+++ b/msm8996/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr
@@ -0,0 +1,1021 @@
+/* Copyright (c) 2011-2012, 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.
+ *
+ */
+/* LOC_API TOOL VERSION: 4.48 */
+/* GENERATED: TUE JUN 14 2011 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+
+
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1
+
+loc_api Definition File(s):
+Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040030;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_API_CB_NULL_VERSION = 0x00050002;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001;
+const RPC_LOC_API_API_VERSIONS_VERSION = 0x00050001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00050001;
+const RPC_LOC_START_FIX_VERSION = 0x00050001;
+const RPC_LOC_IOCTL_VERSION = 0x00050001;
+const RPC_LOC_CLOSE_VERSION = 0x00050001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001;
+const RPC_LOC_OPEN_VERSION = 0x00050001;
+const RPC_LOC_API_NULL_VERSION = 0x00050001;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0005;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences[200];
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_IPV6 = 3,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256];
+};
+
+struct rpc_loc_server_addr_ipv6_type {
+ rpc_uint16 addr[8];
+ rpc_uint32 port;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ case RPC_LOC_SERVER_ADDR_IPV6:
+ rpc_loc_server_addr_ipv6_type ipv6;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20];
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20];
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+struct rpc_loc_pos_inj_request_s_type {
+ rpc_uint32 flags;
+ double latitude;
+ double longitude;
+ rpc_uint32 position_uncertainty;
+ rpc_uint64 timestamp;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ:
+ rpc_loc_pos_inj_request_s_type pos_injection;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_connection_e_type {
+ RPC_LOC_SERVER_CONNECTION_LBS = 0,
+ RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET,
+ RPC_LOC_SERVER_CONNECTION_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_multi_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+ rpc_loc_server_connection_e_type connection_type;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ case RPC_LOC_SERVER_REQUEST_MULTI_OPEN:
+ rpc_loc_server_multi_open_req_s_type multi_open_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414,
+ RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814,
+ RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815,
+ RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816,
+ RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817,
+ RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818,
+ RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819,
+ RPC_LOC_IOCTL_SET_DATA_ENABLE = 820,
+ RPC_LOC_IOCTL_SET_SUPL_VERSION = 821,
+ RPC_LOC_IOCTL_GET_SUPL_VERSION = 822,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_RESERVED_CMD = 8000,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+enum rpc_loc_server_pdp_type_e_type {
+ RPC_LOC_SERVER_PDP_IP = 0,
+ RPC_LOC_SERVER_PDP_PPP,
+ RPC_LOC_SERVER_PDP_IPV6,
+ RPC_LOC_SERVER_PDP_IPV4V6,
+ RPC_LOC_SERVER_PDP_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100];
+};
+
+struct rpc_loc_server_multi_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ rpc_loc_server_pdp_type_e_type pdp_type;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_error_estimate_config_e_type {
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1,
+ RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2,
+ RPC_LOC_ERROR_ESTIMATE_MAX = 268435456
+};
+
+struct rpc_loc_apn_profiles_type {
+ rpc_uint32 srv_system_type;
+ rpc_uint32 pdp_type;
+ rpc_uint32 reserved;
+ opaque apn_name[100];
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG:
+ rpc_loc_error_estimate_config_e_type error_estimate_config;
+ case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_SET_DATA_ENABLE:
+ rpc_boolean data_enable;
+ case RPC_LOC_IOCTL_SET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS:
+ rpc_loc_server_multi_open_status_s_type multi_conn_open_status;
+ case RPC_LOC_IOCTL_RESERVED_CMD:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL:
+ rpc_uint8 xtra_t_session_control;
+ case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE:
+ case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE:
+ rpc_loc_apn_profiles_type apn_profiles[6];
+ case RPC_LOC_IOCTL_GET_SUPL_VERSION:
+ rpc_uint32 supl_version;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/msm8996/loc_api/libloc_api_50001/Android.mk b/msm8996/loc_api/libloc_api_50001/Android.mk
new file mode 100644
index 0000000..5182318
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/Android.mk
@@ -0,0 +1,111 @@
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libloc_eng
+LOCAL_MODULE_OWNER := qcom
+LOCAL_PROPRIETARY_MODULE := true
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ libdl \
+ liblog \
+ libloc_core \
+ libgps.utils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_nmea.cpp \
+ LocEngAdapter.cpp
+
+LOCAL_SRC_FILES += \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -Wno-unused-parameter
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ hardware/qcom/gps/msm8996/loc_api/libloc_api_50001 \
+ $(TARGET_OUT_HEADERS)/libflp
+
+LOCAL_HEADER_LIBRARIES := libgps.utils_headers libloc_core_headers
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libloc_eng_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
+include $(BUILD_HEADER_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+LOCAL_MODULE_OWNER := qcom
+LOCAL_PROPRIETARY_MODULE := true
+
+LOCAL_MODULE_TAGS := optional
+
+## Libs
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_eng \
+ libloc_core \
+ libgps.utils \
+ libdl
+
+ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false)
+endif
+
+LOCAL_SRC_FILES += \
+ loc.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
+endif
+
+ifeq ($(TARGET_USES_QCOM_BSP), true)
+LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP
+endif
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/libflp
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+LOCAL_HEADER_LIBRARIES := libgps.utils_headers libloc_core_headers
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
diff --git a/msm8996/loc_api/libloc_api_50001/LocEngAdapter.cpp b/msm8996/loc_api/libloc_api_50001/LocEngAdapter.cpp
new file mode 100644
index 0000000..31e3d8d
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/LocEngAdapter.cpp
@@ -0,0 +1,425 @@
+/* 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 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_EngAdapter"
+
+#include <cutils/properties.h>
+#include <LocEngAdapter.h>
+#include "loc_eng_msg.h"
+#include "loc_log.h"
+
+using namespace loc_core;
+
+LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) :
+ LocAdapterBase(adapter->getMsgTask()),
+ mLocEngAdapter(adapter)
+{
+}
+void LocInternalAdapter::setPositionModeInt(LocPosMode& posMode) {
+ sendMsg(new LocEngPositionMode(mLocEngAdapter, posMode));
+}
+void LocInternalAdapter::startFixInt() {
+ sendMsg(new LocEngStartFix(mLocEngAdapter));
+}
+void LocInternalAdapter::stopFixInt() {
+ sendMsg(new LocEngStopFix(mLocEngAdapter));
+}
+void LocInternalAdapter::getZppInt() {
+ sendMsg(new LocEngGetZpp(mLocEngAdapter));
+}
+
+LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ LocThread::tCreate tCreator) :
+ LocAdapterBase(mask,
+ //Get the AFW context if VzW context has not already been intialized in
+ //loc_ext
+ context == NULL?
+ LocDualContext::getLocFgContext(tCreator,
+ NULL,
+ LocDualContext::mLocationHalName,
+ false)
+ :context),
+ mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
+ mUlp(new UlpProxyBase()), mNavigating(false),
+ mSupportsAgpsRequests(false),
+ mSupportsPositionInjection(false),
+ mSupportsTimeInjection(false),
+ mPowerVote(0)
+{
+ memset(&mFixCriteria, 0, sizeof(mFixCriteria));
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ LOC_LOGD("LocEngAdapter created");
+}
+
+inline
+LocEngAdapter::~LocEngAdapter()
+{
+ delete mInternalAdapter;
+ LOC_LOGV("LocEngAdapter deleted");
+}
+
+void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) {
+ struct LocSetUlpProxy : public LocMsg {
+ LocAdapterBase* mAdapter;
+ UlpProxyBase* mUlp;
+ inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) :
+ LocMsg(), mAdapter(adapter), mUlp(ulp) {
+ }
+ virtual void proc() const {
+ LOC_LOGV("%s] ulp %p adapter %p", __func__,
+ mUlp, mAdapter);
+ mAdapter->setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp));
+}
+
+void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ if (ulp == mUlp) {
+ //This takes care of the case when double initalization happens
+ //and we get the same object back for UlpProxyBase . Do nothing
+ return;
+ }
+
+ LOC_LOGV("%s] %p", __func__, ulp);
+ if (NULL == ulp) {
+ LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__);
+ ulp = new UlpProxyBase();
+ }
+
+ if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) {
+ // need to send this mode and start msg to ULP
+ ulp->sendFixMode(mUlp->mPosMode);
+ }
+
+ if(mUlp->mFixSet) {
+ ulp->sendStartFix();
+ }
+
+ delete mUlp;
+ mUlp = ulp;
+}
+
+int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask)
+{
+ struct LocEngAdapterGpsLock : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LOC_GPS_LOCK_MASK mLockMask;
+ inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) :
+ LocMsg(), mAdapter(adapter), mLockMask(lockMask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setGpsLock(mLockMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+ };
+ sendMsg(new LocEngAdapterGpsLock(this, lockMask));
+ return 0;
+}
+
+void LocEngAdapter::requestPowerVote()
+{
+ if (getPowerVoteRight()) {
+ /* Power voting without engine lock:
+ * 101: vote down, 102-104 - vote up
+ * These codes are used not to confuse with actual engine lock
+ * functionality, that can't be used in SSR scenario, as it
+ * conflicts with initialization sequence.
+ */
+ bool powerUp = getPowerVote();
+ LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp);
+ setGpsLock(powerUp ? 103 : 101);
+ }
+}
+
+void LocInternalAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ sendMsg(new LocEngReportPosition(mLocEngAdapter,
+ location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask));
+}
+
+
+void LocEngAdapter::reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask)
+{
+ if (! mUlp->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask )) {
+ mInternalAdapter->reportPosition(location,
+ locationExtended,
+ locationExt,
+ status,
+ loc_technology_mask);
+ }
+}
+
+void LocInternalAdapter::reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt){
+ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus,
+ locationExtended, svExt));
+}
+
+void LocEngAdapter::reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt)
+{
+
+ // We want to send SV info to ULP to help it in determining GNSS
+ // signal strength ULP will forward the SV reports to HAL without
+ // any modifications
+ if (! mUlp->reportSv(svStatus, locationExtended, svExt)) {
+ mInternalAdapter->reportSv(svStatus, locationExtended, svExt);
+ }
+}
+
+void LocEngAdapter::setInSession(bool inSession)
+{
+ mNavigating = inSession;
+ mLocApi->setInSession(inSession);
+ if (!mNavigating) {
+ mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
+ }
+}
+
+void LocInternalAdapter::reportStatus(GpsStatusValue status)
+{
+ sendMsg(new LocEngReportStatus(mLocEngAdapter, status));
+}
+
+void LocEngAdapter::reportStatus(GpsStatusValue status)
+{
+ if (!mUlp->reportStatus(status)) {
+ mInternalAdapter->reportStatus(status);
+ }
+}
+
+inline
+void LocEngAdapter::reportNmea(const char* nmea, int length)
+{
+ sendMsg(new LocEngReportNmea(mOwner, nmea, length));
+}
+
+inline
+bool LocEngAdapter::reportXtraServer(const char* url1,
+ const char* url2,
+ const char* url3,
+ const int maxlength)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReportXtraServer(mOwner, url1,
+ url2, url3, maxlength));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestATL(mOwner,
+ connHandle, agps_type));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::releaseATL(int connHandle)
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngReleaseATL(mOwner, connHandle));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestXtraData()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestXtra(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestTime()
+{
+ if (mSupportsAgpsRequests) {
+ sendMsg(new LocEngRequestTime(mOwner));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data)
+{
+ if (mSupportsAgpsRequests) {
+ notif.size = sizeof(notif);
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME;
+
+ sendMsg(new LocEngRequestNi(mOwner, notif, data));
+ }
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::requestSuplES(int connHandle)
+{
+ if (mSupportsAgpsRequests)
+ sendMsg(new LocEngRequestSuplEs(mOwner, connHandle));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallOpened()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsOpened(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+bool LocEngAdapter::reportDataCallClosed()
+{
+ if(mSupportsAgpsRequests)
+ sendMsg(new LocEngSuplEsClosed(mOwner));
+ return mSupportsAgpsRequests;
+}
+
+inline
+void LocEngAdapter::handleEngineDownEvent()
+{
+ sendMsg(new LocEngDown(mOwner));
+}
+
+inline
+void LocEngAdapter::handleEngineUpEvent()
+{
+ sendMsg(new LocEngUp(mOwner));
+}
+
+enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty)
+{
+ loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d",
+ __func__, __LINE__, mSupportsTimeInjection);
+
+ if (mSupportsTimeInjection) {
+ LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__);
+ result = mLocApi->setTime(time, timeReference, uncertainty);
+ } else {
+ mSupportsTimeInjection = true;
+ }
+ return result;
+}
+
+enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check)
+{
+ enum loc_api_adapter_err ret;
+ ENTRY_LOG();
+ enum xtra_version_check eCheck;
+ switch (check) {
+ case 0:
+ eCheck = DISABLED;
+ break;
+ case 1:
+ eCheck = AUTO;
+ break;
+ case 2:
+ eCheck = XTRA2;
+ break;
+ case 3:
+ eCheck = XTRA3;
+ break;
+ default:
+ eCheck = DISABLED;
+ }
+ ret = mLocApi->setXtraVersionCheck(eCheck);
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+void LocEngAdapter::reportGnssMeasurementData(GnssData &gnssMeasurementData)
+{
+ sendMsg(new LocEngReportGnssMeasurement(mOwner,
+ gnssMeasurementData));
+}
+
+/*
+ Update Registration Mask
+ */
+void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled)
+{
+ LOC_LOGD("entering %s", __func__);
+ int result = LOC_API_ADAPTER_ERR_FAILURE;
+ result = mLocApi->updateRegistrationMask(event, isEnabled);
+ if (result == LOC_API_ADAPTER_ERR_SUCCESS) {
+ LOC_LOGD("%s] update registration mask succeed.", __func__);
+ } else {
+ LOC_LOGE("%s] update registration mask failed.", __func__);
+ }
+}
+
+/*
+ Set Gnss Constellation Config
+ */
+bool LocEngAdapter::gnssConstellationConfig()
+{
+ LOC_LOGD("entering %s", __func__);
+ bool result = false;
+ result = mLocApi->gnssConstellationConfig();
+ return result;
+}
diff --git a/msm8996/loc_api/libloc_api_50001/LocEngAdapter.h b/msm8996/loc_api/libloc_api_50001/LocEngAdapter.h
new file mode 100644
index 0000000..6666860
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/LocEngAdapter.h
@@ -0,0 +1,355 @@
+/* Copyright (c) 2011-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_API_ENG_ADAPTER_H
+#define LOC_API_ENG_ADAPTER_H
+
+#include <ctype.h>
+#include <hardware/gps.h>
+#include <loc.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <platform_lib_includes.h>
+
+#define MAX_URL_LEN 256
+
+using namespace loc_core;
+
+class LocEngAdapter;
+
+class LocInternalAdapter : public LocAdapterBase {
+ LocEngAdapter* mLocEngAdapter;
+public:
+ LocInternalAdapter(LocEngAdapter* adapter);
+
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void setPositionModeInt(LocPosMode& posMode);
+ virtual void startFixInt();
+ virtual void stopFixInt();
+ virtual void getZppInt();
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+};
+
+typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp);
+
+class LocEngAdapter : public LocAdapterBase {
+ void* mOwner;
+ LocInternalAdapter* mInternalAdapter;
+ UlpProxyBase* mUlp;
+ LocPosMode mFixCriteria;
+ bool mNavigating;
+ // mPowerVote is encoded as
+ // mPowerVote & 0x20 -- powerVoteRight
+ // mPowerVote & 0x10 -- power On / Off
+ unsigned int mPowerVote;
+ static const unsigned int POWER_VOTE_RIGHT = 0x20;
+ static const unsigned int POWER_VOTE_VALUE = 0x10;
+
+public:
+ bool mSupportsAgpsRequests;
+ bool mSupportsPositionInjection;
+ bool mSupportsTimeInjection;
+ GnssSystemInfo mGnssInfo;
+
+ LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
+ void* owner, ContextBase* context,
+ LocThread::tCreate tCreator);
+ virtual ~LocEngAdapter();
+
+ virtual void setUlpProxy(UlpProxyBase* ulp);
+ void setXtraUserAgent();
+ inline void requestUlp(unsigned long capabilities) {
+ mContext->requestUlp(mInternalAdapter, capabilities);
+ }
+ inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; }
+ inline UlpProxyBase* getUlpProxy() { return mUlp; }
+ inline void* getOwner() { return mOwner; }
+ inline bool hasAgpsExtendedCapabilities() {
+ return mContext->hasAgpsExtendedCapabilities();
+ }
+ inline bool hasCPIExtendedCapabilities() {
+ return mContext->hasCPIExtendedCapabilities();
+ }
+ inline bool hasNativeXtraClient() {
+ return mContext->hasNativeXtraClient();
+ }
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+
+ inline enum loc_api_adapter_err
+ startFix()
+ {
+ return mLocApi->startFix(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ stopFix()
+ {
+ return mLocApi->stopFix();
+ }
+ inline enum loc_api_adapter_err
+ deleteAidingData(GpsAidingData f)
+ {
+ return mLocApi->deleteAidingData(f);
+ }
+ inline enum loc_api_adapter_err
+ enableData(int enable)
+ {
+ return mLocApi->enableData(enable);
+ }
+ inline enum loc_api_adapter_err
+ setAPN(char* apn, int len)
+ {
+ return mLocApi->setAPN(apn, len);
+ }
+ inline enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy)
+ {
+ return mLocApi->injectPosition(latitude, longitude, accuracy);
+ }
+ inline enum loc_api_adapter_err
+ setXtraData(char* data, int length)
+ {
+ return mLocApi->setXtraData(data, length);
+ }
+ inline enum loc_api_adapter_err
+ requestXtraServer()
+ {
+ return mLocApi->requestXtraServer();
+ }
+ inline enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType)
+ {
+ return mLocApi->atlOpenStatus(handle, is_succ, apn, bearer, agpsType);
+ }
+ inline enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ)
+ {
+ return mLocApi->atlCloseStatus(handle, is_succ);
+ }
+ inline enum loc_api_adapter_err
+ setPositionMode(const LocPosMode *posMode)
+ {
+ if (NULL != posMode) {
+ mFixCriteria = *posMode;
+ }
+ return mLocApi->setPositionMode(mFixCriteria);
+ }
+ inline enum loc_api_adapter_err
+ setServer(const char* url, int len)
+ {
+ return mLocApi->setServer(url, len);
+ }
+ inline enum loc_api_adapter_err
+ setServer(unsigned int ip, int port,
+ LocServerType type)
+ {
+ return mLocApi->setServer(ip, port, type);
+ }
+ inline enum loc_api_adapter_err
+ informNiResponse(GpsUserResponseType userResponse, const void* passThroughData)
+ {
+ return mLocApi->informNiResponse(userResponse, passThroughData);
+ }
+ inline enum loc_api_adapter_err
+ setSUPLVersion(uint32_t version)
+ {
+ return mLocApi->setSUPLVersion(version);
+ }
+ inline enum loc_api_adapter_err
+ setLPPConfig(uint32_t profile)
+ {
+ return mLocApi->setLPPConfig(profile);
+ }
+ inline enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider)
+ {
+ return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider);
+ }
+ inline enum loc_api_adapter_err
+ setSensorProperties(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)
+ {
+ return mLocApi->setSensorProperties(gyroBiasVarianceRandomWalk_valid, gyroBiasVarianceRandomWalk,
+ accelBiasVarianceRandomWalk_valid, accelBiasVarianceRandomWalk,
+ angleBiasVarianceRandomWalk_valid, angleBiasVarianceRandomWalk,
+ rateBiasVarianceRandomWalk_valid, rateBiasVarianceRandomWalk,
+ velocityBiasVarianceRandomWalk_valid, velocityBiasVarianceRandomWalk);
+ }
+ inline virtual enum loc_api_adapter_err
+ setSensorPerfControlConfig(int controlMode, int accelSamplesPerBatch, int accelBatchesPerSec,
+ int gyroSamplesPerBatch, int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig)
+ {
+ return mLocApi->setSensorPerfControlConfig(controlMode, accelSamplesPerBatch, accelBatchesPerSec,
+ gyroSamplesPerBatch, gyroBatchesPerSec,
+ accelSamplesPerBatchHigh, accelBatchesPerSecHigh,
+ gyroSamplesPerBatchHigh, gyroBatchesPerSecHigh,
+ algorithmConfig);
+ }
+ inline virtual enum loc_api_adapter_err
+ setExtPowerConfig(int isBatteryCharging)
+ {
+ return mLocApi->setExtPowerConfig(isBatteryCharging);
+ }
+ inline virtual enum loc_api_adapter_err
+ setAGLONASSProtocol(unsigned long aGlonassProtocol)
+ {
+ return mLocApi->setAGLONASSProtocol(aGlonassProtocol);
+ }
+ inline virtual int initDataServiceClient()
+ {
+ return mLocApi->initDataServiceClient();
+ }
+ inline virtual int openAndStartDataCall()
+ {
+ return mLocApi->openAndStartDataCall();
+ }
+ inline virtual void stopDataCall()
+ {
+ mLocApi->stopDataCall();
+ }
+ inline virtual void closeDataCall()
+ {
+ mLocApi->closeDataCall();
+ }
+ inline enum loc_api_adapter_err
+ getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
+ {
+ return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
+ }
+ enum loc_api_adapter_err setTime(GpsUtcTime time,
+ int64_t timeReference,
+ int uncertainty);
+ enum loc_api_adapter_err setXtraVersionCheck(int check);
+ inline virtual void installAGpsCert(const DerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+ {
+ mLocApi->installAGpsCert(pData, length, slotBitMask);
+ }
+ virtual void handleEngineDownEvent();
+ virtual void handleEngineUpEvent();
+ virtual void reportPosition(UlpLocation &location,
+ GpsLocationExtended &locationExtended,
+ void* locationExt,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask);
+ virtual void reportSv(GnssSvStatus &svStatus,
+ GpsLocationExtended &locationExtended,
+ void* svExt);
+ virtual void reportStatus(GpsStatusValue status);
+ virtual void reportNmea(const char* nmea, int length);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestATL(int connHandle, AGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData);
+
+ inline const LocPosMode& getPositionMode() const
+ {return mFixCriteria;}
+ inline virtual bool isInSession()
+ { return mNavigating; }
+ void setInSession(bool inSession);
+
+ // Permit/prohibit power voting
+ inline void setPowerVoteRight(bool powerVoteRight) {
+ mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) :
+ (mPowerVote & ~POWER_VOTE_RIGHT);
+ }
+ inline bool getPowerVoteRight() const {
+ return (mPowerVote & POWER_VOTE_RIGHT) != 0 ;
+ }
+ // Set the power voting up/down and do actual operation if permitted
+ inline void setPowerVote(bool powerOn) {
+ mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) :
+ (mPowerVote & ~POWER_VOTE_VALUE);
+ requestPowerVote();
+ mContext->modemPowerVote(powerOn);
+ }
+ inline bool getPowerVote() const {
+ return (mPowerVote & POWER_VOTE_VALUE) != 0 ;
+ }
+ // Do power voting according to last settings if permitted
+ void requestPowerVote();
+
+ /*Values for lock
+ 1 = Do not lock any position sessions
+ 2 = Lock MI position sessions
+ 3 = Lock MT position sessions
+ 4 = Lock all position sessions
+ */
+ inline int setGpsLock(LOC_GPS_LOCK_MASK lock)
+ {
+ return mLocApi->setGpsLock(lock);
+ }
+
+ int setGpsLockMsg(LOC_GPS_LOCK_MASK lock);
+
+ /*
+ Returns
+ Current value of GPS lock on success
+ -1 on failure
+ */
+ inline int getGpsLock()
+ {
+ return mLocApi->getGpsLock();
+ }
+
+ /*
+ Update Registration Mask
+ */
+ void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event,
+ loc_registration_mask_status isEnabled);
+
+ /*
+ Set Gnss Constellation Config
+ */
+ bool gnssConstellationConfig();
+};
+
+#endif //LOC_API_ENG_ADAPTER_H
diff --git a/msm8996/loc_api/libloc_api_50001/Makefile.am b/msm8996/loc_api/libloc_api_50001/Makefile.am
new file mode 100644
index 0000000..2374357
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/Makefile.am
@@ -0,0 +1,76 @@
+AM_CFLAGS = \
+ -I../../utils \
+ -I../../platform_lib_abstractions \
+ -fno-short-enums \
+ -DFEATURE_GNSS_BIT_API
+
+libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp
+
+if USE_GLIB
+libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la
+
+
+libloc_eng_so_la_SOURCES = \
+ loc_eng.cpp \
+ loc_eng_agps.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_dmn_conn.cpp \
+ loc_eng_dmn_conn_handler.cpp \
+ loc_eng_dmn_conn_thread_helper.c \
+ loc_eng_dmn_conn_glue_msg.c \
+ loc_eng_dmn_conn_glue_pipe.c
+
+
+if USE_GLIB
+libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_eng_so_la_CFLAGS = $(AM_CFLAGS)
+libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la
+
+
+libgps_default_so_la_SOURCES = \
+ loc.cpp \
+ gps.c
+
+if USE_GLIB
+libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_default_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la
+
+library_include_HEADERS = \
+ LocEngAdapter.h \
+ loc.h \
+ loc_eng.h \
+ loc_eng_xtra.h \
+ loc_eng_ni.h \
+ loc_eng_agps.h \
+ loc_eng_msg.h \
+ loc_eng_log.h
+
+library_includedir = $(pkgincludedir)/libloc_api_50001
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la
diff --git a/msm8996/loc_api/libloc_api_50001/gps.c b/msm8996/loc_api/libloc_api_50001/gps.c
new file mode 100644
index 0000000..29f20f4
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/gps.c
@@ -0,0 +1,73 @@
+/* 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 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 <hardware/gps.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = (struct gps_device_t *) malloc(sizeof(struct gps_device_t));
+
+ if(dev == NULL)
+ return -1;
+
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .module_api_version = 1,
+ .hal_api_version = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/msm8996/loc_api/libloc_api_50001/loc.cpp b/msm8996/loc_api/libloc_api_50001/loc.cpp
new file mode 100644
index 0000000..4970915
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc.cpp
@@ -0,0 +1,1156 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_afw"
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_eng.h>
+#include <loc_target.h>
+#include <loc_log.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <LocDualContext.h>
+#include <cutils/properties.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sstream>
+#include <string>
+
+using namespace loc_core;
+
+#define LOC_PM_CLIENT_NAME "GPS"
+
+//Globals defns
+static gps_location_callback gps_loc_cb = NULL;
+static gps_sv_status_callback gps_sv_cb = NULL;
+
+static void local_loc_cb(UlpLocation* location, void* locExt);
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt);
+
+static const GpsGeofencingInterface* get_geofence_interface(void);
+
+// Function declarations for sLocEngInterface
+static int loc_init(GpsCallbacks* callbacks);
+static int loc_start();
+static int loc_stop();
+static void loc_cleanup();
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_inject_location(double latitude, double longitude, float accuracy);
+static void loc_delete_aiding_data(GpsAidingData f);
+static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy,
+ uint32_t preferred_time);
+static const void* loc_get_extension(const char* name);
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_init,
+ loc_start,
+ loc_stop,
+ loc_cleanup,
+ loc_inject_time,
+ loc_inject_location,
+ loc_delete_aiding_data,
+ loc_set_position_mode,
+ loc_get_extension
+};
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_agps_init(AGpsCallbacks* callbacks);
+static int loc_agps_open(const char* apn);
+static int loc_agps_closed();
+static int loc_agps_open_failed();
+static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType);
+
+static const AGpsInterface sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface),
+ loc_agps_init,
+ loc_agps_open,
+ loc_agps_closed,
+ loc_agps_open_failed,
+ loc_agps_set_server,
+ loc_agps_open_with_apniptype
+};
+
+static int loc_xtra_init(GpsXtraCallbacks* callbacks);
+static int loc_xtra_inject_data(char* data, int length);
+
+static const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ loc_xtra_init,
+ loc_xtra_inject_data
+};
+
+static void loc_ni_init(GpsNiCallbacks *callbacks);
+static void loc_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+static const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_ni_init,
+ loc_ni_respond,
+};
+
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks);
+static void loc_gps_measurement_close();
+
+static const GpsMeasurementInterface sLocEngGpsMeasurementInterface =
+{
+ sizeof(GpsMeasurementInterface),
+ loc_gps_measurement_init,
+ loc_gps_measurement_close
+};
+
+// for XTRA
+static inline int createSocket() {
+ int socketFd = -1;
+
+ if ((socketFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ LOC_LOGe("create socket error. reason:%s", strerror(errno));
+
+ } else {
+ const char* socketPath = "/data/misc/location/xtra/socket_hal_xtra";
+ struct sockaddr_un addr = { .sun_family = AF_UNIX };
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socketPath);
+
+ if (::connect(socketFd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("cannot connect to XTRA. reason:%s", strerror(errno));
+ if (::close(socketFd)) {
+ LOC_LOGe("close socket error. reason:%s", strerror(errno));
+ }
+ socketFd = -1;
+ }
+ }
+
+ return socketFd;
+}
+
+static inline void closeSocket(const int socketFd) {
+ if (socketFd >= 0) {
+ if(::close(socketFd)) {
+ LOC_LOGe("close socket error. reason:%s", strerror(errno));
+ }
+ }
+}
+
+static inline bool sendConnectionEvent(const bool connected, const int8_t type) {
+ int socketFd = createSocket();
+ if (socketFd < 0) {
+ LOC_LOGe("XTRA unreachable. sending failed.");
+ return false;
+ }
+
+ std::stringstream ss;
+ ss << "connection";
+ ss << " " << (connected ? "1" : "0");
+ ss << " " << (int)type;
+ ss << "\n"; // append seperator
+
+ const std::string& data = ss.str();
+ int remain = data.length();
+ ssize_t sent = 0;
+
+ while (remain > 0 &&
+ (sent = ::send(socketFd, data.c_str() + (data.length() - remain),
+ remain, MSG_NOSIGNAL)) > 0) {
+ remain -= sent;
+ }
+
+ if (sent < 0) {
+ LOC_LOGe("sending error. reason:%s", strerror(errno));
+ }
+
+ closeSocket(socketFd);
+
+ return (remain == 0);
+}
+
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks );
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct);
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid);
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len);
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info);
+static void loc_agps_ril_update_network_availability(int avaiable, const char* apn);
+
+static const AGpsRilInterface sLocEngAGpsRilInterface =
+{
+ sizeof(AGpsRilInterface),
+ loc_agps_ril_init,
+ loc_agps_ril_set_ref_location,
+ loc_agps_ril_set_set_id,
+ loc_agps_ril_ni_message,
+ loc_agps_ril_update_network_state,
+ loc_agps_ril_update_network_availability
+};
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length);
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length);
+
+static const SuplCertificateInterface sLocEngAGpsCertInterface =
+{
+ sizeof(SuplCertificateInterface),
+ loc_agps_install_certificates,
+ loc_agps_revoke_certificates
+};
+
+static void loc_configuration_update(const char* config_data, int32_t length);
+
+static const GnssConfigurationInterface sLocEngConfigInterface =
+{
+ sizeof(GnssConfigurationInterface),
+ loc_configuration_update
+};
+
+static loc_eng_data_s_type loc_afw_data;
+static int gss_fd = -1;
+static int sGnssType = GNSS_UNKNOWN;
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ ENTRY_LOG_CALLFLOW();
+ const GpsInterface* ret_val;
+
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ loc_eng_read_config();
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ ret_val = NULL;
+ } else {
+ ret_val = &sLocEngInterface;
+ }
+
+ loc_eng_read_config();
+
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ unsigned int target = TARGET_DEFAULT;
+ loc_eng_read_config();
+
+ target = loc_get_target();
+ LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
+
+ sGnssType = getTargetGnssType(target);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ //APQ8064
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ gss_fd = open("/dev/gss", O_RDONLY);
+ if (gss_fd < 0) {
+ LOC_LOGE("GSS open failed: %s\n", strerror(errno));
+ }
+ else {
+ LOC_LOGD("GSS open success! CAPABILITIES %0lx\n",
+ gps_conf.CAPABILITIES);
+ }
+ break;
+ case GNSS_NONE:
+ //MPQ8064
+ LOC_LOGE("No GPS HW on this target. Not returning interface.");
+ return NULL;
+ case GNSS_QCA1530:
+ // qca1530 chip is present
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ LOC_LOGD("qca1530 present: CAPABILITIES %0lx\n", gps_conf.CAPABILITIES);
+ break;
+ }
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/Ax
+
+===========================================================================*/
+static int loc_init(GpsCallbacks* callbacks)
+{
+ int retVal = -1;
+ ENTRY_LOG();
+ LOC_API_ADAPTER_EVENT_MASK_T event;
+
+ if (NULL == callbacks) {
+ LOC_LOGE("loc_init failed. cb = NULL\n");
+ EXIT_LOG(%d, retVal);
+ return retVal;
+ }
+
+ event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT |
+ LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST |
+ LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+
+ LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */
+ callbacks->status_cb, /* status_cb */
+ local_sv_cb, /* sv_status_cb */
+ callbacks->nmea_cb, /* nmea_cb */
+ callbacks->set_capabilities_cb, /* set_capabilities_cb */
+ callbacks->acquire_wakelock_cb, /* acquire_wakelock_cb */
+ callbacks->release_wakelock_cb, /* release_wakelock_cb */
+ callbacks->create_thread_cb, /* create_thread_cb */
+ NULL, /* location_ext_parser */
+ NULL, /* sv_ext_parser */
+ callbacks->request_utc_time_cb, /* request_utc_time_cb */
+ callbacks->set_system_info_cb, /* set_system_info_cb */
+ callbacks->gnss_sv_status_cb, /* gnss_sv_status_cb */
+ };
+
+ gps_loc_cb = callbacks->location_cb;
+ gps_sv_cb = callbacks->sv_status_cb;
+
+ retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
+ loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities();
+ loc_afw_data.adapter->setGpsLockMsg(0);
+ loc_afw_data.adapter->requestUlp(ContextBase::getCarrierCapabilities());
+
+ if(retVal) {
+ LOC_LOGE("loc_eng_init() fail!");
+ goto err;
+ }
+
+ loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530);
+ loc_afw_data.adapter->setPowerVote(true);
+
+ LOC_LOGD("loc_eng_init() success!");
+
+err:
+ EXIT_LOG(%d, retVal);
+ return retVal;
+}
+
+/*===========================================================================
+FUNCTION loc_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_cleanup()
+{
+ ENTRY_LOG();
+
+ loc_afw_data.adapter->setPowerVote(false);
+ loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK);
+
+ loc_eng_cleanup(loc_afw_data);
+ gps_loc_cb = NULL;
+ gps_sv_cb = NULL;
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_start()
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_start(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_stop()
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ ret_val = loc_eng_stop(loc_afw_data);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_set_position_mode(GpsPositionMode mode,
+ GpsPositionRecurrence recurrence,
+ uint32_t min_interval,
+ uint32_t preferred_accuracy,
+ uint32_t preferred_time)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ LocPositionMode locMode;
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ locMode = LOC_POSITION_MODE_MS_BASED;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ locMode = LOC_POSITION_MODE_MS_ASSISTED;
+ break;
+ default:
+ locMode = LOC_POSITION_MODE_STANDALONE;
+ break;
+ }
+
+ LocPosMode params(locMode, recurrence, min_interval,
+ preferred_accuracy, preferred_time, NULL, NULL);
+ ret_val = loc_eng_set_position_mode(loc_afw_data, params);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG();
+ int ret_val = 0;
+
+ ret_val = loc_eng_inject_time(loc_afw_data, time,
+ timeReference, uncertainty);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_inject_location(double latitude, double longitude, float accuracy)
+{
+ ENTRY_LOG();
+
+ int ret_val = 0;
+ ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_delete_aiding_data(GpsAidingData f)
+{
+ ENTRY_LOG();
+
+#ifndef TARGET_BUILD_VARIANT_USER
+ loc_eng_delete_aiding_data(loc_afw_data, f);
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+const GpsGeofencingInterface* get_geofence_interface(void)
+{
+ ENTRY_LOG();
+ void *handle;
+ const char *error;
+ typedef const GpsGeofencingInterface* (*get_gps_geofence_interface_function) (void);
+ get_gps_geofence_interface_function get_gps_geofence_interface;
+ static const GpsGeofencingInterface* geofence_interface = NULL;
+
+ dlerror(); /* Clear any existing error */
+
+ handle = dlopen ("libgeofence.so", RTLD_NOW);
+
+ if (!handle)
+ {
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGE ("%s, dlopen for libgeofence.so failed, error = %s\n", __func__, error);
+ }
+ goto exit;
+ }
+ dlerror(); /* Clear any existing error */
+ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface");
+ if ((error = dlerror()) != NULL || NULL == get_gps_geofence_interface) {
+ LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error);
+ goto exit;
+ }
+
+ geofence_interface = get_gps_geofence_interface();
+
+exit:
+ EXIT_LOG(%d, geofence_interface == NULL);
+ return geofence_interface;
+}
+/*===========================================================================
+FUNCTION loc_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const void* loc_get_extension(const char* name)
+{
+ ENTRY_LOG();
+ const void* ret_val = NULL;
+
+ LOC_LOGD("%s:%d] For Interface = %s\n",__func__, __LINE__, name);
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsInterface;
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngNiInterface;
+ }
+ else if (strcmp(name, AGPS_RIL_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsRilInterface;
+ }
+ else if (strcmp(name, GPS_GEOFENCING_INTERFACE) == 0)
+ {
+ if ((gps_conf.CAPABILITIES | GPS_CAPABILITY_GEOFENCING) == gps_conf.CAPABILITIES ){
+ ret_val = get_geofence_interface();
+ }
+ }
+ else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngAGpsCertInterface;
+ }
+ else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngConfigInterface;
+ }
+ else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0)
+ {
+ ret_val = &sLocEngGpsMeasurementInterface;
+ }
+ else
+ {
+ LOC_LOGE ("get_extension: Invalid interface passed in\n");
+ }
+ EXIT_LOG(%p, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_init(AGpsCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_agps_init(loc_afw_data, (AGpsExtCallbacks*)callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open(const char* apn)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType = AGPS_APN_BEARER_IPV4;
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_with_apniptype
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType;
+
+ switch (apnIpType) {
+ case APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_closed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_closed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_agps_open_failed()
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ int ret_val = loc_eng_agps_open_failed(loc_afw_data, agpsType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_agps_set_server
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ LocServerType serverType;
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ break;
+ case AGPS_TYPE_C2K:
+ serverType = LOC_AGPS_CDMA_PDE_SERVER;
+ break;
+ default:
+ serverType = LOC_AGPS_SUPL_SERVER;
+ }
+ int ret_val = loc_eng_set_server_proxy(loc_afw_data, serverType, hostname, port);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTIONf571
+ loc_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_init(GpsXtraCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ GpsXtraExtCallbacks extCallbacks;
+ memset(&extCallbacks, 0, sizeof(extCallbacks));
+ extCallbacks.download_request_cb = callbacks->download_request_cb;
+ int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+
+/*===========================================================================
+FUNCTION loc_xtra_inject_data
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_xtra_inject_data(char* data, int length)
+{
+ ENTRY_LOG();
+ int ret_val = -1;
+ if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE))
+ ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length);
+ else
+ LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d",
+ __func__, data, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_init
+
+DESCRIPTION
+ This function initializes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_gps_measurement_init(loc_afw_data,
+ callbacks);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_gps_measurement_close
+
+DESCRIPTION
+ This function closes the gps measurement interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_gps_measurement_close()
+{
+ ENTRY_LOG();
+ loc_eng_gps_measurement_close(loc_afw_data);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_init(GpsNiCallbacks *callbacks)
+{
+ ENTRY_LOG();
+ loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG();
+ loc_eng_ni_respond(loc_afw_data, notif_id, user_response);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+// Below stub functions are members of sLocEngAGpsRilInterface
+static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ) {}
+static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct) {}
+static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid) {}
+static void loc_agps_ril_ni_message(uint8_t *msg, size_t len) {}
+static void loc_agps_ril_update_network_state(int connected, int type, int roaming, const char* extra_info) {
+ ENTRY_LOG();
+ // for XTRA
+ sendConnectionEvent((connected != 0) ? true : false, type);
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_agps_ril_update_network_availability(int available, const char* apn)
+{
+ ENTRY_LOG();
+ char baseband[PROPERTY_VALUE_MAX];
+ property_get("ro.baseband", baseband, "msm");
+ if (strcmp(baseband, "csfb") == 0)
+ {
+ loc_eng_agps_ril_update_network_availability(loc_afw_data, available, apn);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_agps_install_certificates(const DerEncodedCertificate* certificates,
+ size_t length)
+{
+ ENTRY_LOG();
+ int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length);
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints,
+ size_t length)
+{
+ ENTRY_LOG();
+ LOC_LOGE("%s:%d]: agps_revoke_certificates not supported");
+ int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static void loc_configuration_update(const char* config_data, int32_t length)
+{
+ ENTRY_LOG();
+ loc_eng_configuration_update(loc_afw_data, config_data, length);
+ switch (sGnssType)
+ {
+ case GNSS_GSS:
+ case GNSS_AUTO:
+ case GNSS_QCA1530:
+ //APQ
+ gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ break;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_loc_cb(UlpLocation* location, void* locExt)
+{
+ ENTRY_LOG();
+ if (NULL != location) {
+ CALLBACK_LOG_CALLFLOW("location_cb - from", %d, location->position_source);
+
+ if (NULL != gps_loc_cb) {
+ gps_loc_cb(&location->gpsLocation);
+ }
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void local_sv_cb(GpsSvStatus* sv_status, void* svExt)
+{
+ ENTRY_LOG();
+ if (NULL != gps_sv_cb) {
+ CALLBACK_LOG_CALLFLOW("sv_status_cb -", %d, sv_status->num_svs);
+ gps_sv_cb(sv_status);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc.h b/msm8996/loc_api/libloc_api_50001/loc.h
new file mode 100644
index 0000000..02ca538
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc.h
@@ -0,0 +1,68 @@
+/* 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 __LOC_H__
+#define __LOC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <ctype.h>
+#include <cutils/properties.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+
+#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/
+
+typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt);
+typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt);
+typedef void* (*loc_ext_parser)(void* data);
+
+typedef struct {
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_create_thread create_thread_cb;
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+ gps_request_utc_time request_utc_time_cb;
+ gnss_set_system_info set_system_info_cb;
+ gnss_sv_status_callback gnss_sv_status_cb;
+} LocCallbacks;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif //__LOC_H__
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng.cpp
new file mode 100644
index 0000000..e4e2344
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng.cpp
@@ -0,0 +1,3056 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netdb.h>
+#include <time.h>
+#include <new>
+#include <LocEngAdapter.h>
+
+#include <cutils/sched_policy.h>
+#ifndef USE_GLIB
+#include <utils/SystemClock.h>
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+#include <glib.h>
+#include <sys/syscall.h>
+#endif /* USE_GLIB */
+
+#include <string.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_dmn_conn.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_msg.h>
+#include <loc_eng_nmea.h>
+#include <msg_q.h>
+#include <loc.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_core_log.h"
+#include "loc_eng_log.h"
+
+#define SUCCESS TRUE
+#define FAILURE FALSE
+
+#ifndef GPS_CONF_FILE
+#define GPS_CONF_FILE "/etc/gps.conf" //??? platform independent
+#endif
+
+#ifndef SAP_CONF_FILE
+#define SAP_CONF_FILE "/etc/sap.conf"
+#endif
+
+#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net"
+
+using namespace loc_core;
+
+boolean configAlreadyRead = false;
+unsigned int agpsStatus = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type gps_conf_table[] =
+{
+ {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'},
+ {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'},
+ {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
+ {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
+ {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'},
+ {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'},
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'},
+ {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'},
+ {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'},
+ {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'},
+ {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'},
+ {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'},
+ {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'},
+ {"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
+};
+
+static const loc_param_s_type sap_conf_table[] =
+{
+ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'},
+ {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"RATE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, NULL, 'n'},
+ {"SENSOR_ACCEL_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_BATCHES_PER_SEC_HIGH", &sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, NULL, 'n'},
+ {"SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH", &sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, NULL, 'n'},
+ {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
+ {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'}
+};
+
+static void loc_default_parameters(void)
+{
+ /*Defaults for gps.conf*/
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.NMEA_PROVIDER = 0;
+ gps_conf.GPS_LOCK = 0;
+ gps_conf.SUPL_VER = 0x10000;
+ gps_conf.SUPL_MODE = 0x3;
+ gps_conf.CAPABILITIES = 0x7;
+ /* LTE Positioning Profile configuration is disable by default*/
+ gps_conf.LPP_PROFILE = 0;
+ /*By default no positioning protocol is selected on A-GLONASS system*/
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0;
+ /*XTRA version check is disabled by default*/
+ gps_conf.XTRA_VERSION_CHECK=0;
+ /*Use emergency PDN by default*/
+ gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1;
+
+ /*Defaults for sap.conf*/
+ sap_conf.GYRO_BIAS_RANDOM_WALK = 0;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC = 2;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH = 5;
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH = 4;
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH = 25;
+ sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */
+ sap_conf.SENSOR_USAGE = 0; /* Enabled */
+ sap_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 */
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0;
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0;
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0;
+ /* default provider is SSC */
+ sap_conf.SENSOR_PROVIDER = 1;
+
+ /* None of the 10 slots for agps certificates are writable by default */
+ gps_conf.AGPS_CERT_WRITABLE_MASK = 0;
+}
+
+// 2nd half of init(), singled out for
+// modem restart to use.
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
+
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+// Internal functions
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_report_status(loc_eng_data_s_type &loc_eng_data,
+ GpsStatusValue status);
+static void loc_eng_process_conn_request(loc_eng_data_s_type &loc_eng_data,
+ int connHandle, AGpsType agps_type);
+static void loc_eng_agps_close_status(loc_eng_data_s_type &loc_eng_data, int is_succ);
+static void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data) ;
+static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ;
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data);
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data);
+static void deleteAidingData(loc_eng_data_s_type &logEng);
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType);
+static int dataCallCb(void *cb_data);
+static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) {
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ loc_eng_data.adapter->deleteAidingData(loc_eng_data.aiding_data_for_deletion);
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+}
+
+static void* noProc(void* data)
+{
+ return NULL;
+}
+
+/*********************************************************************
+ * definitions of the static messages used in the file
+ *********************************************************************/
+// case LOC_ENG_MSG_REQUEST_NI:
+LocEngRequestNi::LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data) :
+ LocMsg(), mLocEng(locEng), mNotify(notif), mPayload(data) {
+ locallog();
+}
+void LocEngRequestNi::proc() const {
+ loc_eng_ni_request_handler(*((loc_eng_data_s_type*)mLocEng),
+ &mNotify, mPayload);
+}
+void LocEngRequestNi::locallog() const
+{
+ LOC_LOGV("id: %d\n type: %s\n flags: %d\n time out: %d\n "
+ "default response: %s\n requestor id encoding: %s\n"
+ " text encoding: %s\n passThroughData: %p",
+ mNotify.notification_id,
+ loc_get_ni_type_name(mNotify.ni_type),
+ mNotify.notify_flags,
+ mNotify.timeout,
+ loc_get_ni_response_name(mNotify.default_response),
+ loc_get_ni_encoding_name(mNotify.requestor_id_encoding),
+ loc_get_ni_encoding_name(mNotify.text_encoding),
+ mPayload);
+}
+inline void LocEngRequestNi::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_INFORM_NI_RESPONSE:
+// in loc_eng_ni.cpp
+
+// case LOC_ENG_MSG_START_FIX:
+LocEngStartFix::LocEngStartFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStartFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_start_handler(*locEng);
+}
+inline void LocEngStartFix::locallog() const
+{
+ LOC_LOGV("LocEngStartFix");
+}
+inline void LocEngStartFix::log() const
+{
+ locallog();
+}
+void LocEngStartFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_STOP_FIX:
+LocEngStopFix::LocEngStopFix(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngStopFix::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_stop_handler(*locEng);
+}
+inline void LocEngStopFix::locallog() const
+{
+ LOC_LOGV("LocEngStopFix");
+}
+inline void LocEngStopFix::log() const
+{
+ locallog();
+}
+void LocEngStopFix::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_SET_POSITION_MODE:
+LocEngPositionMode::LocEngPositionMode(LocEngAdapter* adapter,
+ LocPosMode &mode) :
+ LocMsg(), mAdapter(adapter), mPosMode(mode)
+{
+ mPosMode.logv();
+}
+inline void LocEngPositionMode::proc() const {
+ mAdapter->setPositionMode(&mPosMode);
+}
+inline void LocEngPositionMode::log() const {
+ mPosMode.logv();
+}
+void LocEngPositionMode::send() const {
+ mAdapter->sendMsg(this);
+}
+
+LocEngGetZpp::LocEngGetZpp(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+{
+ locallog();
+}
+inline void LocEngGetZpp::proc() const
+{
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner();
+ loc_eng_get_zpp_handler(*locEng);
+}
+inline void LocEngGetZpp::locallog() const
+{
+ LOC_LOGV("LocEngGetZpp");
+}
+inline void LocEngGetZpp::log() const
+{
+ locallog();
+}
+void LocEngGetZpp::send() const {
+ mAdapter->sendMsg(this);
+}
+
+struct LocEngSetTime : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUtcTime mTime;
+ const int64_t mTimeReference;
+ const int mUncertainty;
+ inline LocEngSetTime(LocEngAdapter* adapter,
+ GpsUtcTime t, int64_t tf, int unc) :
+ LocMsg(), mAdapter(adapter),
+ mTime(t), mTimeReference(tf), mUncertainty(unc)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setTime(mTime, mTimeReference, mUncertainty);
+ }
+ inline void locallog() const {
+ LOC_LOGV("time: %lld\n timeReference: %lld\n uncertainty: %d",
+ mTime, mTimeReference, mUncertainty);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+ // case LOC_ENG_MSG_INJECT_LOCATION:
+struct LocEngInjectLocation : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const double mLatitude;
+ const double mLongitude;
+ const float mAccuracy;
+ inline LocEngInjectLocation(LocEngAdapter* adapter,
+ double lat, double lon, float accur) :
+ LocMsg(), mAdapter(adapter),
+ mLatitude(lat), mLongitude(lon), mAccuracy(accur)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ inline void locallog() const {
+ LOC_LOGV("latitude: %f\n longitude: %f\n accuracy: %f",
+ mLatitude, mLongitude, mAccuracy);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_IPV4:
+struct LocEngSetServerIpv4 : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned int mNlAddr;
+ const int mPort;
+ const LocServerType mServerType;
+ inline LocEngSetServerIpv4(LocEngAdapter* adapter,
+ unsigned int ip,
+ int port,
+ LocServerType type) :
+ LocMsg(), mAdapter(adapter),
+ mNlAddr(ip), mPort(port), mServerType(type)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mNlAddr, mPort, mServerType);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s",
+ mNlAddr, mPort, loc_get_server_type_name(mServerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SERVER_URL:
+struct LocEngSetServerUrl : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLen;
+ char* mUrl;
+ inline LocEngSetServerUrl(LocEngAdapter* adapter,
+ char* urlString,
+ int url_len) :
+ LocMsg(), mAdapter(adapter),
+ mLen(url_len), mUrl(new char[mLen+1])
+ {
+ memcpy((void*)mUrl, (void*)urlString, url_len);
+ mUrl[mLen] = 0;
+ locallog();
+ }
+ inline ~LocEngSetServerUrl()
+ {
+ delete[] mUrl;
+ }
+ inline virtual void proc() const {
+ mAdapter->setServer(mUrl, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_A_GLONASS_PROTOCOL:
+struct LocEngAGlonassProtocol : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const unsigned long mAGlonassProtocl;
+ inline LocEngAGlonassProtocol(LocEngAdapter* adapter,
+ unsigned long protocol) :
+ LocMsg(), mAdapter(adapter), mAGlonassProtocl(protocol)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setAGLONASSProtocol(mAGlonassProtocl);
+ }
+ inline void locallog() const {
+ LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SUPL_VERSION:
+struct LocEngSuplVer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSuplVer;
+ inline LocEngSuplVer(LocEngAdapter* adapter,
+ int suplVer) :
+ LocMsg(), mAdapter(adapter), mSuplVer(suplVer)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSUPLVersion(mSuplVer);
+ }
+ inline void locallog() const {
+ LOC_LOGV("SUPL Version: %d", mSuplVer);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSuplMode : public LocMsg {
+ UlpProxyBase* mUlp;
+
+ inline LocEngSuplMode(UlpProxyBase* ulp) :
+ LocMsg(), mUlp(ulp)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mUlp->setCapabilities(ContextBase::getCarrierCapabilities());
+ }
+ inline void locallog() const {
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LPP_CONFIG:
+struct LocEngLppConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mLppConfig;
+ inline LocEngLppConfig(LocEngAdapter* adapter,
+ int lppConfig) :
+ LocMsg(), mAdapter(adapter), mLppConfig(lppConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setLPPConfig(mLppConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_CONTROL_CONFIG:
+struct LocEngSensorControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mSensorsDisabled;
+ const int mSensorProvider;
+ inline LocEngSensorControlConfig(LocEngAdapter* adapter,
+ int sensorsDisabled, int sensorProvider) :
+ LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled),
+ mSensorProvider(sensorProvider)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d",
+ mSensorsDisabled, mSensorProvider);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PROPERTIES:
+struct LocEngSensorProperties : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const bool mGyroBiasVarianceRandomWalkValid;
+ const float mGyroBiasVarianceRandomWalk;
+ const bool mAccelRandomWalkValid;
+ const float mAccelRandomWalk;
+ const bool mAngleRandomWalkValid;
+ const float mAngleRandomWalk;
+ const bool mRateRandomWalkValid;
+ const float mRateRandomWalk;
+ const bool mVelocityRandomWalkValid;
+ const float mVelocityRandomWalk;
+ inline LocEngSensorProperties(LocEngAdapter* adapter,
+ bool gyroBiasRandomWalk_valid,
+ float gyroBiasRandomWalk,
+ bool accelRandomWalk_valid,
+ float accelRandomWalk,
+ bool angleRandomWalk_valid,
+ float angleRandomWalk,
+ bool rateRandomWalk_valid,
+ float rateRandomWalk,
+ bool velocityRandomWalk_valid,
+ float velocityRandomWalk) :
+ LocMsg(), mAdapter(adapter),
+ mGyroBiasVarianceRandomWalkValid(gyroBiasRandomWalk_valid),
+ mGyroBiasVarianceRandomWalk(gyroBiasRandomWalk),
+ mAccelRandomWalkValid(accelRandomWalk_valid),
+ mAccelRandomWalk(accelRandomWalk),
+ mAngleRandomWalkValid(angleRandomWalk_valid),
+ mAngleRandomWalk(angleRandomWalk),
+ mRateRandomWalkValid(rateRandomWalk_valid),
+ mRateRandomWalk(rateRandomWalk),
+ mVelocityRandomWalkValid(velocityRandomWalk_valid),
+ mVelocityRandomWalk(velocityRandomWalk)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorProperties(mGyroBiasVarianceRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalkValid,
+ mAccelRandomWalk,
+ mAngleRandomWalkValid,
+ mAngleRandomWalk,
+ mRateRandomWalkValid,
+ mRateRandomWalk,
+ mVelocityRandomWalkValid,
+ mVelocityRandomWalk);
+ }
+ inline void locallog() const {
+ LOC_LOGV("Sensor properties validity, Gyro Random walk: %d "
+ "Accel Random Walk: %d "
+ "Angle Random Walk: %d Rate Random Walk: %d "
+ "Velocity Random Walk: %d\n"
+ "Sensor properties, Gyro Random walk: %f "
+ "Accel Random Walk: %f "
+ "Angle Random Walk: %f Rate Random Walk: %f "
+ "Velocity Random Walk: %f",
+ mGyroBiasVarianceRandomWalkValid,
+ mAccelRandomWalkValid,
+ mAngleRandomWalkValid,
+ mRateRandomWalkValid,
+ mVelocityRandomWalkValid,
+ mGyroBiasVarianceRandomWalk,
+ mAccelRandomWalk,
+ mAngleRandomWalk,
+ mRateRandomWalk,
+ mVelocityRandomWalk
+ );
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_SET_SENSOR_PERF_CONTROL_CONFIG:
+struct LocEngSensorPerfControlConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mControlMode;
+ const int mAccelSamplesPerBatch;
+ const int mAccelBatchesPerSec;
+ const int mGyroSamplesPerBatch;
+ const int mGyroBatchesPerSec;
+ const int mAccelSamplesPerBatchHigh;
+ const int mAccelBatchesPerSecHigh;
+ const int mGyroSamplesPerBatchHigh;
+ const int mGyroBatchesPerSecHigh;
+ const int mAlgorithmConfig;
+ inline LocEngSensorPerfControlConfig(LocEngAdapter* adapter,
+ int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig) :
+ LocMsg(), mAdapter(adapter),
+ mControlMode(controlMode),
+ mAccelSamplesPerBatch(accelSamplesPerBatch),
+ mAccelBatchesPerSec(accelBatchesPerSec),
+ mGyroSamplesPerBatch(gyroSamplesPerBatch),
+ mGyroBatchesPerSec(gyroBatchesPerSec),
+ mAccelSamplesPerBatchHigh(accelSamplesPerBatchHigh),
+ mAccelBatchesPerSecHigh(accelBatchesPerSecHigh),
+ mGyroSamplesPerBatchHigh(gyroSamplesPerBatchHigh),
+ mGyroBatchesPerSecHigh(gyroBatchesPerSecHigh),
+ mAlgorithmConfig(algorithmConfig)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setSensorPerfControlConfig(mControlMode,
+ mAccelSamplesPerBatch,
+ mAccelBatchesPerSec,
+ mGyroSamplesPerBatch,
+ mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh,
+ mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh,
+ mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline void locallog() const {
+ LOC_LOGV("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",
+ mControlMode,
+ mAccelSamplesPerBatch, mAccelBatchesPerSec,
+ mGyroSamplesPerBatch, mGyroBatchesPerSec,
+ mAccelSamplesPerBatchHigh, mAccelBatchesPerSecHigh,
+ mGyroSamplesPerBatchHigh, mGyroBatchesPerSecHigh,
+ mAlgorithmConfig);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_EXT_POWER_CONFIG:
+struct LocEngExtPowerConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mIsBatteryCharging;
+ inline LocEngExtPowerConfig(LocEngAdapter* adapter,
+ int isBatteryCharging) :
+ LocMsg(), mAdapter(adapter),
+ mIsBatteryCharging(isBatteryCharging)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->setExtPowerConfig(mIsBatteryCharging);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d",
+ mIsBatteryCharging);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_POSITION:
+LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology) :
+ LocMsg(), mAdapter(adapter), mLocation(loc),
+ mLocationExtended(locExtended),
+ mLocationExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->location_ext_parser(locExt)),
+ mStatus(st), mTechMask(technology)
+{
+ locallog();
+}
+void LocEngReportPosition::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) {
+ bool reported = false;
+ if (locEng->location_cb != NULL) {
+ if (LOC_SESS_FAILURE == mStatus) {
+ // in case we want to handle the failure case
+ locEng->location_cb(NULL, NULL);
+ reported = true;
+ }
+ // what's in the else if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ else if ((LOC_SESS_SUCCESS == mStatus &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID) &
+ mTechMask)) ||
+ (LOC_SESS_INTERMEDIATE == locEng->intermediateFix &&
+ !((mLocation.gpsLocation.flags &
+ GPS_LOCATION_HAS_ACCURACY) &&
+ (gps_conf.ACCURACY_THRES != 0) &&
+ (mLocation.gpsLocation.accuracy >
+ gps_conf.ACCURACY_THRES)))) {
+ locEng->location_cb((UlpLocation*)&(mLocation),
+ (void*)mLocationExt);
+ reported = true;
+ }
+ }
+
+ // if we have reported this fix
+ if (reported &&
+ // and if this is a singleshot
+ GPS_POSITION_RECURRENCE_SINGLE ==
+ locEng->adapter->getPositionMode().recurrence) {
+ if (LOC_SESS_INTERMEDIATE == mStatus) {
+ // modem could be still working for a final fix,
+ // although we no longer need it. So stopFix().
+ locEng->adapter->stopFix();
+ }
+ // turn off the session flag.
+ locEng->adapter->setInSession(false);
+ }
+
+ LOC_LOGV("LocEngReportPosition::proc() - generateNmea: %d, position source: %d, "
+ "engine_status: %d, isInSession: %d",
+ locEng->generateNmea, mLocation.position_source,
+ locEng->engine_status, locEng->adapter->isInSession());
+
+ if (locEng->generateNmea &&
+ locEng->adapter->isInSession())
+ {
+ unsigned char generate_nmea = reported &&
+ (mStatus != LOC_SESS_FAILURE);
+ loc_eng_nmea_generate_pos(locEng, mLocation, mLocationExtended,
+ generate_nmea);
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(mLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+ }
+}
+void LocEngReportPosition::locallog() const {
+ LOC_LOGV("LocEngReportPosition");
+}
+void LocEngReportPosition::log() const {
+ locallog();
+}
+void LocEngReportPosition::send() const {
+ mAdapter->sendMsg(this);
+}
+
+
+// case LOC_ENG_MSG_REPORT_SV:
+LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter,
+ GnssSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExt) :
+ LocMsg(), mAdapter(adapter), mSvStatus(sv),
+ mLocationExtended(locExtended),
+ mSvExt(((loc_eng_data_s_type*)
+ ((LocEngAdapter*)
+ (mAdapter))->getOwner())->sv_ext_parser(svExt))
+{
+ locallog();
+}
+void LocEngReportSv::proc() const {
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gnss_sv_status_cb != NULL) {
+ locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus));
+ }
+
+ if (locEng->generateNmea)
+ {
+ loc_eng_nmea_generate_sv(locEng, mSvStatus, mLocationExtended);
+ }
+ }
+}
+void LocEngReportSv::locallog() const {
+ LOC_LOGV("%s:%d] LocEngReportSv",__func__, __LINE__);
+}
+inline void LocEngReportSv::log() const {
+ locallog();
+}
+void LocEngReportSv::send() const {
+ mAdapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REPORT_STATUS:
+LocEngReportStatus::LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus) :
+ LocMsg(), mAdapter(adapter), mStatus(engineStatus)
+{
+ locallog();
+}
+inline void LocEngReportStatus::proc() const
+{
+ LocEngAdapter* adapter = (LocEngAdapter*)mAdapter;
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner();
+
+ loc_eng_report_status(*locEng, mStatus);
+ update_aiding_data_for_deletion(*locEng);
+}
+inline void LocEngReportStatus::locallog() const {
+ LOC_LOGV("LocEngReportStatus");
+}
+inline void LocEngReportStatus::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_NMEA:
+LocEngReportNmea::LocEngReportNmea(void* locEng,
+ const char* data, int len) :
+ LocMsg(), mLocEng(locEng), mNmea(new char[len]), mLen(len)
+{
+ memcpy((void*)mNmea, (void*)data, len);
+ locallog();
+}
+void LocEngReportNmea::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+
+ if (locEng->nmea_cb != NULL)
+ locEng->nmea_cb(now, mNmea, mLen);
+}
+inline void LocEngReportNmea::locallog() const {
+ LOC_LOGV("LocEngReportNmea");
+}
+inline void LocEngReportNmea::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REPORT_XTRA_SERVER:
+LocEngReportXtraServer::LocEngReportXtraServer(void* locEng,
+ const char *url1,
+ const char *url2,
+ const char *url3,
+ const int maxlength) :
+ LocMsg(), mLocEng(locEng), mMaxLen(maxlength),
+ mServers(new char[3*(mMaxLen+1)])
+{
+ char * cptr = mServers;
+ memset(mServers, 0, 3*(mMaxLen+1));
+
+ // Override modem URLs with uncommented gps.conf urls
+ if( gps_conf.XTRA_SERVER_1[0] != '\0' ) {
+ url1 = &gps_conf.XTRA_SERVER_1[0];
+ }
+ if( gps_conf.XTRA_SERVER_2[0] != '\0' ) {
+ url2 = &gps_conf.XTRA_SERVER_2[0];
+ }
+ if( gps_conf.XTRA_SERVER_3[0] != '\0' ) {
+ url3 = &gps_conf.XTRA_SERVER_3[0];
+ }
+ // copy non xtra1.gpsonextra.net URLs into the forwarding buffer.
+ if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url1, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url2, mMaxLen + 1);
+ cptr += mMaxLen + 1;
+ }
+ if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) {
+ strlcpy(cptr, url3, mMaxLen + 1);
+ }
+ locallog();
+}
+
+void LocEngReportXtraServer::proc() const {
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->report_xtra_server_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("report_xtra_server_cb", %s, mServers);
+ locEngXtra->report_xtra_server_cb(mServers,
+ &(mServers[mMaxLen+1]),
+ &(mServers[(mMaxLen+1)<<1]));
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngReportXtraServer::locallog() const {
+ LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n"
+ " server3: %s\n",
+ mServers, &mServers[mMaxLen+1], &mServers[(mMaxLen+1)<<1]);
+}
+inline void LocEngReportXtraServer::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_BIT:
+// case LOC_ENG_MSG_RELEASE_BIT:
+LocEngReqRelBIT::LocEngReqRelBIT(void* locEng, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mIPv4Addr(ipv4),
+ mIPv6Addr(ipv6 ? new char[16] : NULL), mIsReq(isReq) {
+ if (NULL != ipv6)
+ memcpy(mIPv6Addr, ipv6, 16);
+ locallog();
+}
+inline LocEngReqRelBIT::~LocEngReqRelBIT() {
+ if (mIPv6Addr) {
+ delete[] mIPv6Addr;
+ }
+}
+void LocEngReqRelBIT::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ BITSubscriber s(getAgpsStateMachine(*locEng, mType),
+ mIPv4Addr, mIPv6Addr);
+ AgpsStateMachine* sm = (AgpsStateMachine*)s.mStateMachine;
+
+ if (mIsReq) {
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ sm->unsubscribeRsrc((Subscriber*)&s);
+ }
+}
+inline void LocEngReqRelBIT::locallog() const {
+ LOC_LOGV("LocEngRequestBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)mIPv4Addr,
+ (unsigned char)(mIPv4Addr>>8),
+ (unsigned char)(mIPv4Addr>>16),
+ (unsigned char)(mIPv4Addr>>24),
+ NULL != mIPv6Addr ? mIPv6Addr : "");
+}
+inline void LocEngReqRelBIT::log() const {
+ locallog();
+}
+void LocEngReqRelBIT::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_RELEASE_BIT:
+struct LocEngReleaseBIT : public LocMsg {
+ const BITSubscriber mSubscriber;
+ inline LocEngReleaseBIT(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ LocMsg(),
+ mSubscriber(stateMachine, ipv4, ipv6)
+ {
+ locallog();
+ }
+ inline virtual void proc() const
+ {
+ AgpsStateMachine* sm = (AgpsStateMachine*)mSubscriber.mStateMachine;
+ sm->unsubscribeRsrc((Subscriber*)&mSubscriber);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngReleaseBIT - ipv4: %d.%d.%d.%d, ipv6: %s",
+ (unsigned char)(mSubscriber.ID>>24),
+ (unsigned char)(mSubscriber.ID>>16),
+ (unsigned char)(mSubscriber.ID>>8),
+ (unsigned char)mSubscriber.ID,
+ NULL != mSubscriber.mIPv6Addr ? mSubscriber.mIPv6Addr : "");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// LocEngSuplEsOpened
+LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsOpened::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_GRANTED);
+ }
+}
+void LocEngSuplEsOpened::locallog() const {
+ LOC_LOGV("LocEngSuplEsOpened");
+}
+void LocEngSuplEsOpened::log() const {
+ locallog();
+}
+
+// LocEngSuplEsClosed
+LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+void LocEngSuplEsClosed::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ sm->onRsrcEvent(RSRC_RELEASED);
+ }
+}
+void LocEngSuplEsClosed::locallog() const {
+ LOC_LOGV("LocEngSuplEsClosed");
+}
+void LocEngSuplEsClosed::log() const {
+ locallog();
+}
+
+
+// case LOC_ENG_MSG_REQUEST_SUPL_ES:
+LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngRequestSuplEs::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->ds_nif) {
+ AgpsStateMachine* sm = locEng->ds_nif;
+ DSSubscriber s(sm, mID);
+ sm->subscribeRsrc((Subscriber*)&s);
+ }
+ else if (locEng->agnss_nif) {
+ AgpsStateMachine *sm = locEng->agnss_nif;
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ false);
+ sm->subscribeRsrc((Subscriber*)&s);
+ LOC_LOGD("%s:%d]: Using regular ATL for SUPL ES", __func__, __LINE__);
+ }
+ else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1);
+ }
+}
+inline void LocEngRequestSuplEs::locallog() const {
+ LOC_LOGV("LocEngRequestSuplEs");
+}
+inline void LocEngRequestSuplEs::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_ATL:
+LocEngRequestATL::LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type) :
+ LocMsg(), mLocEng(locEng), mID(id), mType(agps_type) {
+ locallog();
+}
+void LocEngRequestATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ AgpsStateMachine* sm = (AgpsStateMachine*)
+ getAgpsStateMachine(*locEng, mType);
+ if (sm) {
+ ATLSubscriber s(mID,
+ sm,
+ locEng->adapter,
+ AGPS_TYPE_INVALID == mType);
+ sm->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngRequestATL::locallog() const {
+ LOC_LOGV("LocEngRequestATL");
+}
+inline void LocEngRequestATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_RELEASE_ATL:
+LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) :
+ LocMsg(), mLocEng(locEng), mID(id) {
+ locallog();
+}
+void LocEngReleaseATL::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+
+ if (locEng->agnss_nif) {
+ ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false);
+ if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->internet_nif) {
+ ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false);
+ if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from internet_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ if (locEng->ds_nif) {
+ DSSubscriber s3(locEng->ds_nif, mID);
+ if (locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) {
+ LOC_LOGD("%s:%d]: Unsubscribed from ds_nif",
+ __func__, __LINE__);
+ return;
+ }
+ }
+
+ LOC_LOGW("%s:%d]: Could not release ATL. "
+ "No subscribers found\n",
+ __func__, __LINE__);
+ locEng->adapter->atlCloseStatus(mID, 0);
+}
+inline void LocEngReleaseATL::locallog() const {
+ LOC_LOGV("LocEngReleaseATL");
+}
+inline void LocEngReleaseATL::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_WIFI:
+// case LOC_ENG_MSG_RELEASE_WIFI:
+LocEngReqRelWifi::LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq) :
+ LocMsg(), mLocEng(locEng), mType(type), mSenderId(sender_id),
+ mSSID(NULL == s ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == p ? NULL : new char[SSID_BUF_SIZE]),
+ mIsReq(isReq) {
+ if (NULL != s)
+ strlcpy(mSSID, s, SSID_BUF_SIZE);
+ if (NULL != p)
+ strlcpy(mPassword, p, SSID_BUF_SIZE);
+ locallog();
+}
+LocEngReqRelWifi::~LocEngReqRelWifi() {
+ if (NULL != mSSID) {
+ delete[] mSSID;
+ }
+ if (NULL != mPassword) {
+ delete[] mPassword;
+ }
+}
+void LocEngReqRelWifi::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (locEng->wifi_nif) {
+ WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId);
+ if (mIsReq) {
+ locEng->wifi_nif->subscribeRsrc((Subscriber*)&s);
+ } else {
+ locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s);
+ }
+ } else {
+ locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType);
+ }
+}
+inline void LocEngReqRelWifi::locallog() const {
+ LOC_LOGV("%s - senderId: %d, ssid: %s, password: %s",
+ mIsReq ? "LocEngRequestWifi" : "LocEngReleaseWifi",
+ mSenderId,
+ NULL != mSSID ? mSSID : "",
+ NULL != mPassword ? mPassword : "");
+}
+inline void LocEngReqRelWifi::log() const {
+ locallog();
+}
+void LocEngReqRelWifi::send() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ locEng->adapter->sendMsg(this);
+}
+
+// case LOC_ENG_MSG_REQUEST_XTRA_DATA:
+LocEngRequestXtra::LocEngRequestXtra(void* locEng) :
+ mLocEng(locEng) {
+ locallog();
+}
+void LocEngRequestXtra::proc() const
+{
+ loc_eng_xtra_data_s_type* locEngXtra =
+ &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data);
+
+ if (locEngXtra->download_request_cb != NULL) {
+ CALLBACK_LOG_CALLFLOW("download_request_cb", %p, mLocEng);
+ locEngXtra->download_request_cb();
+ } else {
+ LOC_LOGE("Callback function for request xtra is NULL");
+ }
+}
+inline void LocEngRequestXtra::locallog() const {
+ LOC_LOGV("LocEngReqXtra");
+}
+inline void LocEngRequestXtra::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_REQUEST_TIME:
+LocEngRequestTime::LocEngRequestTime(void* locEng) :
+ LocMsg(), mLocEng(locEng)
+{
+ locallog();
+}
+void LocEngRequestTime::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ if (gps_conf.CAPABILITIES & GPS_CAPABILITY_ON_DEMAND_TIME) {
+ if (locEng->request_utc_time_cb != NULL) {
+ locEng->request_utc_time_cb();
+ } else {
+ LOC_LOGE("Callback function for request time is NULL");
+ }
+ }
+}
+inline void LocEngRequestTime::locallog() const {
+ LOC_LOGV("LocEngReqTime");
+}
+inline void LocEngRequestTime::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_DELETE_AIDING_DATA:
+struct LocEngDelAidData : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ const GpsAidingData mType;
+ inline LocEngDelAidData(loc_eng_data_s_type* locEng,
+ GpsAidingData f) :
+ LocMsg(), mLocEng(locEng), mType(f)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocEng->aiding_data_for_deletion = mType;
+ update_aiding_data_for_deletion(*mLocEng);
+ }
+ inline void locallog() const {
+ LOC_LOGV("aiding data msak %d", mType);
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENABLE_DATA:
+struct LocEngEnableData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const int mEnable;
+ char* mAPN;
+ const int mLen;
+ inline LocEngEnableData(LocEngAdapter* adapter,
+ const char* name, int len, int enable) :
+ LocMsg(), mAdapter(adapter),
+ mEnable(enable), mAPN(NULL), mLen(len)
+ {
+ if (NULL != name) {
+ mAPN = new char[len+1];
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ }
+ locallog();
+ }
+ inline ~LocEngEnableData() {
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ }
+ }
+ inline virtual void proc() const {
+ mAdapter->enableData(mEnable);
+ if (NULL != mAPN) {
+ mAdapter->setAPN(mAPN, mLen);
+ }
+ }
+ inline void locallog() const {
+ LOC_LOGV("apn: %s\n enable: %d",
+ (NULL == mAPN) ? "NULL" : mAPN, mEnable);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_INJECT_XTRA_DATA:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_SET_CAPABILITIES:
+struct LocEngSetCapabilities : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_capabilities_cb) {
+ LOC_LOGV("calling set_capabilities_cb 0x%x",
+ gps_conf.CAPABILITIES);
+ mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES);
+ } else {
+ LOC_LOGV("set_capabilities_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetCapabilities");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+struct LocEngSetSystemInfo : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngSetSystemInfo(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ if (NULL != mLocEng->set_system_info_cb) {
+ LOC_LOGV("calling set_system_info_cb 0x%x",
+ mLocEng->adapter->mGnssInfo.year_of_hw);
+ mLocEng->set_system_info_cb(&(mLocEng->adapter->mGnssInfo));
+ }
+ else {
+ LOC_LOGV("set_system_info_cb is NULL.\n");
+ }
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngSetSystemInfo");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_LOC_INIT:
+struct LocEngInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_reinit(*mLocEng);
+ // set the capabilities
+ mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng));
+ mLocEng->adapter->sendMsg(new LocEngSetSystemInfo(mLocEng));
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInit");
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REQUEST_XTRA_SERVER:
+// loc_eng_xtra.cpp
+
+// case LOC_ENG_MSG_ATL_OPEN_SUCCESS:
+struct LocEngAtlOpenSuccess : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ const int mLen;
+ char* mAPN;
+ const AGpsBearerType mBearerType;
+ inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine,
+ const char* name,
+ int len,
+ AGpsBearerType btype) :
+ LocMsg(),
+ mStateMachine(statemachine), mLen(len),
+ mAPN(new char[len+1]), mBearerType(btype)
+ {
+ memcpy((void*)mAPN, (void*)name, len);
+ mAPN[len] = 0;
+ locallog();
+ }
+ inline ~LocEngAtlOpenSuccess()
+ {
+ delete[] mAPN;
+ }
+ inline virtual void proc() const {
+ mStateMachine->setBearer(mBearerType);
+ mStateMachine->setAPN(mAPN, mLen);
+ mStateMachine->onRsrcEvent(RSRC_GRANTED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n"
+ " bearer type: %s",
+ loc_get_agps_type_name(mStateMachine->getType()),
+ mAPN,
+ loc_get_agps_bear_name(mBearerType));
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_CLOSED:
+struct LocEngAtlClosed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlClosed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_RELEASED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlClosed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ATL_OPEN_FAILED:
+struct LocEngAtlOpenFailed : public LocMsg {
+ AgpsStateMachine* mStateMachine;
+ inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) :
+ LocMsg(), mStateMachine(statemachine) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mStateMachine->onRsrcEvent(RSRC_DENIED);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngAtlOpenFailed");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_ENGINE_DOWN:
+LocEngDown::LocEngDown(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngDown::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_down(*locEng);
+}
+inline void LocEngDown::locallog() const {
+ LOC_LOGV("LocEngDown");
+}
+inline void LocEngDown::log() const {
+ locallog();
+}
+
+// case LOC_ENG_MSG_ENGINE_UP:
+LocEngUp::LocEngUp(void* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+}
+inline void LocEngUp::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng;
+ loc_eng_handle_engine_up(*locEng);
+}
+inline void LocEngUp::locallog() const {
+ LOC_LOGV("LocEngUp");
+}
+inline void LocEngUp::log() const {
+ locallog();
+}
+
+struct LocEngDataClientInit : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ inline LocEngDataClientInit(loc_eng_data_s_type* locEng) :
+ LocMsg(), mLocEng(locEng) {
+ locallog();
+ }
+ virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ if(!locEng->adapter->initDataServiceClient()) {
+ locEng->ds_nif = new DSStateMachine(servicerTypeExt,
+ (void *)dataCallCb,
+ locEng->adapter);
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngDataClientInit\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInstallAGpsCert : public LocMsg {
+ LocEngAdapter* mpAdapter;
+ const size_t mNumberOfCerts;
+ const uint32_t mSlotBitMask;
+ DerEncodedCertificate* mpData;
+ inline LocEngInstallAGpsCert(LocEngAdapter* adapter,
+ const DerEncodedCertificate* pData,
+ size_t numberOfCerts,
+ uint32_t slotBitMask) :
+ LocMsg(), mpAdapter(adapter),
+ mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask),
+ mpData(new DerEncodedCertificate[mNumberOfCerts])
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ mpData[i].data = new u_char[pData[i].length];
+ if (mpData[i].data) {
+ memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length);
+ mpData[i].length = pData[i].length;
+ } else {
+ LOC_LOGE("malloc failed for cert#%d", i);
+ break;
+ }
+ }
+ locallog();
+ }
+ inline ~LocEngInstallAGpsCert()
+ {
+ for (int i=0; i < mNumberOfCerts; i++) {
+ if (mpData[i].data) {
+ delete[] mpData[i].data;
+ }
+ }
+ delete[] mpData;
+ }
+ inline virtual void proc() const {
+ mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u",
+ mNumberOfCerts, mSlotBitMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngUpdateRegistrationMask : public LocMsg {
+ loc_eng_data_s_type* mLocEng;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ loc_registration_mask_status mIsEnabled;
+ inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng,
+ LOC_API_ADAPTER_EVENT_MASK_T mask,
+ loc_registration_mask_status isEnabled) :
+ LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng;
+ locEng->adapter->updateRegistrationMask(mMask,
+ mIsEnabled);
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngUpdateRegistrationMask\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngGnssConstellationConfig : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter) {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->mGnssInfo.size = sizeof(GnssSystemInfo);
+ if (mAdapter->gnssConstellationConfig()) {
+ LOC_LOGV("Modem supports GNSS measurements\n");
+ gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS;
+ mAdapter->mGnssInfo.year_of_hw = 2016;
+ } else {
+ mAdapter->mGnssInfo.year_of_hw = 2015;
+ LOC_LOGV("Modem does not support GNSS measurements\n");
+ }
+ }
+ void locallog() const {
+ LOC_LOGV("LocEngGnssConstellationConfig\n");
+ }
+ virtual void log() const {
+ locallog();
+ }
+};
+
+// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT:
+LocEngReportGnssMeasurement::LocEngReportGnssMeasurement(void* locEng,
+ GnssData &gnssData) :
+ LocMsg(), mLocEng(locEng), mGnssData(gnssData)
+{
+ locallog();
+}
+void LocEngReportGnssMeasurement::proc() const {
+ loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng;
+ if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ if (locEng->gnss_measurement_cb != NULL) {
+ LOC_LOGV("Calling gnss_measurement_cb");
+ locEng->gnss_measurement_cb((GnssData*)&(mGnssData));
+ }
+ }
+}
+void LocEngReportGnssMeasurement::locallog() const {
+ IF_LOC_LOGV {
+ LOC_LOGV("%s:%d]: Received in GPS HAL."
+ "GNSS Measurements count: %d \n",
+ __func__, __LINE__, mGnssData.measurement_count);
+ for (int i =0; i< mGnssData.measurement_count && i < GNSS_MAX_SVS; i++) {
+ LOC_LOGV(" GNSS measurement data in GPS HAL: \n"
+ " GPS_HAL => Measurement ID | svid | time_offset_ns | state |"
+ " c_n0_dbhz | pseudorange_rate_mps |"
+ " pseudorange_rate_uncertainty_mps |"
+ " accumulated_delta_range_state | flags \n"
+ " GPS_HAL => %d | %d | %f | %d | %f | %f | %f | %d | %d \n",
+ i,
+ mGnssData.measurements[i].svid,
+ mGnssData.measurements[i].time_offset_ns,
+ mGnssData.measurements[i].state,
+ mGnssData.measurements[i].c_n0_dbhz,
+ mGnssData.measurements[i].pseudorange_rate_mps,
+ mGnssData.measurements[i].pseudorange_rate_uncertainty_mps,
+ mGnssData.measurements[i].accumulated_delta_range_state,
+ mGnssData.measurements[i].flags);
+ }
+ LOC_LOGV(" GPS_HAL => Clocks Info: \n"
+ " time_ns | full_bias_ns | bias_ns | bias_uncertainty_ns | "
+ " drift_nsps | drift_uncertainty_nsps | hw_clock_discontinuity_count | flags"
+ " GPS_HAL => Clocks Info: %lld | %lld | %g | %g | %g | %g | %d | 0x%04x\n",
+ mGnssData.clock.time_ns,
+ mGnssData.clock.full_bias_ns,
+ mGnssData.clock.bias_ns,
+ mGnssData.clock.bias_uncertainty_ns,
+ mGnssData.clock.drift_nsps,
+ mGnssData.clock.drift_uncertainty_nsps,
+ mGnssData.clock.hw_clock_discontinuity_count,
+ mGnssData.clock.flags);
+ }
+}
+inline void LocEngReportGnssMeasurement::log() const {
+ locallog();
+}
+
+/*********************************************************************
+ * Initialization checking macros
+ *********************************************************************/
+#define STATE_CHECK(ctx, x, ret) \
+ if (!(ctx)) \
+ { \
+ /* Not intialized, abort */\
+ LOC_LOGE("%s: log_eng state error: %s", __func__, x); \
+ EXIT_LOG(%s, x); \
+ ret; \
+ }
+#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event, ContextBase* context)
+
+{
+ int ret_val = 0;
+
+ ENTRY_LOG_CALLFLOW();
+ if (NULL == callbacks || 0 == event) {
+ LOC_LOGE("loc_eng_init: bad parameters cb %p eMask %d", callbacks, event);
+ ret_val = -1;
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+ }
+
+ STATE_CHECK((NULL == loc_eng_data.adapter),
+ "instance already initialized", return 0);
+
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data));
+
+ // Save callbacks
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+ loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb;
+ loc_eng_data.set_system_info_cb = callbacks->set_system_info_cb;
+ loc_eng_data.gnss_sv_status_cb = callbacks->gnss_sv_status_cb;
+ loc_eng_data.location_ext_parser = callbacks->location_ext_parser ?
+ callbacks->location_ext_parser : noProc;
+ loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ?
+ callbacks->sv_ext_parser : noProc;
+ loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS;
+ // initial states taken care of by the memset above
+ // loc_eng_data.engine_status -- GPS_STATUS_NONE;
+ // loc_eng_data.fix_session_status -- GPS_STATUS_NONE;
+ // loc_eng_data.mute_session_state -- LOC_MUTE_SESS_NONE;
+
+ if ((event & LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT) && (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_AP))
+ {
+ event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report
+ loc_eng_data.generateNmea = true;
+ }
+ else
+ {
+ loc_eng_data.generateNmea = false;
+ }
+
+ loc_eng_data.adapter =
+ new LocEngAdapter(event, &loc_eng_data, context,
+ (LocThread::tCreate)callbacks->create_thread_cb);
+
+ loc_eng_data.adapter->mGnssInfo.size = sizeof(GnssSystemInfo);
+ loc_eng_data.adapter->mGnssInfo.year_of_hw = 2015;
+ LOC_LOGD("loc_eng_init created client, id = %p\n",
+ loc_eng_data.adapter);
+ loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data));
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngGnssConstellationConfig(adapter));
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE,
+ sap_conf.SENSOR_PROVIDER));
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+
+ /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */
+ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) {
+ adapter->sendMsg(new LocEngSensorProperties(adapter,
+ sap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ sap_conf.GYRO_BIAS_RANDOM_WALK,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY));
+ }
+
+ adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter,
+ sap_conf.SENSOR_CONTROL_MODE,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK));
+
+ adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0)));
+
+ loc_eng_xtra_version_check(loc_eng_data, gps_conf.XTRA_VERSION_CHECK);
+
+ LOC_LOGD("loc_eng_reinit reinit() successful");
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // XTRA has no state, so we are fine with it.
+
+ // we need to check and clear NI
+#if 0
+ // we need to check and clear ATL
+ if (NULL != loc_eng_data.agnss_nif) {
+ delete loc_eng_data.agnss_nif;
+ loc_eng_data.agnss_nif = NULL;
+ }
+ if (NULL != loc_eng_data.internet_nif) {
+ delete loc_eng_data.internet_nif;
+ loc_eng_data.internet_nif = NULL;
+ }
+#endif
+ if (loc_eng_data.adapter->isInSession())
+ {
+ LOC_LOGD("loc_eng_cleanup: fix not stopped. stop it now.");
+ loc_eng_stop(loc_eng_data);
+ }
+
+#if 0 // can't afford to actually clean up, for many reason.
+
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ delete loc_eng_data.adapter;
+ loc_eng_data.adapter = NULL;
+
+ loc_eng_dmn_conn_loc_api_server_unblock();
+ loc_eng_dmn_conn_loc_api_server_join();
+
+#endif
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStartFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (!loc_eng_data.adapter->isInSession()) {
+ ret_val = loc_eng_data.adapter->startFix();
+
+ if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS ||
+ ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN ||
+ ret_val == LOC_API_ADAPTER_ERR_PHONE_OFFLINE ||
+ ret_val == LOC_API_ADAPTER_ERR_INTERNAL)
+ {
+ loc_eng_data.adapter->setInSession(TRUE);
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_stop_wrapper
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendStopFix())
+ {
+ loc_eng_data.adapter->sendMsg(new LocEngStopFix(loc_eng_data.adapter));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+
+ if (loc_eng_data.adapter->isInSession()) {
+
+ ret_val = loc_eng_data.adapter->stopFix();
+ loc_eng_data.adapter->setInSession(FALSE);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
+
+DESCRIPTION
+ Mutes one session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: Success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+
+ // The position mode for AUTO/GSS/QCA1530 can only be standalone
+ if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) &&
+ !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) &&
+ (params.mode != LOC_POSITION_MODE_STANDALONE)) {
+ params.mode = LOC_POSITION_MODE_STANDALONE;
+ LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530.");
+ }
+
+ if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params))
+ {
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngPositionMode(adapter, params));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data, GpsUtcTime time,
+ int64_t timeReference, int uncertainty)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ adapter->sendMsg(new LocEngSetTime(adapter, time, timeReference,
+ uncertainty));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
+ double longitude, float accuracy)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return -1);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ if(adapter->mSupportsPositionInjection)
+ {
+ adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
+ accuracy));
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData f)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f));
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+
+ if (loc_eng_data.status_cb)
+ {
+ GpsStatus gs = { sizeof(gs),status };
+ CALLBACK_LOG_CALLFLOW("status_cb", %s,
+ loc_get_gps_status_name(gs.status));
+ loc_eng_data.status_cb(&gs);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ int ret_val = LOC_API_ADAPTER_ERR_SUCCESS;
+ UlpLocation location;
+ LocPosTechMask tech_mask = LOC_POS_TECH_MASK_DEFAULT;
+ GpsLocationExtended locationExtended;
+ memset(&locationExtended, 0, sizeof (GpsLocationExtended));
+ locationExtended.size = sizeof(locationExtended);
+
+ ret_val = loc_eng_data.adapter->getZpp(location.gpsLocation, tech_mask);
+ //Mark the location source as from ZPP
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_ZPP;
+
+ loc_eng_data.adapter->getUlpProxy()->reportPosition(location,
+ locationExtended,
+ NULL,
+ LOC_SESS_SUCCESS,
+ tech_mask);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*
+ Callback function passed to Data Services State Machine
+ This becomes part of the state machine's servicer and
+ is used to send requests to the data services client
+*/
+static int dataCallCb(void *cb_data)
+{
+ LOC_LOGD("Enter dataCallCb\n");
+ int ret=0;
+ if(cb_data != NULL) {
+ dsCbData *cbData = (dsCbData *)cb_data;
+ LocEngAdapter *locAdapter = (LocEngAdapter *)cbData->mAdapter;
+ if(cbData->action == GPS_REQUEST_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_REQUEST_AGPS_DATA_CONN\n");
+ ret = locAdapter->openAndStartDataCall();
+ }
+ else if(cbData->action == GPS_RELEASE_AGPS_DATA_CONN) {
+ LOC_LOGD("dataCallCb GPS_RELEASE_AGPS_DATA_CONN\n");
+ locAdapter->stopDataCall();
+ }
+ }
+ else {
+ LOC_LOGE("NULL argument received. Failing.\n");
+ ret = -1;
+ goto err;
+ }
+
+err:
+ LOC_LOGD("Exit dataCallCb ret = %d\n", ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_reinit
+
+DESCRIPTION
+ 2nd half of loc_eng_agps_init(), singled out for modem restart to use.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+
+ // Set server addresses which came before init
+ if (loc_eng_data.supl_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_SUPL_SERVER,
+ loc_eng_data.supl_host_buf,
+ loc_eng_data.supl_port_buf);
+ }
+
+ if (loc_eng_data.c2k_host_set)
+ {
+ loc_eng_set_server(loc_eng_data, LOC_AGPS_CDMA_PDE_SERVER,
+ loc_eng_data.c2k_host_buf,
+ loc_eng_data.c2k_port_buf);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+ Initialize the AGps interface.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter, return);
+ STATE_CHECK((NULL == loc_eng_data.agps_status_cb),
+ "agps instance already initialized",
+ return);
+ if (callbacks == NULL) {
+ LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks);
+ EXIT_LOG(%s, VOID_RET);
+ return;
+ }
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WWAN_ANY,
+ false);
+ loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_WIFI,
+ true);
+
+ if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) ||
+ (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) {
+ loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps,
+ (void *)loc_eng_data.agps_status_cb,
+ AGPS_TYPE_SUPL,
+ false);
+
+ if (adapter->mSupportsAgpsRequests) {
+ if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data));
+ }
+ loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,
+ NULL, NULL, &loc_eng_data);
+ }
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+static void deleteAidingData(loc_eng_data_s_type &logEng) {
+ if (logEng.engine_status != GPS_STATUS_ENGINE_ON &&
+ logEng.aiding_data_for_deletion != 0) {
+ logEng.adapter->deleteAidingData(logEng.aiding_data_for_deletion);
+ logEng.aiding_data_for_deletion = 0;
+ }
+}
+
+static AgpsStateMachine*
+getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) {
+ AgpsStateMachine* stateMachine;
+ switch (agpsType) {
+ case AGPS_TYPE_WIFI: {
+ stateMachine = locEng.wifi_nif;
+ break;
+ }
+ case AGPS_TYPE_INVALID:
+ case AGPS_TYPE_SUPL: {
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ case AGPS_TYPE_SUPL_ES: {
+ locEng.ds_nif ?
+ stateMachine = locEng.ds_nif:
+ stateMachine = locEng.agnss_nif;
+ break;
+ }
+ default:
+ stateMachine = locEng.internet_nif;
+ }
+ return stateMachine;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ if (apn == NULL)
+ {
+ LOC_LOGE("APN Name NULL\n");
+ return 0;
+ }
+
+ LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn);
+
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+
+ loc_eng_data.adapter->sendMsg(
+ new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_closed
+
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform engine about the data close result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_open_failed
+
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform engine about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType)
+{
+ ENTRY_LOG_CALLFLOW();
+ INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb,
+ return -1);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType);
+ loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm));
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION resolve_in_addr
+
+DESCRIPTION
+ Translates a hostname to in_addr struct
+
+DEPENDENCIES
+ n/a
+
+RETURN VALUE
+ TRUE if successful
+
+SIDE EFFECTS
+ n/a
+
+===========================================================================*/
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
+{
+ ENTRY_LOG();
+ boolean ret_val = TRUE;
+
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ ret_val = FALSE;
+ }
+ }
+
+ EXIT_LOG(%s, loc_logger_boolStr[ret_val!=0]);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server
+
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char* hostname, int port)
+{
+ ENTRY_LOG();
+ int ret = 0;
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (LOC_AGPS_SUPL_SERVER == type) {
+ char url[MAX_URL_LEN];
+ unsigned int len = 0;
+ const char nohost[] = "NONE";
+ if (hostname == NULL ||
+ strncasecmp(nohost, hostname, sizeof(nohost)) == 0) {
+ url[0] = NULL;
+ } else {
+ len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port);
+ }
+
+ if (sizeof(url) > len) {
+ adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len));
+ }
+ } else if (LOC_AGPS_CDMA_PDE_SERVER == type ||
+ LOC_AGPS_CUSTOM_PDE_SERVER == type ||
+ LOC_AGPS_MPC_SERVER == type) {
+ struct in_addr addr;
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ ret = -2;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ adapter->sendMsg(new LocEngSetServerIpv4(adapter, ip, port, type));
+ }
+ } else {
+ LOC_LOGE("loc_eng_set_server, type %d cannot be resolved.\n", type);
+ }
+
+ EXIT_LOG(%d, ret);
+ return ret;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_server_proxy
+
+DESCRIPTION
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type,
+ const char* hostname, int port)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = 0;
+
+ LOC_LOGV("save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case LOC_AGPS_SUPL_SERVER:
+ strlcpy(loc_eng_data.supl_host_buf, hostname,
+ sizeof(loc_eng_data.supl_host_buf));
+ loc_eng_data.supl_port_buf = port;
+ loc_eng_data.supl_host_set = 1;
+ break;
+ case LOC_AGPS_CDMA_PDE_SERVER:
+ strlcpy(loc_eng_data.c2k_host_buf, hostname,
+ sizeof(loc_eng_data.c2k_host_buf));
+ loc_eng_data.c2k_port_buf = port;
+ loc_eng_data.c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+
+ if (NULL != loc_eng_data.adapter)
+ {
+ ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port);
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_ril_update_network_availability
+
+DESCRIPTION
+ Sets data call allow vs disallow flag to modem
+ This is the only member of sLocEngAGpsRilInterface implemented.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int available, const char* apn)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ //This is to store the status of data availability over the network.
+ //If GPS is not enabled, the INIT_CHECK will fail and the modem will
+ //not be updated with the network's availability. Since the data status
+ //can change before GPS is enabled the, storing the status will enable
+ //us to inform the modem after GPS is enabled
+ agpsStatus = available;
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+ if (apn != NULL)
+ {
+ LOC_LOGD("loc_eng_agps_ril_update_network_availability: APN Name = [%s]\n", apn);
+ int apn_len = smaller_of(strlen (apn), MAX_APN_LEN);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngEnableData(adapter, apn, apn_len, available));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t numberOfCerts)
+{
+ ENTRY_LOG_CALLFLOW();
+ int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+
+ uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK;
+ uint32_t slotCount = 0;
+ for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) {
+ slotBitMaskCounter &= slotBitMaskCounter - 1;
+ }
+ LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u",
+ slotBitMask, slotCount, numberOfCerts);
+
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ if (numberOfCerts == 0) {
+ LOC_LOGE("No certs to install, since numberOfCerts is zero");
+ ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS;
+ } else if (!adapter) {
+ LOC_LOGE("adapter is null!");
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ } else if (slotCount < numberOfCerts) {
+ LOC_LOGE("Not enough cert slots (%u) to install %u certs!",
+ slotCount, numberOfCerts);
+ ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES;
+ } else {
+ for (int i=0; i < numberOfCerts; ++i)
+ {
+ if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) {
+ LOC_LOGE("cert#(%u) length of %u is too big! greater than %u",
+ certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH);
+ ret_val = AGPS_CERTIFICATE_ERROR_GENERIC;
+ break;
+ }
+ }
+
+ if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) {
+ adapter->sendMsg(new LocEngInstallAGpsCert(adapter,
+ certificates,
+ numberOfCerts,
+ slotBitMask));
+ }
+ }
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if (config_data && length > 0) {
+ loc_gps_cfg_s_type gps_conf_tmp = gps_conf;
+ UTIL_UPDATE_CONF(config_data, length, gps_conf_table);
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+
+ // it is possible that HAL is not init'ed at this time
+ if (adapter) {
+ if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) {
+ adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER));
+ }
+ if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) {
+ adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE));
+ }
+ if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) {
+ adapter->sendMsg(new LocEngAGlonassProtocol(adapter,
+ gps_conf.A_GLONASS_POS_PROTOCOL_SELECT));
+ }
+ if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) {
+ adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy()));
+ }
+ }
+
+ gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER;
+ gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE;
+ gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT;
+ gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK;
+ gps_conf = gps_conf_tmp;
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (loc_eng_data_s_type &loc_eng_data, GpsStatusValue status)
+{
+ ENTRY_LOG();
+ // Switch from WAIT to MUTE, for "engine on" or "session begin" event
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+
+ // Switch off MUTE session
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION &&
+ (status == GPS_STATUS_SESSION_END || status == GPS_STATUS_ENGINE_OFF))
+ {
+ LOC_LOGD("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+
+ // Session End is not reported during Android navigating state
+ boolean navigating = loc_eng_data.adapter->isInSession();
+ if (status != GPS_STATUS_NONE &&
+ !(status == GPS_STATUS_SESSION_END && navigating) &&
+ !(status == GPS_STATUS_SESSION_BEGIN && !navigating))
+ {
+ if (loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ // Inform GpsLocationProvider about mNavigating status
+ loc_inform_gps_status(loc_eng_data, status);
+ }
+ else {
+ LOC_LOGD("loc_eng_report_status: muting the status report.");
+ }
+ }
+
+ // Only keeps ENGINE ON/OFF in engine_status
+ if (status == GPS_STATUS_ENGINE_ON || status == GPS_STATUS_ENGINE_OFF)
+ {
+ loc_eng_data.engine_status = status;
+ }
+
+ // Only keeps SESSION BEGIN/END in fix_session_status
+ if (status == GPS_STATUS_SESSION_BEGIN || status == GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = status;
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_handle_engine_down
+ loc_eng_handle_engine_up
+
+DESCRIPTION
+ Calls this function when it is detected that modem restart is happening.
+ Either we detected the modem is down or received modem up event.
+ This must be called from the deferred thread to avoid race condition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_handle_engine_down(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_reset_on_engine_restart(loc_eng_data);
+ loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_OFF);
+ EXIT_LOG(%s, VOID_RET);
+}
+
+void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_reinit(loc_eng_data);
+
+ loc_eng_data.adapter->requestPowerVote();
+
+ if (loc_eng_data.agps_status_cb != NULL) {
+ if (loc_eng_data.agnss_nif)
+ loc_eng_data.agnss_nif->dropAllSubscribers();
+ if (loc_eng_data.internet_nif)
+ loc_eng_data.internet_nif->dropAllSubscribers();
+
+ loc_eng_agps_reinit(loc_eng_data);
+ }
+
+ // modem is back up. If we crashed in the middle of navigating, we restart.
+ if (loc_eng_data.adapter->isInSession()) {
+ // This sets the copy in adapter to modem
+ loc_eng_data.adapter->setInSession(false);
+ loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter));
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+#ifdef USE_GLIB
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
+#endif /* USE_GLIB */
+
+/*===========================================================================
+FUNCTION resolve_config_file_path
+
+DESCRIPTION
+ resolve the given config file path into a vaild full path considering that
+ it could be located in vendor partition.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void resolve_config_file_path(const char* conf_file_name,
+ char* resolved_file_path) {
+ FILE *file;
+ if (conf_file_name[0] == '/') {
+ sprintf(resolved_file_path, "/vendor%s", conf_file_name);
+ } else {
+ sprintf(resolved_file_path, "/vendor/%s", conf_file_name);
+ }
+ if ((file = fopen(resolved_file_path, "r")) != NULL) {
+ fclose(file);
+ return;
+ }
+ strcpy(resolved_file_path, conf_file_name);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_read_config
+
+DESCRIPTION
+ Initiates the reading of the gps config file stored in /etc dir
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_read_config(void)
+{
+ ENTRY_LOG_CALLFLOW();
+ if(configAlreadyRead == false)
+ {
+ // Initialize our defaults before reading of configuration file overwrites them.
+ loc_default_parameters();
+ // We only want to parse the conf file once. This is a good place to ensure that.
+ // In fact one day the conf file should go into context.
+ char conf_file_name[256];
+ resolve_config_file_path(GPS_CONF_FILE, conf_file_name);
+ UTIL_READ_CONF(conf_file_name, gps_conf_table);
+ resolve_config_file_path(SAP_CONF_FILE, conf_file_name);
+ UTIL_READ_CONF(conf_file_name, sap_conf_table);
+ configAlreadyRead = true;
+ } else {
+ LOC_LOGV("GPS Config file has already been read\n");
+ }
+
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_init
+
+DESCRIPTION
+ Initialize gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ STATE_CHECK((NULL == loc_eng_data.gnss_measurement_cb),
+ "gnss measurement already initialized",
+ return GPS_MEASUREMENT_ERROR_ALREADY_INIT);
+ STATE_CHECK((callbacks != NULL),
+ "callbacks can not be NULL",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+ STATE_CHECK(loc_eng_data.adapter,
+ "GpsInterface must be initialized first",
+ return GPS_MEASUREMENT_ERROR_GENERIC);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_ENABLED));
+ // set up the callback
+ loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback;
+ LOC_LOGD ("%s, event masks updated successfully", __func__);
+
+ return GPS_MEASUREMENT_OPERATION_SUCCESS;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_gps_measurement_close
+
+DESCRIPTION
+ Close gps measurement module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ INIT_CHECK(loc_eng_data.adapter, return);
+
+ // updated the mask
+ LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask(
+ &loc_eng_data,
+ event,
+ LOC_REGISTRATION_MASK_DISABLED));
+ // set up the callback
+ loc_eng_data.gnss_measurement_cb = NULL;
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng.h b/msm8996/loc_api/libloc_api_50001/loc_eng.h
new file mode 100644
index 0000000..37ee4be
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng.h
@@ -0,0 +1,211 @@
+/* Copyright (c) 2009-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_ENG_H
+#define LOC_ENG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+#define MAX_NUM_ATL_CONNECTIONS 2
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc.h>
+#include <loc_eng_xtra.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_agps.h>
+#include <loc_cfg.h>
+#include <loc_log.h>
+#include <log_util.h>
+#include <loc_eng_agps.h>
+#include <LocEngAdapter.h>
+
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+#define SUCCESS TRUE
+#define FAILURE FALSE
+#define INVALID_ATL_CONNECTION_HANDLE -1
+
+#define gps_conf ContextBase::mGps_conf
+#define sap_conf ContextBase::mSap_conf
+
+enum loc_nmea_provider_e_type {
+ NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
+ NMEA_PROVIDER_MP // Modem Processor Provider of NMEA
+};
+
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE = 0,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
+// Module data
+typedef struct loc_eng_data_s
+{
+ LocEngAdapter *adapter;
+ loc_location_cb_ext location_cb;
+ gps_status_callback status_cb;
+ loc_sv_status_cb_ext sv_status_cb;
+ agps_status_extended agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_set_capabilities set_capabilities_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ gps_request_utc_time request_utc_time_cb;
+ gnss_set_system_info set_system_info_cb;
+ gnss_sv_status_callback gnss_sv_status_cb;
+ gnss_measurement_callback gnss_measurement_cb;
+ boolean intermediateFix;
+ AGpsStatusValue agps_status;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ loc_eng_ni_data_s_type loc_eng_ni_data;
+
+ // AGPS state machines
+ AgpsStateMachine* agnss_nif;
+ AgpsStateMachine* internet_nif;
+ AgpsStateMachine* wifi_nif;
+ //State machine for Data Services
+ AgpsStateMachine* ds_nif;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // For muting session broadcast
+ loc_mute_session_e_type mute_session_state;
+
+ // For nmea generation
+ boolean generateNmea;
+ uint32_t sv_used_mask;
+ float hdop;
+ float pdop;
+ float vdop;
+
+ // Address buffers, for addressing setting before init
+ int supl_host_set;
+ char supl_host_buf[101];
+ int supl_port_buf;
+ int c2k_host_set;
+ char c2k_host_buf[101];
+ int c2k_port_buf;
+ int mpc_host_set;
+ char mpc_host_buf[101];
+ int mpc_port_buf;
+
+ loc_ext_parser location_ext_parser;
+ loc_ext_parser sv_ext_parser;
+} loc_eng_data_s_type;
+
+//loc_eng functions
+int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
+ LocCallbacks* callbacks,
+ LOC_API_ADAPTER_EVENT_MASK_T event,
+ ContextBase* context);
+int loc_eng_start(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_stop(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_cleanup(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_inject_time(loc_eng_data_s_type &loc_eng_data,
+ GpsUtcTime time, int64_t timeReference,
+ int uncertainty);
+int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data,
+ double latitude, double longitude,
+ float accuracy);
+void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data,
+ GpsAidingData f);
+int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data,
+ LocPosMode ¶ms);
+const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data,
+ const char* name);
+int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data,
+ LocServerType type, const char *hostname, int port);
+void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data);
+int loc_eng_read_config(void);
+
+//loc_eng_agps functions
+void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data,
+ AGpsExtCallbacks* callbacks);
+int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType,
+ const char* apn, AGpsBearerType bearerType);
+int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType);
+void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data,
+ int avaiable, const char* apn);
+int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data,
+ const DerEncodedCertificate* certificates,
+ size_t length);
+
+//loc_eng_xtra functions
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks);
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length);
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data);
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, int check);
+
+//loc_eng_ni functions
+extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data,
+ GpsNiExtCallbacks *callbacks);
+extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response);
+extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough);
+extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data);
+
+void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data,
+ const char* config_data, int32_t length);
+int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data,
+ GpsMeasurementCallbacks* callbacks);
+void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif // LOC_ENG_H
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_agps.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_agps.cpp
new file mode 100644
index 0000000..5016b5c
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -0,0 +1,970 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng_agps.h>
+#include <loc_eng_log.h>
+#include <log_util.h>
+#include <platform_lib_includes.h>
+#include <loc_eng_dmn_conn_handler.h>
+#include <loc_eng_dmn_conn.h>
+#include <sys/time.h>
+
+//======================================================================
+// C callbacks
+//======================================================================
+
+// This is given to linked_list_add as the dealloc callback
+// data -- an instance of Subscriber
+static void deleteObj(void* data)
+{
+ delete (Subscriber*)data;
+}
+
+// This is given to linked_list_search() as the comparison callback
+// when the state manchine needs to process for particular subscriber
+// fromCaller -- caller provides this obj
+// fromList -- linked_list_search() function take this one from list
+static bool hasSubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ return s1->forMe(*notification);
+}
+
+// This is gvien to linked_list_search() to notify subscriber objs
+// when the state machine needs to inform all subscribers of resource
+// status changes, e.g. when resource is GRANTED.
+// fromCaller -- caller provides this ptr to a Notification obj.
+// fromList -- linked_list_search() function take this one from list
+static bool notifySubscriber(void* fromCaller, void* fromList)
+{
+ Notification* notification = (Notification*)fromCaller;
+ Subscriber* s1 = (Subscriber*)fromList;
+
+ // we notify every subscriber indiscriminatively
+ // each subscriber decides if this notification is interesting.
+ return s1->notifyRsrcStatus(*notification) &&
+ // if we do not want to delete the subscriber from the
+ // the list, we must set this to false so this function
+ // returns false
+ notification->postNotifyDelete;
+}
+
+//======================================================================
+// Notification
+//======================================================================
+const int Notification::BROADCAST_ALL = 0x80000000;
+const int Notification::BROADCAST_ACTIVE = 0x80000001;
+const int Notification::BROADCAST_INACTIVE = 0x80000002;
+const unsigned char DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const unsigned int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+//======================================================================
+// Subscriber: BITSubscriber / ATLSubscriber / WIFISubscriber
+//======================================================================
+bool Subscriber::forMe(Notification ¬ification)
+{
+ if (NULL != notification.rcver) {
+ return equals(notification.rcver);
+ } else {
+ return Notification::BROADCAST_ALL == notification.groupID ||
+ (Notification::BROADCAST_ACTIVE == notification.groupID &&
+ !isInactive()) ||
+ (Notification::BROADCAST_INACTIVE == notification.groupID &&
+ isInactive());
+ }
+}
+bool BITSubscriber::equals(const Subscriber *s) const
+{
+ BITSubscriber* bitS = (BITSubscriber*)s;
+
+ return (ID == bitS->ID &&
+ (INADDR_NONE != (unsigned int)ID ||
+ 0 == strncmp(mIPv6Addr, bitS->mIPv6Addr, sizeof(mIPv6Addr))));
+}
+
+bool BITSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool ATLSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ ((LocEngAdapter*)mLocAdapter)->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_DENIED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 0,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ case RSRC_GRANTED:
+ {
+ AGpsExtType type = mBackwardCompatibleMode ?
+ AGPS_TYPE_INVALID : mStateMachine->getType();
+ ((LocEngAdapter*)mLocAdapter)->atlOpenStatus(ID, 1,
+ (char*)mStateMachine->getAPN(),
+ mStateMachine->getBearer(),
+ type);
+ }
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+
+bool WIFISubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+
+ if (notify) {
+ switch(notification.rsrcStatus)
+ {
+ case RSRC_UNSUBSCRIBE:
+ break;
+ case RSRC_RELEASED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+ break;
+ case RSRC_DENIED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_FAILURE);
+ break;
+ case RSRC_GRANTED:
+ loc_eng_dmn_conn_loc_api_server_data_conn(
+ senderId,
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+ break;
+ default:
+ notify = false;
+ }
+ }
+
+ return notify;
+}
+bool DSSubscriber::notifyRsrcStatus(Notification ¬ification)
+{
+ bool notify = forMe(notification);
+ LOC_LOGD("DSSubscriber::notifyRsrcStatus. notify:%d \n",(int)(notify));
+ if(notify) {
+ switch(notification.rsrcStatus) {
+ case RSRC_UNSUBSCRIBE:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ case RSRC_GRANTED:
+ ((DSStateMachine *)mStateMachine)->informStatus(notification.rsrcStatus, ID);
+ break;
+ default:
+ notify = false;
+ }
+ }
+ return notify;
+}
+void DSSubscriber :: setInactive()
+{
+ mIsInactive = true;
+ ((DSStateMachine *)mStateMachine)->informStatus(RSRC_UNSUBSCRIBE, ID);
+}
+//======================================================================
+// AgpsState: AgpsReleasedState / AgpsPendingState / AgpsAcquiredState
+//======================================================================
+
+// AgpsReleasedState
+class AgpsReleasedState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasedState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasedState = this; }
+
+ inline ~AgpsReleasedState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasedState";}
+};
+
+AgpsState* AgpsReleasedState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ LOC_LOGD("AgpsReleasedState::onRsrcEvent; event:%d\n", (int)event);
+ if (mStateMachine->hasSubscribers()) {
+ LOC_LOGE("Error: %s subscriber list not empty!!!", whoami());
+ // I don't know how to recover from it. I am adding this rather
+ // for debugging purpose.
+ }
+
+ AgpsState* nextState = this;
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // no notification until we get RSRC_GRANTED
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // request from connecivity service for NIF
+ //The if condition is added so that if the data call setup fails
+ //for DS State Machine, we want to retry in released state.
+ //for AGps State Machine, sendRsrcRequest() will always return success
+ if(!mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN)) {
+ // move the state to PENDING
+ nextState = mPendingState;
+ }
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ // the list should really be empty, nothing to remove.
+ // but we might as well just tell the client it is
+ // unsubscribed. False tolerance, right?
+ Subscriber* subscriber = (Subscriber*) data;
+ Notification notification(subscriber, event, false);
+ subscriber->notifyRsrcStatus(notification);
+ }
+ // break;
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ default:
+ LOC_LOGW("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ break;
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsPendingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsPendingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mPendingState = this; }
+
+ inline ~AgpsPendingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsPendingState";}
+};
+
+AgpsState* AgpsPendingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsPendingState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_ACTIVE, event, false);
+ // notify all subscribers NIF resource GRANTED
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_RELEASED:
+ // no state change.
+ // we are expecting either GRANTED or DENIED. Handling RELEASED
+ // may like break our state machine in race conditions.
+ break;
+
+ case RSRC_DENIED:
+ {
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // notify all subscribers NIF resource RELEASED or DENIED
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+
+class AgpsAcquiredState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsAcquiredState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mAcquiredState = this; }
+
+ inline ~AgpsAcquiredState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() { return (char*)"AgpsAcquiredState"; }
+};
+
+
+AgpsState* AgpsAcquiredState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;
+ LOC_LOGD("AgpsAcquiredState::onRsrcEvent; event:%d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // we already have the NIF resource, simply notify subscriber
+ Subscriber* subscriber = (Subscriber*) data;
+ // we have rsrc in hand, so grant it right away
+ Notification notification(subscriber, RSRC_GRANTED, false);
+ subscriber->notifyRsrcStatus(notification);
+ // add subscriber to the list
+ mStateMachine->addSubscriber(subscriber);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ } else if (!mStateMachine->hasActiveSubscribers()) {
+ // only inactive subscribers, move to RELEASING state
+ nextState = mReleasingState;
+
+ // tell connecivity service we can release NIF
+ mStateMachine->sendRsrcRequest(GPS_RELEASE_AGPS_DATA_CONN);
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ LOC_LOGW("%s: %d, RSRC_GRANTED already received", whoami(), event);
+ // no state change.
+ break;
+
+ case RSRC_RELEASED:
+ {
+ LOC_LOGW("%s: %d, a force rsrc release", whoami(), event);
+ nextState = mReleasedState;
+ Notification notification(Notification::BROADCAST_ALL, event, true);
+ // by setting true, we remove subscribers from the linked list
+ mStateMachine->notifySubscribers(notification);
+ }
+ break;
+
+ case RSRC_DENIED:
+ // no state change.
+ // we are expecting RELEASED. Handling DENIED
+ // may like break our state machine in race conditions.
+ break;
+
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+
+// AgpsPendingState
+class AgpsReleasingState : public AgpsState
+{
+ friend class AgpsStateMachine;
+
+ inline AgpsReleasingState(AgpsStateMachine* stateMachine) :
+ AgpsState(stateMachine)
+ { mReleasingState = this; }
+
+ inline ~AgpsReleasingState() {}
+public:
+ virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data);
+ inline virtual char* whoami() {return (char*)"AgpsReleasingState";}
+};
+
+AgpsState* AgpsReleasingState::onRsrcEvent(AgpsRsrcStatus event, void* data)
+{
+ AgpsState* nextState = this;;
+ LOC_LOGD("AgpsReleasingState::onRsrcEvent; event:%d\n", (int)event);
+
+ switch (event)
+ {
+ case RSRC_SUBSCRIBE:
+ {
+ // already requested for NIF resource,
+ // do nothing until we get RSRC_GRANTED indication
+ // but we need to add subscriber to the list
+ mStateMachine->addSubscriber((Subscriber*)data);
+ // no state change.
+ }
+ break;
+
+ case RSRC_UNSUBSCRIBE:
+ {
+ Subscriber* subscriber = (Subscriber*) data;
+ if (subscriber->waitForCloseComplete()) {
+ subscriber->setInactive();
+ } else {
+ // auto notify this subscriber of the unsubscribe
+ Notification notification(subscriber, event, true);
+ mStateMachine->notifySubscribers(notification);
+ }
+
+ // now check if there is any subscribers left
+ if (!mStateMachine->hasSubscribers()) {
+ // no more subscribers, move to RELEASED state
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_DENIED:
+ // A race condition subscriber unsubscribes before AFW denies resource.
+ case RSRC_RELEASED:
+ {
+ nextState = mAcquiredState;
+ Notification notification(Notification::BROADCAST_INACTIVE, event, true);
+ // notify all subscribers that are active NIF resource RELEASE
+ // by setting false, we keep subscribers on the linked list
+ mStateMachine->notifySubscribers(notification);
+
+ if (mStateMachine->hasActiveSubscribers()) {
+ nextState = mPendingState;
+ // request from connecivity service for NIF
+ mStateMachine->sendRsrcRequest(GPS_REQUEST_AGPS_DATA_CONN);
+ } else {
+ nextState = mReleasedState;
+ }
+ }
+ break;
+
+ case RSRC_GRANTED:
+ default:
+ LOC_LOGE("%s: unrecognized event %d", whoami(), event);
+ // no state change.
+ }
+
+ LOC_LOGD("onRsrcEvent, old state %s, new state %s, event %d",
+ whoami(), nextState->whoami(), event);
+ return nextState;
+}
+//======================================================================
+//Servicer
+//======================================================================
+Servicer* Servicer :: getServicer(servicerType type, void *cb_func)
+{
+ LOC_LOGD(" Enter getServicer type:%d\n", (int)type);
+ switch(type) {
+ case servicerTypeNoCbParam:
+ return (new Servicer(cb_func));
+ case servicerTypeExt:
+ return (new ExtServicer(cb_func));
+ case servicerTypeAgps:
+ return (new AGpsServicer(cb_func));
+ default:
+ return NULL;
+ }
+}
+
+int Servicer :: requestRsrc(void *cb_data)
+{
+ callback();
+ return 0;
+}
+
+int ExtServicer :: requestRsrc(void *cb_data)
+{
+ int ret=-1;
+ LOC_LOGD("Enter ExtServicer :: requestRsrc\n");
+ ret = callbackExt(cb_data);
+ LOC_LOGD("Exit ExtServicer :: requestRsrc\n");
+ return(ret);
+}
+
+int AGpsServicer :: requestRsrc(void *cb_data)
+{
+ callbackAGps((AGpsStatus *)cb_data);
+ return 0;
+}
+
+//======================================================================
+// AgpsStateMachine
+//======================================================================
+
+AgpsStateMachine::AgpsStateMachine(servicerType servType,
+ void *cb_func,
+ AGpsExtType type,
+ bool enforceSingleSubscriber) :
+ mStatePtr(new AgpsReleasedState(this)),mType(type),
+ mAPN(NULL),
+ mAPNLen(0),
+ mBearer(AGPS_APN_BEARER_INVALID),
+ mEnforceSingleSubscriber(enforceSingleSubscriber),
+ mServicer(Servicer :: getServicer(servType, (void *)cb_func))
+{
+ linked_list_init(&mSubscribers);
+
+ // setting up mReleasedState
+ mStatePtr->mPendingState = new AgpsPendingState(this);
+ mStatePtr->mAcquiredState = new AgpsAcquiredState(this);
+ mStatePtr->mReleasingState = new AgpsReleasingState(this);
+
+ // setting up mAcquiredState
+ mStatePtr->mAcquiredState->mReleasedState = mStatePtr;
+ mStatePtr->mAcquiredState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mAcquiredState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mPendingState
+ mStatePtr->mPendingState->mAcquiredState = mStatePtr->mAcquiredState;
+ mStatePtr->mPendingState->mReleasedState = mStatePtr;
+ mStatePtr->mPendingState->mReleasingState = mStatePtr->mReleasingState;
+
+ // setting up mReleasingState
+ mStatePtr->mReleasingState->mReleasedState = mStatePtr;
+ mStatePtr->mReleasingState->mPendingState = mStatePtr->mPendingState;
+ mStatePtr->mReleasingState->mAcquiredState = mStatePtr->mAcquiredState;
+}
+
+AgpsStateMachine::~AgpsStateMachine()
+{
+ dropAllSubscribers();
+
+ // free the 3 states. We must read out all 3 pointers first.
+ // Otherwise we run the risk of getting pointers from already
+ // freed memory.
+ AgpsState* acquiredState = mStatePtr->mAcquiredState;
+ AgpsState* releasedState = mStatePtr->mReleasedState;
+ AgpsState* pendindState = mStatePtr->mPendingState;
+ AgpsState* releasingState = mStatePtr->mReleasingState;
+
+ delete acquiredState;
+ delete releasedState;
+ delete pendindState;
+ delete releasingState;
+ delete mServicer;
+ linked_list_destroy(&mSubscribers);
+
+ if (NULL != mAPN) {
+ delete[] mAPN;
+ mAPN = NULL;
+ }
+}
+
+void AgpsStateMachine::setAPN(const char* apn, unsigned int len)
+{
+ if (NULL != mAPN) {
+ delete mAPN;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ memcpy(mAPN, apn, len);
+ mAPN[len] = NULL;
+
+ mAPNLen = len;
+ } else {
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+}
+
+void AgpsStateMachine::onRsrcEvent(AgpsRsrcStatus event)
+{
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ case RSRC_RELEASED:
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+}
+
+void AgpsStateMachine::notifySubscribers(Notification& notification) const
+{
+ if (notification.postNotifyDelete) {
+ // just any non NULL value to get started
+ Subscriber* s = (Subscriber*)~0;
+ while (NULL != s) {
+ s = NULL;
+ // if the last param sets to true, _search will delete
+ // the node from the list for us. But the problem is
+ // once that is done, _search returns, leaving the
+ // rest of the list unprocessed. So we need a loop.
+ linked_list_search(mSubscribers, (void**)&s, notifySubscriber,
+ (void*)¬ification, true);
+ delete s;
+ }
+ } else {
+ // no loop needed if it the last param sets to false, which
+ // mean nothing gets deleted from the list.
+ linked_list_search(mSubscribers, NULL, notifySubscriber,
+ (void*)¬ification, false);
+ }
+}
+
+void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL == s) {
+ linked_list_add(mSubscribers, subscriber->clone(), deleteObj);
+ }
+}
+
+int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+
+ if ((NULL == s) == (GPS_RELEASE_AGPS_DATA_CONN == action)) {
+ AGpsExtStatus nifRequest;
+ nifRequest.size = sizeof(nifRequest);
+ nifRequest.type = mType;
+ nifRequest.status = action;
+
+ if (s == NULL) {
+ nifRequest.ipv4_addr = INADDR_NONE;
+ memset(&nifRequest.addr, 0, sizeof(nifRequest.addr));
+ nifRequest.ssid[0] = '\0';
+ nifRequest.password[0] = '\0';
+ } else {
+ s->setIPAddresses(nifRequest.addr);
+ s->setWifiInfo(nifRequest.ssid, nifRequest.password);
+ }
+
+ CALLBACK_LOG_CALLFLOW("agps_cb", %s, loc_get_agps_status_name(action));
+ mServicer->requestRsrc((void *)&nifRequest);
+ }
+ return 0;
+}
+
+void AgpsStateMachine::subscribeRsrc(Subscriber *subscriber)
+{
+ if (mEnforceSingleSubscriber && hasSubscribers()) {
+ Notification notification(Notification::BROADCAST_ALL, RSRC_DENIED, true);
+ notifySubscriber(¬ification, subscriber);
+ } else {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_SUBSCRIBE, (void*)subscriber);
+ }
+}
+
+bool AgpsStateMachine::unsubscribeRsrc(Subscriber *subscriber)
+{
+ Subscriber* s = NULL;
+ Notification notification((const Subscriber*)subscriber);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+
+ if (NULL != s) {
+ mStatePtr = mStatePtr->onRsrcEvent(RSRC_UNSUBSCRIBE, (void*)s);
+ return true;
+ }
+ return false;
+}
+
+bool AgpsStateMachine::hasActiveSubscribers() const
+{
+ Subscriber* s = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s,
+ hasSubscriber, (void*)¬ification, false);
+ return NULL != s;
+}
+
+//======================================================================
+// DSStateMachine
+//======================================================================
+void delay_callback(void *callbackData, int result)
+{
+ if(callbackData) {
+ DSStateMachine *DSSMInstance = (DSStateMachine *)callbackData;
+ DSSMInstance->retryCallback();
+ }
+ else {
+ LOC_LOGE(" NULL argument received. Failing.\n");
+ goto err;
+ }
+err:
+ return;
+}
+
+DSStateMachine :: DSStateMachine(servicerType type, void *cb_func,
+ LocEngAdapter* adapterHandle):
+ AgpsStateMachine(type, cb_func, AGPS_TYPE_INVALID,false),
+ mLocAdapter(adapterHandle)
+{
+ LOC_LOGD("%s:%d]: New DSStateMachine\n", __func__, __LINE__);
+ mRetries = 0;
+}
+
+void DSStateMachine :: retryCallback(void)
+{
+ DSSubscriber *subscriber = NULL;
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&subscriber, hasSubscriber,
+ (void*)¬ification, false);
+ if(subscriber)
+ mLocAdapter->requestSuplES(subscriber->ID);
+ else
+ LOC_LOGE("DSStateMachine :: retryCallback: No subscriber found." \
+ "Cannot retry data call\n");
+ return;
+}
+
+int DSStateMachine :: sendRsrcRequest(AGpsStatusValue action) const
+{
+ DSSubscriber* s = NULL;
+ dsCbData cbData;
+ int ret=-1;
+ int connHandle=-1;
+ LOC_LOGD("Enter DSStateMachine :: sendRsrcRequest\n");
+ Notification notification(Notification::BROADCAST_ACTIVE);
+ linked_list_search(mSubscribers, (void**)&s, hasSubscriber,
+ (void*)¬ification, false);
+ if(s) {
+ connHandle = s->ID;
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - subscriber found\n");
+ }
+ else
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - No subscriber found\n");
+
+ cbData.action = action;
+ cbData.mAdapter = mLocAdapter;
+ ret = mServicer->requestRsrc((void *)&cbData);
+ //Only the request to start data call returns a success/failure
+ //The request to stop data call will always succeed
+ //Hence, the below block will only be executed when the
+ //request to start the data call fails
+ switch(ret) {
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGD("DSStateMachine :: sendRsrcRequest - Failure returned: %d\n",ret);
+ ((DSStateMachine *)this)->incRetries();
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+ LOC_LOGE(" Failed to start Data call. Fallback to normal ATL SUPL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ }
+ else {
+ if(loc_timer_start(DATA_CALL_RETRY_DELAY_MSEC, delay_callback, (void *)this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ ret = -1;
+ goto err;
+ }
+ }
+ break;
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No profile found for emergency call. Fallback to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("%s:%d]: Request to start data call sent\n", __func__, __LINE__);
+ break;
+ case -1:
+ //One of the ways this case can be encountered is if the callback function
+ //receives a null argument, it just exits with -1 error
+ LOC_LOGE("Error: Something went wrong somewhere. Falling back to normal SUPL ATL\n");
+ informStatus(RSRC_DENIED, connHandle);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Unrecognized return value\n", __func__, __LINE__);
+ }
+err:
+ LOC_LOGD("EXIT DSStateMachine :: sendRsrcRequest; ret = %d\n", ret);
+ return ret;
+}
+
+void DSStateMachine :: onRsrcEvent(AgpsRsrcStatus event)
+{
+ void* currState = (void *)mStatePtr;
+ LOC_LOGD("Enter DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+ switch (event)
+ {
+ case RSRC_GRANTED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_GRANTED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ case RSRC_RELEASED:
+ LOC_LOGD("DSStateMachine :: onRsrcEvent RSRC_RELEASED\n");
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ //To handle the case where we get a RSRC_RELEASED in
+ //pending state, we translate that to a RSRC_DENIED state
+ //since the callback from DSI is either RSRC_GRANTED or RSRC_RELEASED
+ //for when the call is connected or disconnected respectively.
+ if((void *)mStatePtr != currState)
+ break;
+ else {
+ event = RSRC_DENIED;
+ LOC_LOGE(" Switching event to RSRC_DENIED\n");
+ }
+ case RSRC_DENIED:
+ mStatePtr = mStatePtr->onRsrcEvent(event, NULL);
+ break;
+ default:
+ LOC_LOGW("AgpsStateMachine: unrecognized event %d", event);
+ break;
+ }
+ LOC_LOGD("Exit DSStateMachine :: onRsrcEvent. event = %d\n", (int)event);
+}
+
+void DSStateMachine :: informStatus(AgpsRsrcStatus status, int ID) const
+{
+ LOC_LOGD("DSStateMachine :: informStatus. Status=%d\n",(int)status);
+ switch(status) {
+ case RSRC_UNSUBSCRIBE:
+ mLocAdapter->atlCloseStatus(ID, 1);
+ break;
+ case RSRC_RELEASED:
+ mLocAdapter->closeDataCall();
+ break;
+ case RSRC_DENIED:
+ ((DSStateMachine *)this)->mRetries = 0;
+ mLocAdapter->requestATL(ID, AGPS_TYPE_SUPL);
+ break;
+ case RSRC_GRANTED:
+ mLocAdapter->atlOpenStatus(ID, 1,
+ NULL,
+ AGPS_APN_BEARER_INVALID,
+ AGPS_TYPE_INVALID);
+ break;
+ default:
+ LOC_LOGW("DSStateMachine :: informStatus - unknown status");
+ }
+ return;
+}
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_agps.h b/msm8996/loc_api/libloc_api_50001/loc_eng_agps.h
new file mode 100644
index 0000000..2d689ce
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -0,0 +1,431 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LOC_ENG_AGPS_H__
+#define __LOC_ENG_AGPS_H__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <loc_core_log.h>
+#include <linked_list.h>
+#include <loc_timer.h>
+#include <LocEngAdapter.h>
+
+// forward declaration
+class AgpsStateMachine;
+class Subscriber;
+
+// NIF resource events
+typedef enum {
+ RSRC_SUBSCRIBE,
+ RSRC_UNSUBSCRIBE,
+ RSRC_GRANTED,
+ RSRC_RELEASED,
+ RSRC_DENIED,
+ RSRC_STATUS_MAX
+} AgpsRsrcStatus;
+
+typedef enum {
+ servicerTypeNoCbParam,
+ servicerTypeAgps,
+ servicerTypeExt
+}servicerType;
+
+//DS Callback struct
+typedef struct {
+ LocEngAdapter *mAdapter;
+ AGpsStatusValue action;
+}dsCbData;
+
+// information bundle for subscribers
+struct Notification {
+ // goes to every subscriber
+ static const int BROADCAST_ALL;
+ // goes to every ACTIVE subscriber
+ static const int BROADCAST_ACTIVE;
+ // goes to every INACTIVE subscriber
+ static const int BROADCAST_INACTIVE;
+
+ // go to a specific subscriber
+ const Subscriber* rcver;
+ // broadcast
+ const int groupID;
+ // the new resource status event
+ const AgpsRsrcStatus rsrcStatus;
+ // should the subscriber be deleted after the notification
+ const bool postNotifyDelete;
+
+ // convenient constructor
+ inline Notification(const int broadcast,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber,
+ const AgpsRsrcStatus status,
+ const bool deleteAfterwards) :
+ rcver(subscriber), groupID(-1), rsrcStatus(status),
+ postNotifyDelete(deleteAfterwards) {}
+
+ // convenient constructor
+ inline Notification(const int broadcast) :
+ rcver(NULL), groupID(broadcast), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+
+ // convenient constructor
+ inline Notification(const Subscriber* subscriber) :
+ rcver(subscriber), groupID(-1), rsrcStatus(RSRC_STATUS_MAX),
+ postNotifyDelete(false) {}
+};
+
+class AgpsState {
+ // allows AgpsStateMachine to access private data
+ // no class members are public. We don't want
+ // anyone but state machine to use state.
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+ // state transitions are done here.
+ // Each state implements its own transitions (of course).
+ inline virtual AgpsState* onRsrcEvent(AgpsRsrcStatus event, void* data) = 0;
+
+protected:
+ // handle back to state machine
+ const AgpsStateMachine* mStateMachine;
+ // each state has pointers to all 3 states
+ // one of which is to itself.
+ AgpsState* mReleasedState;
+ AgpsState* mAcquiredState;
+ AgpsState* mPendingState;
+ AgpsState* mReleasingState;
+
+ inline AgpsState(const AgpsStateMachine *stateMachine) :
+ mStateMachine(stateMachine),
+ mReleasedState(NULL),
+ mAcquiredState(NULL),
+ mPendingState(NULL),
+ mReleasingState(NULL) {}
+ virtual ~AgpsState() {}
+
+public:
+ // for logging purpose
+ inline virtual char* whoami() = 0;
+};
+
+class Servicer {
+ void (*callback)(void);
+public:
+ static Servicer* getServicer(servicerType type, void *cb_func);
+ virtual int requestRsrc(void *cb_data);
+ Servicer() {}
+ Servicer(void *cb_func)
+ { callback = (void(*)(void))(cb_func); }
+ virtual ~Servicer(){}
+ inline virtual char *whoami() {return (char*)"Servicer";}
+};
+
+class ExtServicer : public Servicer {
+ int (*callbackExt)(void *cb_data);
+public:
+ int requestRsrc(void *cb_data);
+ ExtServicer() {}
+ ExtServicer(void *cb_func)
+ { callbackExt = (int(*)(void *))(cb_func); }
+ virtual ~ExtServicer(){}
+ inline virtual char *whoami() {return (char*)"ExtServicer";}
+};
+
+class AGpsServicer : public Servicer {
+ void (*callbackAGps)(AGpsStatus* status);
+public:
+ int requestRsrc(void *cb_data);
+ AGpsServicer() {}
+ AGpsServicer(void *cb_func)
+ { callbackAGps = (void(*)(AGpsStatus *))(cb_func); }
+ virtual ~AGpsServicer(){}
+ inline virtual char *whoami() {return (char*)"AGpsServicer";}
+};
+
+class AgpsStateMachine {
+protected:
+ // a linked list of subscribers.
+ void* mSubscribers;
+ //handle to whoever provides the service
+ Servicer *mServicer;
+ // allows AgpsState to access private data
+ // each state is really internal data to the
+ // state machine, so it should be able to
+ // access anything within the state machine.
+ friend class AgpsState;
+ // pointer to the current state.
+ AgpsState* mStatePtr;
+private:
+ // NIF type: AGNSS or INTERNET.
+ const AGpsExtType mType;
+ // apn to the NIF. Each state machine tracks
+ // resource state of a particular NIF. For each
+ // NIF, there is also an active APN.
+ char* mAPN;
+ // for convenience, we don't do strlen each time.
+ unsigned int mAPNLen;
+ // bear
+ AGpsBearerType mBearer;
+ // ipv4 address for routing
+ bool mEnforceSingleSubscriber;
+
+public:
+ AgpsStateMachine(servicerType servType, void *cb_func,
+ AGpsExtType type, bool enforceSingleSubscriber);
+ virtual ~AgpsStateMachine();
+
+ // self explanatory methods below
+ void setAPN(const char* apn, unsigned int len);
+ inline const char* getAPN() const { return (const char*)mAPN; }
+ inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return (AGpsExtType)mType; }
+
+ // someone, a ATL client or BIT, is asking for NIF
+ void subscribeRsrc(Subscriber *subscriber);
+
+ // someone, a ATL client or BIT, is done with NIF
+ bool unsubscribeRsrc(Subscriber *subscriber);
+
+ // add a subscriber in the linked list, if not already there.
+ void addSubscriber(Subscriber* subscriber) const;
+
+ virtual void onRsrcEvent(AgpsRsrcStatus event);
+
+ // put the data together and send the FW
+ virtual int sendRsrcRequest(AGpsStatusValue action) const;
+
+ //if list is empty, linked_list_empty returns 1
+ //else if list is not empty, returns 0
+ //so hasSubscribers() returns 1 if list is not empty
+ //and returns 0 if list is empty
+ inline bool hasSubscribers() const
+ { return !linked_list_empty(mSubscribers); }
+
+ bool hasActiveSubscribers() const;
+
+ inline void dropAllSubscribers() const
+ { linked_list_flush(mSubscribers); }
+
+ // private. Only a state gets to call this.
+ void notifySubscribers(Notification& notification) const;
+
+};
+
+class DSStateMachine : public AgpsStateMachine {
+ static const unsigned char MAX_START_DATA_CALL_RETRIES;
+ static const unsigned int DATA_CALL_RETRY_DELAY_MSEC;
+ LocEngAdapter* mLocAdapter;
+ unsigned char mRetries;
+public:
+ DSStateMachine(servicerType type,
+ void *cb_func,
+ LocEngAdapter* adapterHandle);
+ int sendRsrcRequest(AGpsStatusValue action) const;
+ void onRsrcEvent(AgpsRsrcStatus event);
+ void retryCallback();
+ void informStatus(AgpsRsrcStatus status, int ID) const;
+ inline void incRetries() {mRetries++;}
+ inline virtual char *whoami() {return (char*)"DSStateMachine";}
+};
+
+// each subscriber is a AGPS client. In the case of ATL, there could be
+// multiple clients from modem. In the case of BIT, there is only one
+// cilent from BIT daemon.
+struct Subscriber {
+ const uint32_t ID;
+ const AgpsStateMachine* mStateMachine;
+ inline Subscriber(const int id,
+ const AgpsStateMachine* stateMachine) :
+ ID(id), mStateMachine(stateMachine) {}
+ inline virtual ~Subscriber() {}
+
+ virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ virtual void setIPAddresses(struct sockaddr_storage& addr) = 0;
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ { ssid[0] = 0; password[0] = 0; }
+
+ inline virtual bool equals(const Subscriber *s) const
+ { return ID == s->ID; }
+
+ // notifies a subscriber a new NIF resource status, usually
+ // either GRANTE, DENIED, or RELEASED
+ virtual bool notifyRsrcStatus(Notification ¬ification) = 0;
+
+ virtual bool waitForCloseComplete() { return false; }
+ virtual void setInactive() {}
+ virtual bool isInactive() { return false; }
+
+ virtual Subscriber* clone() = 0;
+ // checks if this notification is for me, i.e.
+ // either has my id, or has a broadcast id.
+ bool forMe(Notification ¬ification);
+};
+
+// BITSubscriber, created with requests from BIT daemon
+struct BITSubscriber : public Subscriber {
+ char mIPv6Addr[16];
+
+ inline BITSubscriber(const AgpsStateMachine* stateMachine,
+ unsigned int ipv4, char* ipv6) :
+ Subscriber(ipv4, stateMachine)
+ {
+ if (NULL == ipv6) {
+ mIPv6Addr[0] = 0;
+ } else {
+ memcpy(mIPv6Addr, ipv6, sizeof(mIPv6Addr));
+ }
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ }
+
+ virtual Subscriber* clone()
+ {
+ return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
+ }
+
+ virtual bool equals(const Subscriber *s) const;
+ inline virtual ~BITSubscriber(){}
+};
+
+// ATLSubscriber, created with requests from ATL
+struct ATLSubscriber : public Subscriber {
+ const LocEngAdapter* mLocAdapter;
+ const bool mBackwardCompatibleMode;
+ inline ATLSubscriber(const int id,
+ const AgpsStateMachine* stateMachine,
+ const LocEngAdapter* adapter,
+ const bool compatibleMode) :
+ Subscriber(id, stateMachine), mLocAdapter(adapter),
+ mBackwardCompatibleMode(compatibleMode){}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6)
+ { v4 = INADDR_NONE; v6[0] = 0; }
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual Subscriber* clone()
+ {
+ return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
+ mBackwardCompatibleMode);
+ }
+ inline virtual ~ATLSubscriber(){}
+};
+
+// WIFISubscriber, created with requests from MSAPM or QuIPC
+struct WIFISubscriber : public Subscriber {
+ char * mSSID;
+ char * mPassword;
+ loc_if_req_sender_id_e_type senderId;
+ bool mIsInactive;
+ inline WIFISubscriber(const AgpsStateMachine* stateMachine,
+ char * ssid, char * password, loc_if_req_sender_id_e_type sender_id) :
+ Subscriber(sender_id, stateMachine),
+ mSSID(NULL == ssid ? NULL : new char[SSID_BUF_SIZE]),
+ mPassword(NULL == password ? NULL : new char[SSID_BUF_SIZE]),
+ senderId(sender_id)
+ {
+ if (NULL != mSSID)
+ strlcpy(mSSID, ssid, SSID_BUF_SIZE);
+ if (NULL != mPassword)
+ strlcpy(mPassword, password, SSID_BUF_SIZE);
+ mIsInactive = false;
+ }
+
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
+ inline virtual void setWifiInfo(char* ssid, char* password)
+ {
+ if (NULL != mSSID)
+ strlcpy(ssid, mSSID, SSID_BUF_SIZE);
+ else
+ ssid[0] = '\0';
+ if (NULL != mPassword)
+ strlcpy(password, mPassword, SSID_BUF_SIZE);
+ else
+ password[0] = '\0';
+ }
+
+ inline virtual bool waitForCloseComplete() { return true; }
+
+ inline virtual void setInactive() { mIsInactive = true; }
+ inline virtual bool isInactive() { return mIsInactive; }
+
+ virtual Subscriber* clone()
+ {
+ return new WIFISubscriber(mStateMachine, mSSID, mPassword, senderId);
+ }
+ inline virtual ~WIFISubscriber(){}
+};
+
+struct DSSubscriber : public Subscriber {
+ bool mIsInactive;
+ inline DSSubscriber(const AgpsStateMachine *stateMachine,
+ const int id) :
+ Subscriber(id, stateMachine)
+ {
+ mIsInactive = false;
+ }
+ inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+ virtual Subscriber* clone()
+ {return new DSSubscriber(mStateMachine, ID);}
+ virtual bool notifyRsrcStatus(Notification ¬ification);
+ inline virtual bool waitForCloseComplete() { return true; }
+ virtual void setInactive();
+ inline virtual bool isInactive()
+ { return mIsInactive; }
+ inline virtual ~DSSubscriber(){}
+ inline virtual char *whoami() {return (char*)"DSSubscriber";}
+};
+
+#endif //__LOC_ENG_AGPS_H__
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
new file mode 100644
index 0000000..c257dff
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp
@@ -0,0 +1,270 @@
+/* Copyright (c) 2011-2012, 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 <linux/stat.h>
+#include <fcntl.h>
+#include <linux/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <grp.h>
+#include <sys/stat.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_msg.h"
+
+static int loc_api_server_msgqid;
+static int loc_api_resp_msgqid;
+static int quipc_msgqid;
+static int msapm_msgqid;
+static int msapu_msgqid;
+
+static const char * global_loc_api_q_path = GPSONE_LOC_API_Q_PATH;
+static const char * global_loc_api_resp_q_path = GPSONE_LOC_API_RESP_Q_PATH;
+static const char * global_quipc_ctrl_q_path = QUIPC_CTRL_Q_PATH;
+static const char * global_msapm_ctrl_q_path = MSAPM_CTRL_Q_PATH;
+static const char * global_msapu_ctrl_q_path = MSAPU_CTRL_Q_PATH;
+
+static int loc_api_server_proc_init(void *context)
+{
+ loc_api_server_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_q_path, O_RDWR);
+ //change mode/group for the global_loc_api_q_path pipe
+ int result = chmod (global_loc_api_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_q_path, strerror(errno));
+ }
+
+ struct group * gps_group = getgrnam("gps");
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_q_path, gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+ else
+ {
+ LOC_LOGE("getgrnam for gps failed, error code = %d\n", errno);
+ }
+
+ loc_api_resp_msgqid = loc_eng_dmn_conn_glue_msgget(global_loc_api_resp_q_path, O_RDWR);
+
+ //change mode/group for the global_loc_api_resp_q_path pipe
+ result = chmod (global_loc_api_resp_q_path, 0660);
+ if (result != 0)
+ {
+ LOC_LOGE("failed to change mode for %s, error = %s\n", global_loc_api_resp_q_path, strerror(errno));
+ }
+
+ if (gps_group != NULL)
+ {
+ result = chown (global_loc_api_resp_q_path, -1, gps_group->gr_gid);
+ if (result != 0)
+ {
+ LOC_LOGE("chown for pipe failed, pipe %s, gid = %d, result = %d, error = %s\n",
+ global_loc_api_resp_q_path,
+ gps_group->gr_gid, result, strerror(errno));
+ }
+ }
+
+ quipc_msgqid = loc_eng_dmn_conn_glue_msgget(global_quipc_ctrl_q_path, O_RDWR);
+ msapm_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapm_ctrl_q_path , O_RDWR);
+ msapu_msgqid = loc_eng_dmn_conn_glue_msgget(global_msapu_ctrl_q_path , O_RDWR);
+
+ LOC_LOGD("%s:%d] loc_api_server_msgqid = %d\n", __func__, __LINE__, loc_api_server_msgqid);
+ return 0;
+}
+
+static int loc_api_server_proc_pre(void *context)
+{
+ return 0;
+}
+
+static int loc_api_server_proc(void *context)
+{
+ int length, sz;
+ int result = 0;
+ static int cnt = 0;
+ struct ctrl_msgbuf * p_cmsgbuf;
+ struct ctrl_msgbuf cmsg_resp;
+
+ sz = sizeof(struct ctrl_msgbuf) + 256;
+ p_cmsgbuf = (struct ctrl_msgbuf *) malloc(sz);
+
+ if (!p_cmsgbuf) {
+ LOC_LOGE("%s:%d] Out of memory\n", __func__, __LINE__);
+ return -1;
+ }
+
+ cnt ++;
+ LOC_LOGD("%s:%d] %d listening on %s...\n", __func__, __LINE__, cnt, (char *) context);
+ length = loc_eng_dmn_conn_glue_msgrcv(loc_api_server_msgqid, p_cmsgbuf, sz);
+ if (length <= 0) {
+ free(p_cmsgbuf);
+ LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__);
+ usleep(1000);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ switch(p_cmsgbuf->ctrl_type) {
+ case GPSONE_LOC_API_IF_REQUEST:
+ result = loc_eng_dmn_conn_loc_api_server_if_request_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_LOC_API_IF_RELEASE:
+ result = loc_eng_dmn_conn_loc_api_server_if_release_handler(p_cmsgbuf, length);
+ break;
+
+ case GPSONE_UNBLOCK:
+ LOC_LOGD("%s:%d] GPSONE_UNBLOCK\n", __func__, __LINE__);
+ break;
+
+ default:
+ LOC_LOGE("%s:%d] unsupported ctrl_type = %d\n",
+ __func__, __LINE__, p_cmsgbuf->ctrl_type);
+ break;
+ }
+
+ free(p_cmsgbuf);
+ return 0;
+}
+
+static int loc_api_server_proc_post(void *context)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_q_path, loc_api_server_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_loc_api_resp_q_path, loc_api_resp_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_quipc_ctrl_q_path, quipc_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapm_ctrl_q_path, msapm_msgqid);
+ loc_eng_dmn_conn_glue_msgremove( global_msapu_ctrl_q_path, msapu_msgqid);
+ return 0;
+}
+
+static int loc_eng_dmn_conn_unblock_proc(void)
+{
+ struct ctrl_msgbuf cmsgbuf;
+ cmsgbuf.ctrl_type = GPSONE_UNBLOCK;
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+ loc_eng_dmn_conn_glue_msgsnd(loc_api_server_msgqid, & cmsgbuf, sizeof(cmsgbuf));
+ return 0;
+}
+
+static struct loc_eng_dmn_conn_thelper thelper;
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * resp_q_path, void *agps_handle)
+{
+ int result;
+
+ loc_api_handle = agps_handle;
+
+ if (loc_api_q_path) global_loc_api_q_path = loc_api_q_path;
+ if (resp_q_path) global_loc_api_resp_q_path = resp_q_path;
+
+ result = loc_eng_dmn_conn_launch_thelper( &thelper,
+ loc_api_server_proc_init,
+ loc_api_server_proc_pre,
+ loc_api_server_proc,
+ loc_api_server_proc_post,
+ create_thread_cb,
+ (char *) global_loc_api_q_path);
+ if (result != 0) {
+ LOC_LOGE("%s:%d]\n", __func__, __LINE__);
+ return -1;
+ }
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_unblock(void)
+{
+ loc_eng_dmn_conn_unblock_thelper(&thelper);
+ loc_eng_dmn_conn_unblock_proc();
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_join(void)
+{
+ loc_eng_dmn_conn_join_thelper(&thelper);
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_data_conn(int sender_id, int status) {
+ struct ctrl_msgbuf cmsgbuf;
+ LOC_LOGD("%s:%d] quipc_msgqid = %d\n", __func__, __LINE__, quipc_msgqid);
+ cmsgbuf.ctrl_type = GPSONE_LOC_API_RESPONSE;
+ cmsgbuf.cmsg.cmsg_response.result = status;
+ switch (sender_id) {
+ case LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(quipc_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapm_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(msapu_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ case LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON: {
+ LOC_LOGD("%s:%d] sender_id = LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON", __func__, __LINE__);
+ if (loc_eng_dmn_conn_glue_msgsnd(loc_api_resp_msgqid, & cmsgbuf, sizeof(struct ctrl_msgbuf)) < 0) {
+ LOC_LOGD("%s:%d] error! conn_glue_msgsnd failed\n", __func__, __LINE__);
+ return -1;
+ }
+ break;
+ }
+ default: {
+ LOC_LOGD("%s:%d] invalid sender ID!", __func__, __LINE__);
+ }
+ }
+ return 0;
+}
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
new file mode 100644
index 0000000..1d8c142
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn.h
@@ -0,0 +1,59 @@
+/* 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_ENG_DATA_SERVER_H
+#define LOC_ENG_DATA_SERVER_H
+
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+#ifdef _ANDROID_
+
+#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q"
+
+#else
+
+#define GPSONE_LOC_API_Q_PATH "/tmp/gpsone_loc_api_q"
+#define GPSONE_LOC_API_RESP_Q_PATH "/tmp/gpsone_loc_api_resp_q"
+#define QUIPC_CTRL_Q_PATH "/tmp/quipc_ctrl_q"
+#define MSAPM_CTRL_Q_PATH "/tmp/msapm_ctrl_q"
+#define MSAPU_CTRL_Q_PATH "/tmp/msapu_ctrl_q"
+
+#endif
+
+int loc_eng_dmn_conn_loc_api_server_launch(thelper_create_thread create_thread_cb,
+ const char * loc_api_q_path, const char * ctrl_q_path, void *agps_handle);
+int loc_eng_dmn_conn_loc_api_server_unblock(void);
+int loc_eng_dmn_conn_loc_api_server_join(void);
+int loc_eng_dmn_conn_loc_api_server_data_conn(int, int);
+
+#endif /* LOC_ENG_DATA_SERVER_H */
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
new file mode 100644
index 0000000..a1076ff
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c
@@ -0,0 +1,223 @@
+/* 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.
+ *
+ */
+#include <linux/stat.h>
+#include <fcntl.h>
+
+#include <linux/types.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_glue_msg.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgget
+
+DESCRIPTION
+ This function get a message queue
+
+ q_path - name path of the message queue
+ mode -
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ message queue id
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode)
+{
+ int msgqid;
+ msgqid = loc_eng_dmn_conn_glue_pipeget(q_path, mode);
+ return msgqid;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgremove
+
+DESCRIPTION
+ remove a message queue
+
+ q_path - name path of the message queue
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid)
+{
+ int result;
+ result = loc_eng_dmn_conn_glue_piperemove(q_path, msgqid);
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgsnd
+
+DESCRIPTION
+ Send a message
+
+ msgqid - message queue id
+ msgp - pointer to the message to be sent
+ msgsz - size of the message
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes sent out or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+ pmsg->msgsz = msgsz;
+
+ result = loc_eng_dmn_conn_glue_pipewrite(msgqid, msgp, msgsz);
+ if (result != (int) msgsz) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) msgsz);
+ return -1;
+ }
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgrcv
+
+DESCRIPTION
+ receive a message
+
+ msgqid - message queue id
+ msgp - pointer to the buffer to hold the message
+ msgsz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes received or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgbufsz)
+{
+ int result;
+ struct ctrl_msgbuf *pmsg = (struct ctrl_msgbuf *) msgp;
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, &(pmsg->msgsz), sizeof(pmsg->msgsz));
+ if (result != sizeof(pmsg->msgsz)) {
+ LOC_LOGE("%s:%d] pipe broken %d\n", __func__, __LINE__, result);
+ return -1;
+ }
+
+ if (msgbufsz < pmsg->msgsz) {
+ LOC_LOGE("%s:%d] msgbuf is too small %d < %d\n", __func__, __LINE__, (int) msgbufsz, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ result = loc_eng_dmn_conn_glue_piperead(msgqid, (uint8_t *) msgp + sizeof(pmsg->msgsz), pmsg->msgsz - sizeof(pmsg->msgsz));
+ if (result != (int) (pmsg->msgsz - sizeof(pmsg->msgsz))) {
+ LOC_LOGE("%s:%d] pipe broken %d, msgsz = %d\n", __func__, __LINE__, result, (int) pmsg->msgsz);
+ return -1;
+ }
+
+ return pmsg->msgsz;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgunblock
+
+DESCRIPTION
+ unblock a message queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid)
+{
+ return loc_eng_dmn_conn_glue_pipeunblock(msgqid);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_msgflush
+
+DESCRIPTION
+ flush out the message in a queue
+
+ msgqid - message queue id
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes that are flushed out.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_msgflush(int msgqid)
+{
+ int length;
+ char buf[128];
+
+ do {
+ length = loc_eng_dmn_conn_glue_piperead(msgqid, buf, 128);
+ LOC_LOGD("%s:%d] %s\n", __func__, __LINE__, buf);
+ } while(length);
+ return length;
+}
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
new file mode 100644
index 0000000..d685c87
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.h
@@ -0,0 +1,51 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_MSG_H
+#define LOC_ENG_DMN_CONN_GLUE_MSG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#include <linux/types.h>
+#include "loc_eng_dmn_conn_glue_pipe.h"
+
+int loc_eng_dmn_conn_glue_msgget(const char * q_path, int mode);
+int loc_eng_dmn_conn_glue_msgremove(const char * q_path, int msgqid);
+int loc_eng_dmn_conn_glue_msgsnd(int msgqid, const void * msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgrcv(int msgqid, void *msgp, size_t msgsz);
+int loc_eng_dmn_conn_glue_msgflush(int msgqid);
+int loc_eng_dmn_conn_glue_msgunblock(int msgqid);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_MSG_H */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
new file mode 100644
index 0000000..dffcad0
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c
@@ -0,0 +1,214 @@
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+// #include <linux/stat.h>
+#include <fcntl.h>
+// #include <linux/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include "loc_eng_dmn_conn_glue_pipe.h"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeget
+
+DESCRIPTION
+ create a named pipe.
+
+ pipe_name - pipe name path
+ mode - mode
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode)
+{
+ int fd;
+ int result;
+
+ LOC_LOGD("%s, mode = %d\n", pipe_name, mode);
+ result = mkfifo(pipe_name, 0660);
+
+ if ((result == -1) && (errno != EEXIST)) {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ return result;
+ }
+
+ // The mode in mkfifo is not honoured and does not provide the
+ // group permissions. Doing chmod to add group permissions.
+ result = chmod (pipe_name, 0660);
+ if (result != 0){
+ LOC_LOGE ("%s failed to change mode for %s, error = %s\n", __func__,
+ pipe_name, strerror(errno));
+ }
+
+ fd = open(pipe_name, mode);
+ if (fd <= 0)
+ {
+ LOC_LOGE("failed: %s\n", strerror(errno));
+ }
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return fd;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperemove
+
+DESCRIPTION
+ remove a pipe
+
+ pipe_name - pipe name path
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd)
+{
+ close(fd);
+ if (pipe_name) unlink(pipe_name);
+ LOC_LOGD("fd = %d, %s\n", fd, pipe_name);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipewrite
+
+DESCRIPTION
+ write to a pipe
+
+ fd - fd of a pipe
+ buf - buffer for the data to write
+ sz - size of the data in buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes written or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz)
+{
+ int result;
+
+ result = write(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, result = %d\n", fd, (long) buf, (int) sz, (int) result); */
+ return result;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_piperead
+
+DESCRIPTION
+ read from a pipe
+
+ fd - fd for the pipe
+ buf - buffer to hold the data read from pipe
+ sz - size of the buffer
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ number of bytes read from pipe or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz)
+{
+ int len;
+
+ len = read(fd, buf, sz);
+
+ /* @todo check for non EINTR & EAGAIN, shall not do select again, select_tut Law 7) */
+
+ /* LOC_LOGD("fd = %d, buf = 0x%lx, size = %d, len = %d\n", fd, (long) buf, (int) sz, len); */
+ return len;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_glue_pipeunblock
+
+DESCRIPTION
+ unblock a pipe
+
+ fd - fd for the pipe
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 for success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_glue_pipeunblock(int fd)
+{
+ int result;
+ struct flock flock_v;
+ LOC_LOGD("\n");
+// result = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY);
+ flock_v.l_type = F_UNLCK;
+ flock_v.l_len = 32;
+ result = fcntl(fd, F_SETLK, &flock_v);
+ if (result < 0) {
+ LOC_LOGE("fcntl failure, %s\n", strerror(errno));
+ }
+
+ return result;
+}
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
new file mode 100644
index 0000000..b2fa3a0
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.h
@@ -0,0 +1,50 @@
+/* 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 LOC_ENG_DMN_CONN_GLUE_PIPE_H
+#define LOC_ENG_DMN_CONN_GLUE_PIPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <linux/types.h>
+
+int loc_eng_dmn_conn_glue_pipeget(const char * pipe_name, int mode);
+int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd);
+int loc_eng_dmn_conn_glue_pipewrite(int fd, const void * buf, size_t sz);
+int loc_eng_dmn_conn_glue_piperead(int fd, void * buf, size_t sz);
+
+int loc_eng_dmn_conn_glue_pipeflush(int fd);
+int loc_eng_dmn_conn_glue_pipeunblock(int fd);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_DMN_CONN_GLUE_PIPE_H */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
new file mode 100644
index 0000000..edd53f2
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-2012, 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 <string.h>
+#include <unistd.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_msg.h"
+#include "loc_eng_dmn_conn.h"
+#include "loc_eng_dmn_conn_handler.h"
+
+void* loc_api_handle = NULL;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ if (NULL == loc_api_handle) {
+ LOC_LOGE("%s:%d] NO agps data handle\n", __func__, __LINE__);
+ return 1;
+ }
+
+ if (NULL != loc_api_handle) {
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ true);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ true);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+ }
+
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_REQUEST_SUCCESS);
+#endif
+ return 0;
+}
+
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len)
+{
+ LOC_LOGD("%s:%d]\n", __func__, __LINE__);
+#ifndef DEBUG_DMN_LOC_API
+ AGpsExtType type;
+ switch (pmsg->cmsg.cmsg_if_request.type) {
+ case IF_REQUEST_TYPE_SUPL:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_SUPL");
+ type = AGPS_TYPE_SUPL;
+ break;
+ }
+ case IF_REQUEST_TYPE_WIFI:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_WIFI");
+ type = AGPS_TYPE_WIFI;
+ break;
+ }
+ case IF_REQUEST_TYPE_ANY:
+ {
+ LOC_LOGD("IF_REQUEST_TYPE_ANY");
+ type = AGPS_TYPE_ANY;
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_TYPE!");
+ return -1;
+ }
+ }
+ switch (pmsg->cmsg.cmsg_if_request.sender_id) {
+ case IF_REQUEST_SENDER_ID_QUIPC:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_QUIPC");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPM:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPM");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_MSAPU:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_MSAPU");
+ LocEngReqRelWifi* msg =
+ new LocEngReqRelWifi(loc_api_handle,
+ type,
+ LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU,
+ (char*)pmsg->cmsg.cmsg_if_request.ssid,
+ (char*)pmsg->cmsg.cmsg_if_request.password,
+ false);
+ msg->send();
+ break;
+ }
+ case IF_REQUEST_SENDER_ID_GPSONE_DAEMON:
+ {
+ LOC_LOGD("IF_REQUEST_SENDER_ID_GPSONE_DAEMON");
+ LocEngReqRelBIT* msg =
+ new LocEngReqRelBIT(loc_api_handle,
+ type,
+ pmsg->cmsg.cmsg_if_request.ipv4_addr,
+ (char*)pmsg->cmsg.cmsg_if_request.ipv6_addr,
+ false);
+ msg->send();
+ break;
+ }
+ default:
+ {
+ LOC_LOGD("invalid IF_REQUEST_SENDER_ID!");
+ return -1;
+ }
+ }
+#else
+ loc_eng_dmn_conn_loc_api_server_data_conn(LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, GPSONE_LOC_API_IF_RELEASE_SUCCESS);
+#endif
+ return 0;
+}
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
new file mode 100644
index 0000000..1c0edd5
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011-2012, 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_DATA_SERVER_HANDLER
+#define LOC_ENG_DATA_SERVER_HANDLER
+
+#include <linux/types.h>
+#include <arpa/inet.h>
+
+//for SSID_BUF_SIZE
+#include <hardware/gps.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+
+enum {
+ /* 0x0 - 0xEF is reserved for daemon internal */
+ GPSONE_LOC_API_IF_REQUEST = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE,
+ GPSONE_LOC_API_RESPONSE,
+ GPSONE_UNBLOCK,
+};
+
+enum {
+ GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
+ GPSONE_LOC_API_IF_RELEASE_SUCCESS,
+ GPSONE_LOC_API_IF_FAILURE,
+};
+
+
+struct ctrl_msg_response {
+ int result;
+};
+
+struct ctrl_msg_unblock {
+ int reserved;
+};
+
+typedef enum {
+ IF_REQUEST_TYPE_SUPL = 0,
+ IF_REQUEST_TYPE_WIFI,
+ IF_REQUEST_TYPE_ANY
+} ctrl_if_req_type_e_type;
+
+typedef enum {
+ IF_REQUEST_SENDER_ID_QUIPC = 0,
+ IF_REQUEST_SENDER_ID_MSAPM,
+ IF_REQUEST_SENDER_ID_MSAPU,
+ IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
+ IF_REQUEST_SENDER_ID_MODEM
+} ctrl_if_req_sender_id_e_type;
+
+struct ctrl_msg_if_request {
+ ctrl_if_req_type_e_type type;
+ ctrl_if_req_sender_id_e_type sender_id;
+ unsigned long ipv4_addr;
+ unsigned char ipv6_addr[16];
+ char ssid[SSID_BUF_SIZE];
+ char password[SSID_BUF_SIZE];
+};
+
+/* do not change this structure */
+struct ctrl_msgbuf {
+ size_t msgsz;
+ uint16_t reserved1;
+ uint32_t reserved2;
+ uint8_t ctrl_type;
+ union {
+ struct ctrl_msg_response cmsg_response;
+ struct ctrl_msg_unblock cmsg_unblock;
+ struct ctrl_msg_if_request cmsg_if_request;
+ } cmsg;
+};
+
+extern void* loc_api_handle;
+
+int loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
+int loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
+
+#endif /* LOC_ENG_DATA_SERVER_HANDLER */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
new file mode 100644
index 0000000..9fed9d4
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c
@@ -0,0 +1,399 @@
+/* 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.
+ *
+ */
+#include <stdio.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "loc_eng_dmn_conn_thread_helper.h"
+
+/*===========================================================================
+FUNCTION thelper_signal_init
+
+DESCRIPTION
+ This function will initialize the conditional variable resources.
+
+ thelper - thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+ thelper->thread_exit = 0;
+ thelper->thread_ready = 0;
+ result = pthread_cond_init( &thelper->thread_cond, NULL);
+ if (result) {
+ return result;
+ }
+
+ result = pthread_mutex_init(&thelper->thread_mutex, NULL);
+ if (result) {
+ pthread_cond_destroy(&thelper->thread_cond);
+ }
+ return result;
+}
+
+/*===========================================================================
+FUNCTION
+
+DESCRIPTION
+ This function will destroy the conditional variable resources
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result, ret_result = 0;
+ result = pthread_cond_destroy( &thelper->thread_cond);
+ if (result) {
+ ret_result = result;
+ }
+
+ result = pthread_mutex_destroy(&thelper->thread_mutex);
+ if (result) {
+ ret_result = result;
+ }
+
+ return ret_result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_wait
+
+DESCRIPTION
+ This function will be blocked on the conditional variable until thelper_signal_ready
+ is called
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = 0;
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ if (!thelper->thread_ready && !thelper->thread_exit) {
+ result = pthread_cond_wait(&thelper->thread_cond, &thelper->thread_mutex);
+ }
+
+ if (thelper->thread_exit) {
+ result = -1;
+ }
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_ready
+
+DESCRIPTION
+ This function will wake up the conditional variable
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 1;
+ result = pthread_cond_signal(&thelper->thread_cond);
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_signal_block
+
+DESCRIPTION
+ This function will set the thread ready to 0 to block the thelper_signal_wait
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ if thread_ready is set
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result = thelper->thread_ready;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ pthread_mutex_lock(&thelper->thread_mutex);
+ thelper->thread_ready = 0;
+ pthread_mutex_unlock(&thelper->thread_mutex);
+
+ return result;
+}
+
+/*===========================================================================
+FUNCTION thelper_main
+
+DESCRIPTION
+ This function is the main thread. It will be launched as a child thread
+
+ data - pointer to the instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ NULL
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void * thelper_main(void *data)
+{
+ int result = 0;
+ struct loc_eng_dmn_conn_thelper * thelper = (struct loc_eng_dmn_conn_thelper *) data;
+
+ if (thelper->thread_proc_init) {
+ result = thelper->thread_proc_init(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ thelper_signal_ready(thelper);
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ thelper_signal_ready(thelper);
+
+ if (thelper->thread_proc_pre) {
+ result = thelper->thread_proc_pre(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return NULL;
+ }
+ }
+
+ do {
+ if (thelper->thread_proc) {
+ result = thelper->thread_proc(thelper->thread_context);
+ if (result < 0) {
+ thelper->thread_exit = 1;
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ }
+ } while (thelper->thread_exit == 0);
+
+ if (thelper->thread_proc_post) {
+ result = thelper->thread_proc_post(thelper->thread_context);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] error: 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ return NULL;
+}
+
+static void thelper_main_2(void *data)
+{
+ thelper_main(data);
+ return;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_launch_thelper
+
+DESCRIPTION
+ This function will initialize the thread context and launch the thelper_main
+
+ thelper - pointer to thelper instance
+ thread_proc_init - The initialization function pointer
+ thread_proc_pre - The function to call before task loop and after initialization
+ thread_proc - The task loop
+ thread_proc_post - The function to call after the task loop
+ context - the context for the above four functions
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context)
+{
+ int result;
+
+ thelper_signal_init(thelper);
+
+ if (context) {
+ thelper->thread_context = context;
+ }
+
+ thelper->thread_proc_init = thread_proc_init;
+ thelper->thread_proc_pre = thread_proc_pre;
+ thelper->thread_proc = thread_proc;
+ thelper->thread_proc_post = thread_proc_post;
+
+ LOC_LOGD("%s:%d] 0x%lx call pthread_create\n", __func__, __LINE__, (long) thelper);
+ if (create_thread_cb) {
+ result = 0;
+ thelper->thread_id = create_thread_cb("loc_eng_dmn_conn",
+ thelper_main_2, (void *)thelper);
+ } else {
+ result = pthread_create(&thelper->thread_id, NULL,
+ thelper_main, (void *)thelper);
+ }
+
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ return -1;
+ }
+
+ LOC_LOGD("%s:%d] 0x%lx pthread_create done\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_wait(thelper);
+
+ LOC_LOGD("%s:%d] 0x%lx pthread ready\n", __func__, __LINE__, (long) thelper);
+ return thelper->thread_exit;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_unblock_thelper
+
+DESCRIPTION
+ This function unblocks thelper_main to release the thread
+
+ thelper - pointer to thelper instance
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ thelper->thread_exit = 1;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_dmn_conn_join_thelper
+
+ thelper - pointer to thelper instance
+
+DESCRIPTION
+ This function will wait for the thread of thelper_main to finish
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success or negative value for failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper)
+{
+ int result;
+
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ result = pthread_join(thelper->thread_id, NULL);
+ if (result != 0) {
+ LOC_LOGE("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+ }
+ LOC_LOGD("%s:%d] 0x%lx\n", __func__, __LINE__, (long) thelper);
+
+ thelper_signal_destroy(thelper);
+
+ return result;
+}
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
new file mode 100644
index 0000000..89e598b
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.h
@@ -0,0 +1,74 @@
+/* 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 __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+#define __LOC_ENG_DMN_CONN_THREAD_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <pthread.h>
+
+struct loc_eng_dmn_conn_thelper {
+ unsigned char thread_exit;
+ unsigned char thread_ready;
+ pthread_cond_t thread_cond;
+ pthread_mutex_t thread_mutex;
+ pthread_t thread_id;
+ void * thread_context;
+ int (*thread_proc_init) (void * context);
+ int (*thread_proc_pre) (void * context);
+ int (*thread_proc) (void * context);
+ int (*thread_proc_post) (void * context);
+};
+
+typedef pthread_t (* thelper_create_thread)(const char* name, void (*start)(void *), void* arg);
+int loc_eng_dmn_conn_launch_thelper(struct loc_eng_dmn_conn_thelper * thelper,
+ int (*thread_proc_init) (void * context),
+ int (*thread_proc_pre) (void * context),
+ int (*thread_proc) (void * context),
+ int (*thread_proc_post) (void * context),
+ thelper_create_thread create_thread_cb,
+ void * context);
+
+int loc_eng_dmn_conn_unblock_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+int loc_eng_dmn_conn_join_thelper(struct loc_eng_dmn_conn_thelper * thelper);
+
+/* if only need to use signal */
+int thelper_signal_init(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_destroy(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_wait(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_ready(struct loc_eng_dmn_conn_thelper * thelper);
+int thelper_signal_block(struct loc_eng_dmn_conn_thelper * thelper);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LOC_ENG_DMN_CONN_THREAD_HELPER_H__ */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_log.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_log.cpp
new file mode 100644
index 0000000..3a34167
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_log.cpp
@@ -0,0 +1,35 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include "loc_log.h"
+#include "loc_eng_log.h"
+
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_log.h b/msm8996/loc_api/libloc_api_50001/loc_eng_log.h
new file mode 100644
index 0000000..a68bd84
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_log.h
@@ -0,0 +1,44 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_msg.h b/msm8996/loc_api/libloc_api_50001/loc_eng_msg.h
new file mode 100644
index 0000000..435ffbb
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_msg.h
@@ -0,0 +1,306 @@
+/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef LOC_ENG_MSG_H
+#define LOC_ENG_MSG_H
+
+
+#include <hardware/gps.h>
+#include <gps_extended.h>
+#include <stdlib.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_eng_log.h>
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include <LocEngAdapter.h>
+
+#ifndef SSID_BUF_SIZE
+ #define SSID_BUF_SIZE (32+1)
+#endif
+#ifdef USE_GLIB
+
+#include <glib.h>
+
+#endif /* USE_GLIB */
+#include "platform_lib_includes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+using namespace loc_core;
+
+struct LocEngPositionMode : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const LocPosMode mPosMode;
+ LocEngPositionMode(LocEngAdapter* adapter, LocPosMode &mode);
+ virtual void proc() const;
+ virtual void log() const;
+ void send() const;
+};
+
+
+struct LocEngStartFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStartFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngStopFix : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngStopFix(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportPosition : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const UlpLocation mLocation;
+ const GpsLocationExtended mLocationExtended;
+ const void* mLocationExt;
+ const enum loc_sess_status mStatus;
+ const LocPosTechMask mTechMask;
+ LocEngReportPosition(LocAdapterBase* adapter,
+ UlpLocation &loc,
+ GpsLocationExtended &locExtended,
+ void* locExt,
+ enum loc_sess_status st,
+ LocPosTechMask technology);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportSv : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GnssSvStatus mSvStatus;
+ const GpsLocationExtended mLocationExtended;
+ const void* mSvExt;
+ LocEngReportSv(LocAdapterBase* adapter,
+ GnssSvStatus &sv,
+ GpsLocationExtended &locExtended,
+ void* svExtended);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportStatus : public LocMsg {
+ LocAdapterBase* mAdapter;
+ const GpsStatusValue mStatus;
+ LocEngReportStatus(LocAdapterBase* adapter,
+ GpsStatusValue engineStatus);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportNmea : public LocMsg {
+ void* mLocEng;
+ char* const mNmea;
+ const int mLen;
+ LocEngReportNmea(void* locEng,
+ const char* data, int len);
+ inline virtual ~LocEngReportNmea()
+ {
+ delete[] mNmea;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReportXtraServer : public LocMsg {
+ void* mLocEng;
+ int mMaxLen;
+ char *mServers;
+ LocEngReportXtraServer(void* locEng,
+ const char *url1, const char *url2,
+ const char *url3, const int maxlength);
+ inline virtual ~LocEngReportXtraServer()
+ {
+ delete[] mServers;
+ }
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsOpened : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsOpened(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngSuplEsClosed : public LocMsg {
+ void* mLocEng;
+ LocEngSuplEsClosed(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestSuplEs : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngRequestSuplEs(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ const AGpsExtType mType;
+ LocEngRequestATL(void* locEng, int id,
+ AGpsExtType agps_type);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReleaseATL : public LocMsg {
+ void* mLocEng;
+ const int mID;
+ LocEngReleaseATL(void* locEng, int id);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngReqRelBIT : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const int mIPv4Addr;
+ char* const mIPv6Addr;
+ const bool mIsReq;
+ LocEngReqRelBIT(void* instance, AGpsExtType type,
+ int ipv4, char* ipv6, bool isReq);
+ virtual ~LocEngReqRelBIT();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReqRelWifi : public LocMsg {
+ void* mLocEng;
+ const AGpsExtType mType;
+ const loc_if_req_sender_id_e_type mSenderId;
+ char* const mSSID;
+ char* const mPassword;
+ const bool mIsReq;
+ LocEngReqRelWifi(void* locEng, AGpsExtType type,
+ loc_if_req_sender_id_e_type sender_id,
+ char* s, char* p, bool isReq);
+ virtual ~LocEngReqRelWifi();
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngRequestXtra : public LocMsg {
+ void* mLocEng;
+ LocEngRequestXtra(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestTime : public LocMsg {
+ void* mLocEng;
+ LocEngRequestTime(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngRequestNi : public LocMsg {
+ void* mLocEng;
+ const GpsNiNotification mNotify;
+ const void *mPayload;
+ LocEngRequestNi(void* locEng,
+ GpsNiNotification ¬if,
+ const void* data);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngDown : public LocMsg {
+ void* mLocEng;
+ LocEngDown(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngUp : public LocMsg {
+ void* mLocEng;
+ LocEngUp(void* locEng);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+struct LocEngGetZpp : public LocMsg {
+ LocEngAdapter* mAdapter;
+ LocEngGetZpp(LocEngAdapter* adapter);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+ void send() const;
+};
+
+struct LocEngReportGnssMeasurement : public LocMsg {
+ void* mLocEng;
+ const GnssData mGnssData;
+ LocEngReportGnssMeasurement(void* locEng,
+ GnssData &gnssData);
+ virtual void proc() const;
+ void locallog() const;
+ virtual void log() const;
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LOC_ENG_MSG_H */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_ni.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_ni.cpp
new file mode 100644
index 0000000..4597b98
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_ni.cpp
@@ -0,0 +1,414 @@
+/* Copyright (c) 2009-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+#include <MsgTask.h>
+
+#include <loc_eng.h>
+
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+static void* ni_thread_proc(void *args);
+
+struct LocEngInformNiResponse : public LocMsg {
+ LocEngAdapter* mAdapter;
+ const GpsUserResponseType mResponse;
+ const void *mPayload;
+ inline LocEngInformNiResponse(LocEngAdapter* adapter,
+ GpsUserResponseType resp,
+ const void* data) :
+ LocMsg(), mAdapter(adapter),
+ mResponse(resp), mPayload(data)
+ {
+ locallog();
+ }
+ inline ~LocEngInformNiResponse()
+ {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const
+ {
+ mAdapter->informNiResponse(mResponse, mPayload);
+ }
+ inline void locallog() const
+ {
+ LOC_LOGV("LocEngInformNiResponse - "
+ "response: %s\n mPayload: %p",
+ loc_get_ni_response_name(mResponse),
+ mPayload);
+ }
+ inline virtual void log() const
+ {
+ locallog();
+ }
+};
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data,
+ const GpsNiNotification *notif,
+ const void* passThrough)
+{
+ ENTRY_LOG();
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) {
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ }
+ } else {
+ if (NULL != loc_eng_ni_data_p->session.rawRequest ||
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d",
+ notif->ni_type);
+ if (NULL != passThrough) {
+ free((void*)passThrough);
+ }
+ } else {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+ }
+
+
+ if (pSession) {
+ /* Save request */
+ pSession->rawRequest = (void*)passThrough;
+ pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter;
+ pSession->adapter = loc_eng_data.adapter;
+
+ /* Fill in notification */
+ ((GpsNiNotification*)notif)->notification_id = pSession->reqID;
+
+ if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session(loc_eng_data);
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif->ni_type, notif->timeout, notif->default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif->requestor_id, notif->requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif->text, notif->text_encoding);
+ if (notif->extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif->extras);
+ }
+
+ /* 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 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft);
+
+ int rc = 0;
+ rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(pSession->thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+
+ CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id);
+ loc_eng_data.ni_notify_cb((GpsNiNotification*)notif);
+ }
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+
+FUNCTION ni_thread_proc
+
+===========================================================================*/
+static void* ni_thread_proc(void *args)
+{
+ ENTRY_LOG();
+
+ loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n",
+ (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 = GPS_NI_RESPONSE_NORESP;
+ LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/
+
+ LOC_LOGD("pSession->resp is %d\n",pSession->resp);
+
+ // 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()
+ LocEngAdapter* adapter = pSession->adapter;
+ LocEngInformNiResponse *msg = NULL;
+
+ if (NULL != pSession->rawRequest) {
+ if (pSession->resp != GPS_NI_RESPONSE_IGNORE) {
+ LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n");
+ msg = new LocEngInformNiResponse(adapter,
+ pSession->resp,
+ pSession->rawRequest);
+ } else {
+ LOC_LOGD("this is the ignore reply for SUPL ES\n");
+ free(pSession->rawRequest);
+ }
+ pSession->rawRequest = NULL;
+ }
+ pthread_mutex_unlock(&pSession->tLock);
+
+ pSession->respTimeLeft = 0;
+ pSession->reqID = 0;
+
+ if (NULL != msg) {
+ LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n");
+ adapter->sendMsg(msg);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+ return NULL;
+}
+
+void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ // only if modem has requested but then died.
+ if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ free(loc_eng_ni_data_p->sessionEs.rawRequest);
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->sessionEs.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock);
+ }
+
+ if (NULL != loc_eng_ni_data_p->session.rawRequest) {
+ free(loc_eng_ni_data_p->session.rawRequest);
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ // the goal is to wake up ni_thread_proc
+ // and let it exit.
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks)
+{
+ ENTRY_LOG_CALLFLOW();
+
+ if(callbacks == NULL)
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, cb is NULL");
+ else if (NULL == callbacks->notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: failed, no cb.");
+ } else if (NULL != loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init: already inited.");
+ } else {
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_data_p->sessionEs.respTimeLeft = 0;
+ loc_eng_ni_data_p->sessionEs.respRecvd = FALSE;
+ loc_eng_ni_data_p->sessionEs.rawRequest = NULL;
+ loc_eng_ni_data_p->sessionEs.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL);
+
+ loc_eng_ni_data_p->session.respTimeLeft = 0;
+ loc_eng_ni_data_p->session.respRecvd = FALSE;
+ loc_eng_ni_data_p->session.rawRequest = NULL;
+ loc_eng_ni_data_p->session.reqID = 0;
+ pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL);
+ pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL);
+
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ EXIT_LOG(%s, VOID_RET);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function receives user response from upper layer framework
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data,
+ int notif_id, GpsUserResponseType user_response)
+{
+ ENTRY_LOG_CALLFLOW();
+ loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data;
+ loc_eng_ni_session_s_type* pSession = NULL;
+
+ if (NULL == loc_eng_data.ni_notify_cb) {
+ EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet.");
+ return;
+ }
+
+ if (notif_id == loc_eng_ni_data_p->sessionEs.reqID &&
+ NULL != loc_eng_ni_data_p->sessionEs.rawRequest) {
+ pSession = &loc_eng_ni_data_p->sessionEs;
+ // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted
+ if (user_response == GPS_NI_RESPONSE_ACCEPT &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock);
+ loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE;
+ loc_eng_ni_data_p->session.respRecvd = TRUE;
+ pthread_cond_signal(&loc_eng_ni_data_p->session.tCond);
+ pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock);
+ }
+ } else if (notif_id == loc_eng_ni_data_p->session.reqID &&
+ NULL != loc_eng_ni_data_p->session.rawRequest) {
+ pSession = &loc_eng_ni_data_p->session;
+ }
+
+ if (pSession) {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ pthread_mutex_lock(&pSession->tLock);
+ pSession->resp = user_response;
+ pSession->respRecvd = TRUE;
+ pthread_cond_signal(&pSession->tCond);
+ pthread_mutex_unlock(&pSession->tLock);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id);
+ }
+
+ EXIT_LOG(%s, VOID_RET);
+}
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_ni.h b/msm8996/loc_api/libloc_api_50001/loc_eng_ni.h
new file mode 100644
index 0000000..068f5cd
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_ni.h
@@ -0,0 +1,59 @@
+/* Copyright (c) 2009,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 LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <stdbool.h>
+#include <LocEngAdapter.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+#define GPS_NI_RESPONSE_IGNORE 4
+
+typedef struct {
+ pthread_t thread; /* NI thread */
+ int respTimeLeft; /* examine time for NI response */
+ bool respRecvd; /* NI User reponse received or not from Java layer*/
+ void* rawRequest;
+ int reqID; /* ID to check against response */
+ GpsUserResponseType resp;
+ pthread_cond_t tCond;
+ pthread_mutex_t tLock;
+ LocEngAdapter* adapter;
+} loc_eng_ni_session_s_type;
+
+typedef struct {
+ loc_eng_ni_session_s_type session; /* SUPL NI Session */
+ loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */
+ int reqIDCounter;
+} loc_eng_ni_data_s_type;
+
+
+#endif /* LOC_ENG_NI_H */
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_nmea.cpp
new file mode 100644
index 0000000..4083c76
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_nmea.cpp
@@ -0,0 +1,810 @@
+/* Copyright (c) 2012, 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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng_nmea"
+#include <loc_eng.h>
+#include <loc_eng_nmea.h>
+#include <math.h>
+#include "log_util.h"
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_send
+
+DESCRIPTION
+ send out NMEA sentence
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ Total length of the nmea sentence
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p)
+{
+ struct timeval tv;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ if (loc_eng_data_p->nmea_cb != NULL)
+ loc_eng_data_p->nmea_cb(now, pNmea, length);
+ LOC_LOGD("NMEA <%s", pNmea);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_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
+
+===========================================================================*/
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize)
+{
+ uint8_t checksum = 0;
+ int length = 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_eng_nmea_generate_pos
+
+DESCRIPTION
+ Generate NMEA sentences generated based on position report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p,
+ const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ unsigned char generate_nmea)
+{
+ ENTRY_LOG();
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ if (NULL == pTm) {
+ LOC_LOGE("gmtime failed");
+ return;
+ }
+
+ char sentence[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;
+
+ if (generate_nmea) {
+ // ------------------
+ // ------$GPGSA------
+ // ------------------
+
+ uint32_t svUsedCount = 0;
+ uint32_t svUsedList[32] = {0};
+ uint32_t mask = loc_eng_data_p->sv_used_mask;
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i;
+ mask = mask >> 1;
+ }
+ // clear the cache so they can't be used again
+ loc_eng_data_p->sv_used_mask = 0;
+
+ char fixType;
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 3)
+ fixType = '2'; // 2D fix
+ else
+ fixType = '3'; // 3D fix
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSA,A,%c,", fixType);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (uint8_t i = 0; i < 12; i++) // only the first 12 sv go in sentence
+ {
+ 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;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ locationExtended.pdop,
+ locationExtended.hdop,
+ locationExtended.vdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f",
+ loc_eng_data_p->pdop,
+ loc_eng_data_p->hdop,
+ loc_eng_data_p->vdop);
+ }
+ else
+ { // no dop
+ length = snprintf(pMarker, lengthRemaining, ",,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPVTG------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ if (location.gpsLocation.flags & 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, "$GPVTG,%.1lf,T,%.1lf,M,", location.gpsLocation.bearing, magTrack);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining, "$GPVTG,,T,,M,");
+ }
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (location.gpsLocation.flags & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPRMC------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d.%02d,A," ,
+ 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 & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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 & 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 & 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;
+
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N'); // N means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A'); // A means autonomous
+ else
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D'); // D means differential
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ // ------------------
+ // ------$GPGGA------
+ // ------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d.%02d," ,
+ 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 & GPS_LOCATION_HAS_LAT_LONG)
+ {
+ double latitude = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_POSITION_MODE_STANDALONE == loc_eng_data_p->adapter->getPositionMode().mode)
+ gpsQuality = '1'; // 1 means GPS fix
+ else
+ gpsQuality = '2'; // 2 means DGPS fix
+
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ { // dop is in locationExtended, (QMI)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0)
+ { // dop was cached from sv report (RPC)
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, loc_eng_data_p->hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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 & GPS_LOCATION_HAS_ALTITUDE) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL))
+ {
+ length = snprintf(pMarker, lengthRemaining, "%.1lf,M,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+
+ strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ // clear the dop cache so they can't be used again
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+
+ EXIT_LOG(%d, 0);
+}
+
+
+
+/*===========================================================================
+FUNCTION loc_eng_nmea_generate_sv
+
+DESCRIPTION
+ Generate NMEA sentences generated based on sv report
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p,
+ const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended)
+{
+ ENTRY_LOG();
+
+ char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int svCount = svStatus.num_svs;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+ int gpsCount = 0;
+ int glnCount = 0;
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+
+ loc_eng_data_p->sv_used_mask = 0;
+ for(svNumber=1; svNumber <= svCount; svNumber++) {
+ if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ // cache the used in fix mask, as it will be needed to send $GPGSA
+ // during the position report
+ if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX))
+ {
+ loc_eng_data_p->sv_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1));
+ }
+ gpsCount++;
+ }
+ else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ glnCount++;
+ }
+ }
+
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ if (gpsCount <= 0)
+ {
+ // no svs in view, so just send a blank $GPGSV sentence
+ strlcpy(sentence, "$GPGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = gpsCount/4 + (gpsCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GPGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, gpsCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,",
+ svStatus.gnss_sv_list[svNumber-1].svid,
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].elevation), //float to int
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining,"%02d",
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+ i++;
+ }
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ } //if
+
+ // ------------------
+ // ------$GLGSV------
+ // ------------------
+
+ if (glnCount <= 0)
+ {
+ // no svs in view, so just send a blank $GLGSV sentence
+ strlcpy(sentence, "$GLGSV,1,1,0,", sizeof(sentence));
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ }
+ else
+ {
+ svNumber = 1;
+ sentenceNumber = 1;
+ sentenceCount = glnCount/4 + (glnCount % 4 != 0);
+
+ while (sentenceNumber <= sentenceCount)
+ {
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$GLGSV,%d,%d,%02d",
+ sentenceCount, sentenceNumber, glnCount);
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++)
+ {
+ if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation)
+ {
+ length = snprintf(pMarker, lengthRemaining, ",%02d,%02d,%03d,",
+ svStatus.gnss_sv_list[svNumber - 1].svid,
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+
+ if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0)
+ {
+ length = snprintf(pMarker, lengthRemaining, "%02d",
+ (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int
+
+ if (length < 0 || length >= lengthRemaining)
+ {
+ LOC_LOGE("NMEA Error in string formatting");
+ return;
+ }
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ i++;
+ }
+ }
+
+ length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence));
+ loc_eng_nmea_send(sentence, length, loc_eng_data_p);
+ sentenceNumber++;
+
+ } //while
+
+ }//if
+
+ // For RPC, the DOP are sent during sv report, so cache them
+ // now to be sent during position report.
+ // For QMI, the DOP will be in position report.
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP)
+ {
+ loc_eng_data_p->pdop = locationExtended.pdop;
+ loc_eng_data_p->hdop = locationExtended.hdop;
+ loc_eng_data_p->vdop = locationExtended.vdop;
+ }
+ else
+ {
+ loc_eng_data_p->pdop = 0;
+ loc_eng_data_p->hdop = 0;
+ loc_eng_data_p->vdop = 0;
+ }
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_nmea.h b/msm8996/loc_api/libloc_api_50001/loc_eng_nmea.h
new file mode 100644
index 0000000..066943a
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_nmea.h
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012, 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 <hardware/gps.h>
+#include <gps_extended.h>
+
+#define NMEA_SENTENCE_MAX_LENGTH 200
+
+void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p);
+int loc_eng_nmea_put_checksum(char *pNmea, int maxSize);
+void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended);
+void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea);
+
+#endif // LOC_ENG_NMEA_H
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/msm8996/loc_api/libloc_api_50001/loc_eng_xtra.cpp
new file mode 100644
index 0000000..d334e0a
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_xtra.cpp
@@ -0,0 +1,220 @@
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_eng"
+
+#include <loc_eng.h>
+#include <MsgTask.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
+
+using namespace loc_core;
+
+struct LocEngRequestXtraServer : public LocMsg {
+ LocEngAdapter* mAdapter;
+ inline LocEngRequestXtraServer(LocEngAdapter* adapter) :
+ LocMsg(), mAdapter(adapter)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mAdapter->requestXtraServer();
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocEngRequestXtraServer");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngInjectXtraData : public LocMsg {
+ LocEngAdapter* mAdapter;
+ char* mData;
+ const int mLen;
+ inline LocEngInjectXtraData(LocEngAdapter* adapter,
+ char* data, int len):
+ LocMsg(), mAdapter(adapter),
+ mData(new char[len]), mLen(len)
+ {
+ memcpy((void*)mData, (void*)data, len);
+ locallog();
+ }
+ inline ~LocEngInjectXtraData()
+ {
+ delete[] mData;
+ }
+ inline virtual void proc() const {
+ mAdapter->setXtraData(mData, mLen);
+ }
+ inline void locallog() const {
+ LOC_LOGV("length: %d\n data: %p", mLen, mData);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocEngSetXtraVersionCheck : public LocMsg {
+ LocEngAdapter *mAdapter;
+ int mCheck;
+ inline LocEngSetXtraVersionCheck(LocEngAdapter* adapter,
+ int check):
+ mAdapter(adapter), mCheck(check) {}
+ inline virtual void proc() const {
+ locallog();
+ mAdapter->setXtraVersionCheck(mCheck);
+ }
+ inline void locallog() const {
+ LOC_LOGD("%s:%d]: mCheck: %d",
+ __func__, __LINE__, mCheck);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data,
+ GpsXtraExtCallbacks* callbacks)
+{
+ int ret_val = -1;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+ ENTRY_LOG();
+
+ if(!loc_eng_data.adapter->mSupportsTimeInjection
+ || loc_eng_data.adapter->hasNativeXtraClient()) {
+ LOC_LOGD("XTRA is already supported. disable it here.\n");
+ EXIT_LOG(%d, 1); // return 1 denote failure
+ return 1;
+ }
+
+ if(callbacks == NULL) {
+ LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL");
+ } else {
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr->report_xtra_server_cb = callbacks->report_xtra_server_cb;
+
+ ret_val = 0;
+ }
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_xtra_inject_data
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data,
+ char* data, int length)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_request_server
+
+DESCRIPTION
+ Request the Xtra server url from the modem
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data)
+{
+ ENTRY_LOG();
+ LocEngAdapter* adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngRequestXtraServer(adapter));
+ EXIT_LOG(%d, 0);
+ return 0;
+}
+/*===========================================================================
+FUNCTION loc_eng_xtra_version_check
+
+DESCRIPTION
+ Injects the enable/disable value for checking XTRA version
+ that is specified in gps.conf
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ none
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data,
+ int check)
+{
+ ENTRY_LOG();
+ LocEngAdapter *adapter = loc_eng_data.adapter;
+ adapter->sendMsg(new LocEngSetXtraVersionCheck(adapter, check));
+ EXIT_LOG(%d, 0);
+}
diff --git a/msm8996/loc_api/libloc_api_50001/loc_eng_xtra.h b/msm8996/loc_api/libloc_api_50001/loc_eng_xtra.h
new file mode 100644
index 0000000..175f497
--- /dev/null
+++ b/msm8996/loc_api/libloc_api_50001/loc_eng_xtra.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2009,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 LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ report_xtra_server report_xtra_server_cb;
+
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H
diff --git a/msm8996/utils/Android.mk b/msm8996/utils/Android.mk
new file mode 100644
index 0000000..a322d0f
--- /dev/null
+++ b/msm8996/utils/Android.mk
@@ -0,0 +1,61 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp
+
+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_C_INCLUDES:= \
+ $(LOCAL_PATH)/platform_lib_abstractions
+
+
+LOCAL_MODULE := libgps.utils
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_OWNER := qcom
+
+LOCAL_PROPRIETARY_MODULE := true
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libgps.utils_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) $(LOCAL_PATH)/platform_lib_abstractions
+include $(BUILD_HEADER_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/utils/LocHeap.cpp b/msm8996/utils/LocHeap.cpp
similarity index 100%
copy from utils/LocHeap.cpp
copy to msm8996/utils/LocHeap.cpp
diff --git a/utils/LocHeap.h b/msm8996/utils/LocHeap.h
similarity index 100%
copy from utils/LocHeap.h
copy to msm8996/utils/LocHeap.h
diff --git a/utils/LocSharedLock.h b/msm8996/utils/LocSharedLock.h
similarity index 100%
copy from utils/LocSharedLock.h
copy to msm8996/utils/LocSharedLock.h
diff --git a/msm8996/utils/LocThread.cpp b/msm8996/utils/LocThread.cpp
new file mode 100644
index 0000000..19bf101
--- /dev/null
+++ b/msm8996/utils/LocThread.cpp
@@ -0,0 +1,264 @@
+/* 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>
+
+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(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 = NULL;
+ }
+
+ if (mThandle) {
+ // set thread name
+ char lname[16];
+ int len = 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/utils/LocThread.h b/msm8996/utils/LocThread.h
similarity index 100%
copy from utils/LocThread.h
copy to msm8996/utils/LocThread.h
diff --git a/msm8996/utils/LocTimer.cpp b/msm8996/utils/LocTimer.cpp
new file mode 100644
index 0000000..70904b2
--- /dev/null
+++ b/msm8996/utils/LocTimer.cpp
@@ -0,0 +1,737 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <errno.h>
+#include <loc_timer.h>
+#include <sys/timerfd.h>
+#include <sys/epoll.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, bool wakeOnExpire);
+ 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 = {0};
+ 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 = {0};
+ 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, bool wakeOnExpire)
+ : mClient(&client),
+ mLock(mClient->mLock->share()),
+ mFutureTime(futureTime),
+ mContainer(LocTimerContainer::get(wakeOnExpire)) {
+ // 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, this obj outRanks higher
+ rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec;
+ }
+ 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;
+ }
+ mTimer = new LocTimerDelegate(*this, futureTime, wakeOnExpire);
+ // 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/msm8996/utils/LocTimer.h b/msm8996/utils/LocTimer.h
new file mode 100644
index 0000000..c146852
--- /dev/null
+++ b/msm8996/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 <log_util.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/msm8996/utils/Makefile.am b/msm8996/utils/Makefile.am
new file mode 100644
index 0000000..e5935f0
--- /dev/null
+++ b/msm8996/utils/Makefile.am
@@ -0,0 +1,44 @@
+AM_CFLAGS = -Wundef \
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I../platform_lib_abstractions
+
+libgps_utils_so_la_h_sources = log_util.h \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
+
+libgps_utils_so_la_c_sources = linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
+
+library_includedir = $(pkgincludedir)/utils
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lstdc++ -lcutils
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
diff --git a/msm8996/utils/MsgTask.cpp b/msm8996/utils/MsgTask.cpp
new file mode 100644
index 0000000..0e7a3a2
--- /dev/null
+++ b/msm8996/utils/MsgTask.cpp
@@ -0,0 +1,102 @@
+/* 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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <log_util.h>
+#include <loc_log.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 {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void MsgTask::prerun() {
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+}
+
+bool MsgTask::run() {
+ LOC_LOGV("MsgTask::loop() listening ...\n");
+ 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/utils/MsgTask.h b/msm8996/utils/MsgTask.h
similarity index 100%
copy from utils/MsgTask.h
copy to msm8996/utils/MsgTask.h
diff --git a/msm8996/utils/linked_list.c b/msm8996/utils/linked_list.c
new file mode 100644
index 0000000..2c91714
--- /dev/null
+++ b/msm8996/utils/linked_list.c
@@ -0,0 +1,328 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include <stdlib.h>
+#include <stdint.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*))
+{
+ LOC_LOGV("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, 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;
+ 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)
+{
+ LOC_LOGV("%s: Removing from list\n", __FUNCTION__);
+ 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)
+{
+ LOC_LOGV("%s: Search the list\n", __FUNCTION__);
+ 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/msm8996/utils/linked_list.h b/msm8996/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/msm8996/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/msm8996/utils/loc_cfg.cpp b/msm8996/utils/loc_cfg.cpp
new file mode 100644
index 0000000..967d2f3
--- /dev/null
+++ b/msm8996/utils/loc_cfg.cpp
@@ -0,0 +1,400 @@
+/* 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 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_NDDEBUG 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 <loc_cfg.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint32_t DEBUG_LEVEL = 0xff;
+static uint32_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, 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;
+
+/*===========================================================================
+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 + 1);
+ }
+ /* 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, "=", &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;
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ 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);
+}
diff --git a/msm8996/utils/loc_cfg.h b/msm8996/utils/loc_cfg.h
new file mode 100644
index 0000000..9045e1d
--- /dev/null
+++ b/msm8996/utils/loc_cfg.h
@@ -0,0 +1,91 @@
+/* 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 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>
+
+#define LOC_MAX_PARAM_NAME 80
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING)
+
+#define 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;
+ uint8_t *param_set; /* was this value set by config file? */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for float */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/msm8996/utils/loc_log.cpp b/msm8996/utils/loc_log.cpp
new file mode 100644
index 0000000..6601d0d
--- /dev/null
+++ b/msm8996/utils/loc_log.cpp
@@ -0,0 +1,243 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#ifdef USE_GLIB
+#include <time.h>
+#endif /* USE_GLIB */
+#include "log_util.h"
+#include "platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+static const loc_name_val_s_type target_name[] =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_QCA1530),
+ NAME_VAL(GNSS_AUTO),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+static const size_t target_name_num = LOC_TABLE_SIZE(target_name);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ static char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index < 0 || (unsigned)index >= target_name_num )
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ snprintf(ret, sizeof(ret), " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ snprintf(ret, sizeof(ret), " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/msm8996/utils/loc_log.h b/msm8996/utils/loc_log.h
new file mode 100644
index 0000000..be492b1
--- /dev/null
+++ b/msm8996/utils/loc_log.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#ifndef LOC_LOG_H
+#define LOC_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ const char *name;
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#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]))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask);
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, size_t buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/msm8996/utils/loc_misc_utils.cpp b/msm8996/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..7e96313
--- /dev/null
+++ b/msm8996/utils/loc_misc_utils.cpp
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <log_util.h>
+#include <loc_misc_utils.h>
+#include <ctype.h>
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+
+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;
+}
diff --git a/msm8996/utils/loc_misc_utils.h b/msm8996/utils/loc_misc_utils.h
new file mode 100644
index 0000000..7d66d84
--- /dev/null
+++ b/msm8996/utils/loc_misc_utils.h
@@ -0,0 +1,99 @@
+/* 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/msm8996/utils/loc_target.cpp b/msm8996/utils/loc_target.cpp
new file mode 100644
index 0000000..faaedf6
--- /dev/null
+++ b/msm8996/utils/loc_target.cpp
@@ -0,0 +1,261 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <hardware/gps.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include "log_util.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_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
+/* When system server is started, it uses 20 seconds as ActivityManager
+ * timeout. After that it sends SIGSTOP signal to process.
+ */
+#define QCA1530_DETECT_TIMEOUT 15
+#define QCA1530_DETECT_PRESENT "yes"
+#define QCA1530_DETECT_PROGRESS "detect"
+
+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);
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+/*!
+ * \brief Checks if QCA1530 is avalable.
+ *
+ * Function verifies if qca1530 SoC is configured on the device. The test is
+ * based on property value. For 1530 scenario, the value shall be one of the
+ * following: "yes", "no", "detect". All other values are treated equally to
+ * "no". When the value is "detect" the system waits for SoC detection to
+ * finish before returning result.
+ *
+ * \retval true - QCA1530 is available.
+ * \retval false - QCA1530 is not available.
+ */
+static bool is_qca1530(void)
+{
+ static const char qca1530_property_name[] = "sys.qca1530";
+ bool res = false;
+ int ret, i;
+ char buf[PROPERTY_VALUE_MAX];
+
+ memset(buf, 0, sizeof(buf));
+
+ for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
+ {
+ ret = property_get(qca1530_property_name, buf, NULL);
+ if (ret < 0)
+ {
+ LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
+ qca1530_property_name,
+ ret);
+
+ break;
+ }
+
+ LOC_LOGV( "qca1530: property %s is set to %s",
+ qca1530_property_name,
+ buf);
+
+ if (!memcmp(buf, QCA1530_DETECT_PRESENT,
+ sizeof(QCA1530_DETECT_PRESENT)))
+ {
+ res = true;
+ break;
+ }
+ if (!memcmp(buf, QCA1530_DETECT_PROGRESS,
+ sizeof(QCA1530_DETECT_PROGRESS)))
+ {
+ LOC_LOGV("qca1530: SoC detection is in progress.");
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+
+ LOC_LOGD("qca1530: detected=%s", res ? "true" : "false");
+ return res;
+}
+
+/*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__);
+ }
+}
+
+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 id[] = "/sys/devices/soc0/soc_id";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
+ static const char mdm[] = "/dev/mdm"; // No such file or directory
+
+ char rd_hw_platform[LINE_LEN];
+ char rd_id[LINE_LEN];
+ char rd_mdm[LINE_LEN];
+ char baseband[LINE_LEN];
+
+ if (is_qca1530()) {
+ gTarget = TARGET_QCA1530;
+ goto detected;
+ }
+
+ 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);
+ }
+ if (!access(id, F_OK)) {
+ read_a_line(id, rd_id, LINE_LEN);
+ } else {
+ read_a_line(id_dep, rd_id, LINE_LEN);
+ }
+ if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) )
+ {
+ gTarget = TARGET_AUTO;
+ goto detected;
+ }
+ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
+
+ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
+ && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
+ gTarget = TARGET_MPQ;
+ 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)]))) {
+
+ if (!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
+ gTarget = TARGET_UNKNOWN;
+ }
+
+detected:
+ LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
+ return gTarget;
+}
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target
+*/
+int loc_identify_lean_target()
+{
+ int ret = 0;
+ char lean_target[PROPERTY_VALUE_MAX];
+ property_get("ro.lean", lean_target, "");
+ LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
+ return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
+}
diff --git a/msm8996/utils/loc_target.h b/msm8996/utils/loc_target.h
new file mode 100644
index 0000000..3bb3b5e
--- /dev/null
+++ b/msm8996/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_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
+#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
+#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, 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);
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target*/
+int loc_identify_lean_target();
+
+/* Please remember to update 'target_name' in loc_log.cpp,
+ if do any changes to this enum. */
+typedef enum {
+ GNSS_NONE = 0,
+ GNSS_MSM,
+ GNSS_GSS,
+ GNSS_MDM,
+ GNSS_QCA1530,
+ 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/msm8996/utils/loc_timer.h b/msm8996/utils/loc_timer.h
new file mode 100644
index 0000000..2967858
--- /dev/null
+++ b/msm8996/utils/loc_timer.h
@@ -0,0 +1,73 @@
+/* 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>
+
+/*
+ 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/msm8996/utils/log_util.h b/msm8996/utils/log_util.h
new file mode 100644
index 0000000..7eb338a
--- /dev/null
+++ b/msm8996/utils/log_util.h
@@ -0,0 +1,173 @@
+/* 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__
+
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#endif /* USE_GLIB */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+extern const char EXIT_ERROR_TAG[];
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
+#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
+#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
+#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
+#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE(__VA_ARGS__)
+#define LOC_LOGW(...) ALOGW(__VA_ARGS__)
+#define LOC_LOGI(...) ALOGI(__VA_ARGS__)
+#define LOC_LOGD(...) ALOGD(__VA_ARGS__)
+#define LOC_LOGV(...) ALOGV(__VA_ARGS__)
+
+#endif /* DEBUG_DMN_LOC_API */
+
+/*=============================================================================
+ *
+ * LOGGING IMPROVEMENT MACROS
+ *
+ *============================================================================*/
+#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \
+ do { \
+ if (loc_logger.TIMESTAMP) { \
+ char ts[32]; \
+ LOC_LOG("[%s] %s %s line %d " #SPEC, \
+ get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \
+ } else { \
+ LOC_LOG("%s %s line %d " #SPEC, \
+ ID, WHAT, __LINE__, VAL); \
+ } \
+ } while(0)
+
+#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
+#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
+#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
+#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
+
+#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
+#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
+ if (VAL != 0) { \
+ LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \
+ } else { \
+ LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \
+ }
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow to Android Framework
+#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __LOG_UTIL_H__
diff --git a/msm8996/utils/msg_q.c b/msm8996/utils/msg_q.c
new file mode 100644
index 0000000..5be8547
--- /dev/null
+++ b/msm8996/utils/msg_q.c
@@ -0,0 +1,336 @@
+/* Copyright (c) 2011-2012, 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 "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include "log_util.h"
+#include "platform_lib_includes.h"
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.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 = 0x%08X\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 = 0x%08X\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;
+
+ LOC_LOGV("%s: Waiting on message\n", __FUNCTION__);
+
+ 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 0x%08X 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/msm8996/utils/msg_q.h b/msm8996/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/msm8996/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/msm8996/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/msm8996/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/msm8996/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/msm8996/utils/platform_lib_abstractions/platform_lib_includes.h b/msm8996/utils/platform_lib_abstractions/platform_lib_includes.h
new file mode 100644
index 0000000..5858674
--- /dev/null
+++ b/msm8996/utils/platform_lib_abstractions/platform_lib_includes.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_INCLUDES_H_
+#define _PLATFORM_LIB_INCLUDES_H_
+
+#include "platform_lib_time.h"
+#include "platform_lib_macros.h"
+
+#endif
diff --git a/msm8996/utils/platform_lib_abstractions/platform_lib_macros.h b/msm8996/utils/platform_lib_abstractions/platform_lib_macros.h
new file mode 100644
index 0000000..bc48dd9
--- /dev/null
+++ b/msm8996/utils/platform_lib_abstractions/platform_lib_macros.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#include <sys/time.h>
+
+#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); \
+}
+
+
+#ifdef USE_GLIB
+
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+
+#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)
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
+
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
+
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+pid_t gettid(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
+
+#endif
+
+#endif
diff --git a/msm8996/utils/platform_lib_abstractions/platform_lib_time.h b/msm8996/utils/platform_lib_abstractions/platform_lib_time.h
new file mode 100644
index 0000000..ce013af
--- /dev/null
+++ b/msm8996/utils/platform_lib_abstractions/platform_lib_time.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_TIME_H_
+#define _PLATFORM_LIB_TIME_H_
+
+int64_t systemTime(int clock);
+int64_t elapsedMillisSinceBoot();
+
+#endif
diff --git a/msm8998/Android.mk b/msm8998/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/msm8998/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/msm8998/CleanSpec.mk b/msm8998/CleanSpec.mk
new file mode 100644
index 0000000..dd1849d
--- /dev/null
+++ b/msm8998/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/msm8998/Makefile.am b/msm8998/Makefile.am
new file mode 100644
index 0000000..7bc06b1
--- /dev/null
+++ b/msm8998/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am - Automake script for gps loc_api
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = core loc_api
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-hal.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/msm8998/android/AGnss.cpp b/msm8998/android/AGnss.cpp
new file mode 100644
index 0000000..c497ed4
--- /dev/null
+++ b/msm8998/android/AGnss.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2017, 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"
+#include <gps_extended_c.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+sp<IAGnssCallback> AGnss::sAGnssCbIface = nullptr;
+
+AGnss::AGnss(Gnss* gnss) : mGnss(gnss) {
+}
+
+void AGnss::agnssStatusIpV4Cb(IAGnssCallback::AGnssStatusIpV4 status){
+
+ sAGnssCbIface->agnssStatusIpV4Cb(status);
+}
+
+Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
+
+ if(mGnss == nullptr || mGnss->getGnssInterface() == nullptr){
+ LOC_LOGE("Null GNSS interface");
+ return Void();
+ }
+
+ // Save the interface
+ sAGnssCbIface = callback;
+
+ mGnss->getGnssInterface()->agpsInit((void*)agnssStatusIpV4Cb);
+ 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());
+
+ mGnss->getGnssInterface()->agpsDataConnOpen(
+ LOC_AGPS_TYPE_SUPL, apn.c_str(), apn.size(), (int)apnIpType);
+ 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/msm8998/android/AGnss.h b/msm8998/android/AGnss.h
new file mode 100644
index 0000000..f4216b0
--- /dev/null
+++ b/msm8998/android/AGnss.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017, 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>
+
+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() = default;
+ /*
+ * 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;
+
+ /* Data call setup callback passed down to GNSS HAL implementation */
+ static void agnssStatusIpV4Cb(IAGnssCallback::AGnssStatusIpV4 status);
+
+ private:
+ Gnss* mGnss = nullptr;
+ static sp<IAGnssCallback> sAGnssCbIface;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_AGNSS_H
diff --git a/msm8998/android/AGnssRil.cpp b/msm8998/android/AGnssRil.cpp
new file mode 100644
index 0000000..f3bbe7c
--- /dev/null
+++ b/msm8998/android/AGnssRil.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2017, 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"
+typedef void* (getLocationInterface)();
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+static bool sendConnectionEvent(const bool connected, const int8_t type);
+
+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();
+
+ // for XTRA
+ sendConnectionEvent(connected, (int8_t)type);
+
+ return true;
+}
+
+// for XTRA
+static inline int createSocket() {
+ int socketFd = -1;
+
+ if ((socketFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
+ LOC_LOGe("create socket error. reason:%s", strerror(errno));
+
+ } else {
+ const char* socketPath = "/data/vendor/location/xtra/socket_hal_xtra";
+ struct sockaddr_un addr = { .sun_family = AF_UNIX };
+ snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socketPath);
+
+ if (::connect(socketFd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
+ LOC_LOGe("cannot connect to XTRA. reason:%s", strerror(errno));
+ if (::close(socketFd)) {
+ LOC_LOGe("close socket error. reason:%s", strerror(errno));
+ }
+ socketFd = -1;
+ }
+ }
+
+ return socketFd;
+}
+
+static inline void closeSocket(const int socketFd) {
+ if (socketFd >= 0) {
+ if(::close(socketFd)) {
+ LOC_LOGe("close socket error. reason:%s", strerror(errno));
+ }
+ }
+}
+
+static inline bool sendConnectionEvent(const bool connected, const int8_t type) {
+ int socketFd = createSocket();
+ if (socketFd < 0) {
+ LOC_LOGe("XTRA unreachable. sending failed.");
+ return false;
+ }
+
+ std::stringstream ss;
+ ss << "connection";
+ ss << " " << (connected ? "1" : "0");
+ ss << " " << (int)type;
+ ss << "\n"; // append seperator
+
+ const std::string& data = ss.str();
+ int remain = data.length();
+ ssize_t sent = 0;
+
+ while (remain > 0 &&
+ (sent = ::send(socketFd, data.c_str() + (data.length() - remain),
+ remain, MSG_NOSIGNAL)) > 0) {
+ remain -= sent;
+ }
+
+ if (sent < 0) {
+ LOC_LOGe("sending error. reason:%s", strerror(errno));
+ }
+
+ closeSocket(socketFd);
+
+ return (remain == 0);
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/android/AGnssRil.h b/msm8998/android/AGnssRil.h
similarity index 100%
copy from android/AGnssRil.h
copy to msm8998/android/AGnssRil.h
diff --git a/msm8998/android/Android.mk b/msm8998/android/Android.mk
new file mode 100644
index 0000000..365929a
--- /dev/null
+++ b/msm8998/android/Android.mk
@@ -0,0 +1,80 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_OWNER := qti
+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/FlpAPIClient.cpp \
+ location_api/GnssMeasurementAPIClient.cpp \
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/libloc_pla \
+ $(TARGET_OUT_HEADERS)/liblocation_api \
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libutils \
+ android.hardware.gnss@1.0 \
+
+LOCAL_SHARED_LIBRARIES += \
+ libloc_core \
+ libgps.utils \
+ libdl \
+ libloc_pla \
+ liblocation_api \
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.gnss@1.0-service-qti
+LOCAL_MODULE_OWNER := qti
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc
+LOCAL_VENDOR_MODULE := true
+LOCAL_SRC_FILES := \
+ service.cpp \
+
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/location_api \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/libloc_pla \
+ $(TARGET_OUT_HEADERS)/liblocation_api \
+
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libdl \
+ libbase \
+ libutils \
+
+LOCAL_SHARED_LIBRARIES += \
+ libhwbinder \
+ libhidlbase \
+ libhidltransport \
+ android.hardware.gnss@1.0 \
+
+include $(BUILD_EXECUTABLE)
diff --git a/msm8998/android/Gnss.cpp b/msm8998/android/Gnss.cpp
new file mode 100644
index 0000000..9b2e7dd
--- /dev/null
+++ b/msm8998/android/Gnss.cpp
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2017, 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"
+
+#include <log_util.h>
+#include <dlfcn.h>
+#include "Gnss.h"
+typedef void* (getLocationInterface)();
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+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();
+ }
+}
+
+Gnss::Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ // clear pending GnssConfig
+ memset(&mPendingConfig, 0, sizeof(GnssConfig));
+
+ mGnssDeathRecipient = new GnssDeathRecipient(this);
+}
+
+Gnss::~Gnss() {
+ ENTRY_LOG_CALLFLOW();
+ if (mApi != nullptr) {
+ delete mApi;
+ mApi = 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;
+}
+
+GnssInterface* Gnss::getGnssInterface() {
+ static bool getGnssInterfaceFailed = false;
+ if (nullptr == mGnssInterface && !getGnssInterfaceFailed) {
+ LOC_LOGD("%s]: loading libgnss.so::getGnssInterface ...", __func__);
+ getLocationInterface* getter = NULL;
+ const char *error = NULL;
+ dlerror();
+ void *handle = dlopen("libgnss.so", RTLD_NOW);
+ if (NULL == handle || (error = dlerror()) != NULL) {
+ LOC_LOGW("dlopen for libgnss.so failed, error = %s", error);
+ } else {
+ getter = (getLocationInterface*)dlsym(handle, "getGnssInterface");
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGW("dlsym for libgnss.so::getGnssInterface failed, error = %s", error);
+ getter = NULL;
+ }
+ }
+
+ if (NULL == getter) {
+ getGnssInterfaceFailed = true;
+ } else {
+ mGnssInterface = (GnssInterface*)(*getter)();
+ }
+ }
+ return mGnssInterface;
+}
+
+Return<bool> Gnss::setCallback(const sp<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->locAPIEnable(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->locAPIGnssUpdateConfig(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;
+ }
+ }
+ 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->locAPIDisable();
+ }
+
+ return Void();
+}
+
+Return<bool> Gnss::injectLocation(double latitudeDegrees,
+ double longitudeDegrees,
+ float accuracyMeters) {
+ ENTRY_LOG_CALLFLOW();
+ 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();
+ GnssInterface* gnssInterface = getGnssInterface();
+ if (nullptr != gnssInterface) {
+ gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
+ ENTRY_LOG_CALLFLOW();
+ GnssAPIClient* api = getApi();
+ if (api) {
+ api->gnssDeleteAidingData(aidingDataFlags);
+ }
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode,
+ 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<IAGnss>> Gnss::getExtensionAGnss() {
+ ENTRY_LOG_CALLFLOW();
+ mAGnssIface = new AGnss(this);
+ return mAGnssIface;
+}
+
+Return<sp<IGnssNi>> Gnss::getExtensionGnssNi() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssNi = new GnssNi(this);
+ return mGnssNi;
+}
+
+Return<sp<IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssMeasurement = new GnssMeasurement();
+ return mGnssMeasurement;
+}
+
+Return<sp<IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssConfig = new GnssConfiguration(this);
+ return mGnssConfig;
+}
+
+Return<sp<IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssGeofencingIface = new GnssGeofencing();
+ return mGnssGeofencingIface;
+}
+
+Return<sp<IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ mGnssBatching = new GnssBatching();
+ return mGnssBatching;
+}
+
+Return<sp<IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ ENTRY_LOG_CALLFLOW();
+ mGnssDebug = new GnssDebug(this);
+ return mGnssDebug;
+}
+
+Return<sp<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/android/Gnss.h b/msm8998/android/Gnss.h
similarity index 100%
copy from android/Gnss.h
copy to msm8998/android/Gnss.h
diff --git a/msm8998/android/GnssBatching.cpp b/msm8998/android/GnssBatching.cpp
new file mode 100644
index 0000000..b79105c
--- /dev/null
+++ b/msm8998/android/GnssBatching.cpp
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2017, 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 <FlpAPIClient.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) {
+ delete mApi;
+ 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__);
+ delete mApi;
+ mApi = nullptr;
+ }
+
+ mApi = new FlpAPIClient(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->flpGetBatchSize();
+ }
+ 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->flpStartSession(options);
+ }
+ return ret;
+}
+
+Return<void> GnssBatching::flush() {
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ mApi->flpFlushBatchedLocations();
+ }
+ return Void();
+}
+
+Return<bool> GnssBatching::stop() {
+ bool ret = false;
+ if (mApi == nullptr) {
+ LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
+ } else {
+ ret = mApi->flpStopSession();
+ }
+ 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/msm8998/android/GnssBatching.h b/msm8998/android/GnssBatching.h
new file mode 100644
index 0000000..b46fae8
--- /dev/null
+++ b/msm8998/android/GnssBatching.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2017, 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_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 FlpAPIClient;
+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;
+ FlpAPIClient* mApi = nullptr;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSBATCHING_H
diff --git a/android/GnssConfiguration.cpp b/msm8998/android/GnssConfiguration.cpp
similarity index 100%
copy from android/GnssConfiguration.cpp
copy to msm8998/android/GnssConfiguration.cpp
diff --git a/android/GnssConfiguration.h b/msm8998/android/GnssConfiguration.h
similarity index 100%
copy from android/GnssConfiguration.h
copy to msm8998/android/GnssConfiguration.h
diff --git a/android/GnssDebug.cpp b/msm8998/android/GnssDebug.cpp
similarity index 100%
copy from android/GnssDebug.cpp
copy to msm8998/android/GnssDebug.cpp
diff --git a/android/GnssDebug.h b/msm8998/android/GnssDebug.h
similarity index 100%
copy from android/GnssDebug.h
copy to msm8998/android/GnssDebug.h
diff --git a/android/GnssGeofencing.cpp b/msm8998/android/GnssGeofencing.cpp
similarity index 100%
copy from android/GnssGeofencing.cpp
copy to msm8998/android/GnssGeofencing.cpp
diff --git a/android/GnssGeofencing.h b/msm8998/android/GnssGeofencing.h
similarity index 100%
copy from android/GnssGeofencing.h
copy to msm8998/android/GnssGeofencing.h
diff --git a/msm8998/android/GnssMeasurement.cpp b/msm8998/android/GnssMeasurement.cpp
new file mode 100644
index 0000000..bc07265
--- /dev/null
+++ b/msm8998/android/GnssMeasurement.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2017, 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 <GnssMeasurementAPIClient.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 GnssMeasurementAPIClient();
+}
+
+GnssMeasurement::~GnssMeasurement() {
+ if (mApi) {
+ delete mApi;
+ mApi = nullptr;
+ }
+}
+
+// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<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 /*cookie*/);
+
+ return mApi->gnssMeasurementSetCallback(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->gnssMeasurementClose();
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/msm8998/android/GnssMeasurement.h b/msm8998/android/GnssMeasurement.h
new file mode 100644
index 0000000..cd364c3
--- /dev/null
+++ b/msm8998/android/GnssMeasurement.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017, 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.0/IGnssMeasurement.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 GnssMeasurementAPIClient;
+struct GnssMeasurement : public IGnssMeasurement {
+ GnssMeasurement();
+ ~GnssMeasurement();
+
+ /*
+ * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
+ * These declarations were generated from IGnssMeasurement.hal.
+ */
+ Return<GnssMeasurementStatus> setCallback(
+ const sp<IGnssMeasurementCallback>& callback) override;
+ Return<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<IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
+ GnssMeasurementAPIClient* mApi;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
diff --git a/android/GnssNi.cpp b/msm8998/android/GnssNi.cpp
similarity index 100%
copy from android/GnssNi.cpp
copy to msm8998/android/GnssNi.cpp
diff --git a/android/GnssNi.h b/msm8998/android/GnssNi.h
similarity index 100%
copy from android/GnssNi.h
copy to msm8998/android/GnssNi.h
diff --git a/msm8998/android/android.hardware.gnss@1.0-service-qti.rc b/msm8998/android/android.hardware.gnss@1.0-service-qti.rc
new file mode 100644
index 0000000..4571808
--- /dev/null
+++ b/msm8998/android/android.hardware.gnss@1.0-service-qti.rc
@@ -0,0 +1,4 @@
+service vendor.gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti
+ class hal
+ user gps
+ group system gps radio
diff --git a/msm8998/android/location_api/FlpAPIClient.cpp b/msm8998/android/location_api/FlpAPIClient.cpp
new file mode 100644
index 0000000..f3af773
--- /dev/null
+++ b/msm8998/android/location_api/FlpAPIClient.cpp
@@ -0,0 +1,186 @@
+/* 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_FlpAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "FlpAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
+ LocationCapabilitiesMask mask);
+
+FlpAPIClient::FlpAPIClient(const sp<IGnssBatchingCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssBatchingCbIface(callback),
+ mDefaultId(42),
+ mLocationCapabilitiesMask(0)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks locationCallbacks;
+ locationCallbacks.size = sizeof(LocationCallbacks);
+
+ locationCallbacks.trackingCb = nullptr;
+ locationCallbacks.batchingCb = nullptr;
+ if (mGnssBatchingCbIface != nullptr) {
+ locationCallbacks.batchingCb = [this](size_t count, Location* location) {
+ onBatchingCb(count, location);
+ };
+ }
+ locationCallbacks.geofenceBreachCb = nullptr;
+ locationCallbacks.geofenceStatusCb = nullptr;
+ locationCallbacks.gnssLocationInfoCb = nullptr;
+ locationCallbacks.gnssNiCb = nullptr;
+ locationCallbacks.gnssSvCb = nullptr;
+ locationCallbacks.gnssNmeaCb = nullptr;
+ locationCallbacks.gnssMeasurementsCb = nullptr;
+
+ locAPISetCallbacks(locationCallbacks);
+}
+
+FlpAPIClient::~FlpAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+int FlpAPIClient::flpGetBatchSize()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ return locAPIGetBatchSize();
+}
+
+int FlpAPIClient::flpStartSession(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 FlpAPIClient::flpUpdateSessionOptions(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 FlpAPIClient::flpStopSession()
+{
+ LOC_LOGD("%s]: ", __FUNCTION__);
+ int retVal = -1;
+ if (locAPIStopSession(mDefaultId) == LOCATION_ERROR_SUCCESS) {
+ retVal = 1;
+ }
+ return retVal;
+}
+
+void FlpAPIClient::flpGetBatchedLocation(int last_n_locations)
+{
+ LOC_LOGD("%s]: (%d)", __FUNCTION__, last_n_locations);
+ locAPIGetBatchedLocations(last_n_locations);
+}
+
+void FlpAPIClient::flpFlushBatchedLocations()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ locAPIGetBatchedLocations(SIZE_MAX);
+}
+
+void FlpAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+}
+
+void FlpAPIClient::onBatchingCb(size_t count, Location* location)
+{
+ 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/msm8998/android/location_api/FlpAPIClient.h b/msm8998/android/location_api/FlpAPIClient.h
new file mode 100644
index 0000000..9fc7e19
--- /dev/null
+++ b/msm8998/android/location_api/FlpAPIClient.h
@@ -0,0 +1,77 @@
+/* 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 FLP_API_CLINET_H
+#define FLP_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>
+
+#define FLP_CONF_FILE "/vendor/etc/flp.conf"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+class FlpAPIClient : public LocationAPIClientBase
+{
+public:
+ FlpAPIClient(const sp<IGnssBatchingCallback>& callback);
+ ~FlpAPIClient();
+ int flpGetBatchSize();
+ int flpStartSession(const IGnssBatching::Options& options);
+ int flpUpdateSessionOptions(const IGnssBatching::Options& options);
+ int flpStopSession();
+ void flpGetBatchedLocation(int last_n_locations);
+ void flpFlushBatchedLocations();
+
+ inline LocationCapabilitiesMask flpGetCapabilities() { return mLocationCapabilitiesMask; }
+
+ // callbacks
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onBatchingCb(size_t count, Location* location) final;
+
+private:
+ sp<IGnssBatchingCallback> mGnssBatchingCbIface;
+ uint32_t mDefaultId;
+ int mBatchSize;
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // FLP_API_CLINET_H
diff --git a/msm8998/android/location_api/GeofenceAPIClient.cpp b/msm8998/android/location_api/GeofenceAPIClient.cpp
new file mode 100644
index 0000000..65bd662
--- /dev/null
+++ b/msm8998/android/location_api/GeofenceAPIClient.cpp
@@ -0,0 +1,272 @@
+/* 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_NDDEBUG 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 {
+
+
+GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
+ LocationAPIClientBase(),
+ mGnssGeofencingCbIface(callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ LocationCallbacks 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<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/android/location_api/GeofenceAPIClient.h b/msm8998/android/location_api/GeofenceAPIClient.h
similarity index 100%
rename from android/location_api/GeofenceAPIClient.h
rename to msm8998/android/location_api/GeofenceAPIClient.h
diff --git a/msm8998/android/location_api/GnssAPIClient.cpp b/msm8998/android/location_api/GnssAPIClient.cpp
new file mode 100644
index 0000000..129e81f
--- /dev/null
+++ b/msm8998/android/location_api/GnssAPIClient.cpp
@@ -0,0 +1,451 @@
+/* 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_GnssAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GnssAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
+
+GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb) :
+ LocationAPIClientBase(),
+ mGnssCbIface(nullptr),
+ mGnssNiCbIface(nullptr),
+ mLocationCapabilitiesMask(0),
+ mLocationCapabilitiesCached(false)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ // set default LocationOptions.
+ memset(&mLocationOptions, 0, sizeof(LocationOptions));
+ mLocationOptions.size = sizeof(LocationOptions);
+ mLocationOptions.minInterval = 1000;
+ mLocationOptions.minDistance = 0;
+ mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+
+ gnssUpdateCallbacks(gpsCb, niCb);
+}
+
+GnssAPIClient::~GnssAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+}
+
+// for GpsInterface
+void GnssAPIClient::gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb)
+{
+ LOC_LOGD("%s]: (%p %p)", __FUNCTION__, &gpsCb, &niCb);
+
+ mGnssCbIface = gpsCb;
+ mGnssNiCbIface = niCb;
+
+ LocationCallbacks 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;
+ if (mGnssNiCbIface != nullptr) {
+ 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(mLocationOptions);
+ return retVal;
+}
+
+bool GnssAPIClient::gnssStop()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ bool retVal = true;
+ locAPIStopTracking();
+ return retVal;
+}
+
+void GnssAPIClient::gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags)
+{
+ LOC_LOGD("%s]: (%02hx)", __FUNCTION__, aidingDataFlags);
+ 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;
+
+ 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;
+ }
+ locAPIGnssDeleteAidingData(data);
+}
+
+bool GnssAPIClient::gnssSetPositionMode(IGnss::GnssPositionMode mode,
+ IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs)
+{
+ LOC_LOGD("%s]: (%d %d %d %d %d)", __FUNCTION__,
+ (int)mode, recurrence, minIntervalMs, preferredAccuracyMeters, preferredTimeMs);
+ bool retVal = true;
+ memset(&mLocationOptions, 0, sizeof(LocationOptions));
+ mLocationOptions.size = sizeof(LocationOptions);
+ mLocationOptions.minInterval = minIntervalMs;
+ mLocationOptions.minDistance = preferredAccuracyMeters;
+ if (mode == IGnss::GnssPositionMode::STANDALONE)
+ mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+ else if (mode == IGnss::GnssPositionMode::MS_BASED)
+ mLocationOptions.mode = GNSS_SUPL_MODE_MSB;
+ else if (mode == IGnss::GnssPositionMode::MS_ASSISTED)
+ mLocationOptions.mode = GNSS_SUPL_MODE_MSA;
+ locAPIUpdateTrackingOptions(mLocationOptions);
+ 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 = GNSS_NI_RESPONSE_IGNORE;
+ if (userResponse == IGnssNiCallback::GnssUserResponseType::RESPONSE_ACCEPT)
+ data = GNSS_NI_RESPONSE_ACCEPT;
+ else if (userResponse == IGnssNiCallback::GnssUserResponseType::RESPONSE_DENY)
+ data = GNSS_NI_RESPONSE_DENY;
+ else if (userResponse == IGnssNiCallback::GnssUserResponseType::RESPONSE_NORESP)
+ data = GNSS_NI_RESPONSE_NO_RESPONSE;
+ locAPIGnssNiResponse(notifId, data);
+}
+
+// for GnssConfigurationInterface
+void GnssAPIClient::gnssConfigurationUpdate(const GnssConfig& gnssConfig)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, gnssConfig.flags);
+ 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;
+ if (mGnssCbIface != 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 = mGnssCbIface->gnssSetCapabilitesCb(data);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSetCapabilitesCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ if (mGnssCbIface != nullptr) {
+ IGnssCallback::GnssSystemInfo gnssInfo;
+ gnssInfo.yearOfHw = 2015;
+ if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
+ gnssInfo.yearOfHw = 2017;
+ }
+ LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
+ auto r = mGnssCbIface->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);
+ if (mGnssCbIface != nullptr) {
+ GnssLocation gnssLocation;
+ convertGnssLocation(location, gnssLocation);
+ auto r = mGnssCbIface->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);
+
+ if (mGnssNiCbIface == 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;
+
+ mGnssNiCbIface->niNotifyCb(notificationGnss);
+}
+
+void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
+{
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssSvNotification.count);
+ if (mGnssCbIface != nullptr) {
+ IGnssCallback::GnssSvStatus svStatus;
+ convertGnssSvStatus(gnssSvNotification, svStatus);
+ auto r = mGnssCbIface->gnssSvStatusCb(svStatus);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssSvStatusCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+}
+
+void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
+{
+ if (mGnssCbIface != nullptr) {
+ android::hardware::hidl_string nmeaString;
+ nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
+ auto r = mGnssCbIface->gnssNmeaCb(
+ static_cast<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);
+ if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) {
+ auto r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::ENGINE_ON);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb ENGINE_ON description=%s",
+ __func__, r.description().c_str());
+ }
+ r = mGnssCbIface->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);
+ if (error == LOCATION_ERROR_SUCCESS && mGnssCbIface != nullptr) {
+ auto r = mGnssCbIface->gnssStatusCb(IGnssCallback::GnssStatusValue::SESSION_END);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from gnssStatusCb SESSION_END description=%s",
+ __func__, r.description().c_str());
+ }
+ r = mGnssCbIface->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>(GnssMax::SVS_COUNT)) {
+ LOC_LOGW("%s]: Too many satellites %zd. Clamps to %d.",
+ __FUNCTION__, out.numSvs, GnssMax::SVS_COUNT);
+ out.numSvs = static_cast<uint32_t>(GnssMax::SVS_COUNT);
+ }
+ for (size_t i = 0; i < out.numSvs; i++) {
+ IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
+ info.svid = in.gnssSvs[i].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.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;
+ }
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/msm8998/android/location_api/GnssAPIClient.h b/msm8998/android/location_api/GnssAPIClient.h
new file mode 100644
index 0000000..d447157
--- /dev/null
+++ b/msm8998/android/location_api/GnssAPIClient.h
@@ -0,0 +1,104 @@
+/* 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 GNSS_API_CLINET_H
+#define GNSS_API_CLINET_H
+
+
+#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<IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb);
+ virtual ~GnssAPIClient();
+ GnssAPIClient(const GnssAPIClient&) = delete;
+ GnssAPIClient& operator=(const GnssAPIClient&) = delete;
+
+ // for GpsInterface
+ void gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb,
+ const sp<IGnssNiCallback>& niCb);
+ bool gnssStart();
+ bool gnssStop();
+ void gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags);
+ bool gnssSetPositionMode(IGnss::GnssPositionMode mode,
+ IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs,
+ uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs);
+
+ // for GpsNiInterface
+ void gnssNiRespond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse);
+
+ // for GnssConfigurationInterface
+ 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:
+ sp<IGnssCallback> mGnssCbIface;
+ sp<IGnssNiCallback> mGnssNiCbIface;
+
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+ bool mLocationCapabilitiesCached;
+
+ LocationOptions mLocationOptions;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GNSS_API_CLINET_H
diff --git a/msm8998/android/location_api/GnssMeasurementAPIClient.cpp b/msm8998/android/location_api/GnssMeasurementAPIClient.cpp
new file mode 100644
index 0000000..6e915b0
--- /dev/null
+++ b/msm8998/android/location_api/GnssMeasurementAPIClient.cpp
@@ -0,0 +1,286 @@
+/* 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_GnssMeasurementAPIClient"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+
+#include "LocationUtil.h"
+#include "GnssMeasurementAPIClient.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V1_0 {
+namespace implementation {
+
+static void convertGnssData(GnssMeasurementsNotification& in,
+ IGnssMeasurementCallback::GnssData& out);
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ IGnssMeasurementCallback::GnssMeasurement& out);
+static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
+
+GnssMeasurementAPIClient::GnssMeasurementAPIClient() :
+ mGnssMeasurementCbIface(nullptr),
+ mLocationCapabilitiesMask(0)
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ pthread_mutex_init(&mLock, nullptr);
+ pthread_cond_init (&mCond, nullptr);
+
+ // set default LocationOptions.
+ memset(&mLocationOptions, 0, sizeof(LocationOptions));
+ mLocationOptions.size = sizeof(LocationOptions);
+ mLocationOptions.minInterval = 1000;
+ mLocationOptions.minDistance = 0;
+ mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+}
+
+GnssMeasurementAPIClient::~GnssMeasurementAPIClient()
+{
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ pthread_cond_destroy(&mCond);
+ pthread_mutex_destroy(&mLock);
+}
+
+// for GpsInterface
+Return<IGnssMeasurement::GnssMeasurementStatus>
+GnssMeasurementAPIClient::gnssMeasurementSetCallback(const sp<IGnssMeasurementCallback>& callback)
+{
+ LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
+
+ mGnssMeasurementCbIface = callback;
+
+ LocationCallbacks 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);
+
+ while (!mLocationCapabilitiesMask) {
+ LOC_LOGD("%s]: wait for capabilities...", __FUNCTION__);
+ pthread_mutex_lock(&mLock);
+ pthread_cond_wait(&mCond, &mLock);
+ pthread_mutex_unlock(&mLock);
+ }
+ if (mLocationCapabilitiesMask & LOCATION_CAPABILITIES_GNSS_MSB_BIT)
+ mLocationOptions.mode = GNSS_SUPL_MODE_MSB;
+ else
+ mLocationOptions.mode = GNSS_SUPL_MODE_STANDALONE;
+ LOC_LOGD("%s]: start tracking session", __FUNCTION__);
+ locAPIStartTracking(mLocationOptions);
+
+ return IGnssMeasurement::GnssMeasurementStatus::SUCCESS;
+}
+
+// for GpsMeasurementInterface
+void GnssMeasurementAPIClient::gnssMeasurementClose() {
+ LOC_LOGD("%s]: ()", __FUNCTION__);
+ pthread_mutex_lock(&mLock);
+ mGnssMeasurementCbIface = nullptr;
+ pthread_mutex_unlock(&mLock);
+ locAPIStopTracking();
+}
+
+// callbacks
+void GnssMeasurementAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
+{
+ LOC_LOGD("%s]: (%02x)", __FUNCTION__, capabilitiesMask);
+ mLocationCapabilitiesMask = capabilitiesMask;
+ pthread_mutex_lock(&mLock);
+ pthread_cond_signal(&mCond);
+ pthread_mutex_unlock(&mLock);
+}
+
+void GnssMeasurementAPIClient::onGnssMeasurementsCb(
+ GnssMeasurementsNotification gnssMeasurementsNotification)
+{
+ LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, gnssMeasurementsNotification.count);
+ // we don't need to lock the mutext
+ // if mGnssMeasurementCbIface is set to nullptr
+ if (mGnssMeasurementCbIface != nullptr) {
+ pthread_mutex_lock(&mLock);
+ if (mGnssMeasurementCbIface != nullptr) {
+ IGnssMeasurementCallback::GnssData gnssData;
+ convertGnssData(gnssMeasurementsNotification, gnssData);
+ auto r = mGnssMeasurementCbIface->GnssMeasurementCb(gnssData);
+ if (!r.isOk()) {
+ LOC_LOGE("%s] Error from GnssMeasurementCb description=%s",
+ __func__, r.description().c_str());
+ }
+ }
+ pthread_mutex_unlock(&mLock);
+ }
+}
+
+static void convertGnssMeasurement(GnssMeasurementsData& in,
+ 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;
+ out.svid = in.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,
+ IGnssMeasurementCallback::GnssData& out)
+{
+ out.measurementCount = in.count;
+ if (out.measurementCount > static_cast<uint32_t>(GnssMax::SVS_COUNT)) {
+ LOC_LOGW("%s]: Too many measurement %zd. Clamps to %d.",
+ __FUNCTION__, out.measurementCount, GnssMax::SVS_COUNT);
+ out.measurementCount = static_cast<uint32_t>(GnssMax::SVS_COUNT);
+ }
+ 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/msm8998/android/location_api/GnssMeasurementAPIClient.h b/msm8998/android/location_api/GnssMeasurementAPIClient.h
new file mode 100644
index 0000000..02fe89a
--- /dev/null
+++ b/msm8998/android/location_api/GnssMeasurementAPIClient.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 GNSS_MEASUREMENT_API_CLINET_H
+#define GNSS_MEASUREMENT_API_CLINET_H
+
+
+#include <android/hardware/gnss/1.0/IGnssMeasurement.h>
+#include <android/hardware/gnss/1.0/IGnssMeasurementCallback.h>
+#include <LocationAPIClientBase.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::sp;
+
+class GnssMeasurementAPIClient : public LocationAPIClientBase
+{
+public:
+ GnssMeasurementAPIClient();
+ virtual ~GnssMeasurementAPIClient();
+ GnssMeasurementAPIClient(const GnssMeasurementAPIClient&) = delete;
+ GnssMeasurementAPIClient& operator=(const GnssMeasurementAPIClient&) = delete;
+
+ // for GpsMeasurementInterface
+ Return<IGnssMeasurement::GnssMeasurementStatus> gnssMeasurementSetCallback(
+ const sp<IGnssMeasurementCallback>& callback);
+ void gnssMeasurementClose();
+
+ // callbacks we are interested in
+ void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
+ void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
+
+private:
+ pthread_mutex_t mLock;
+ pthread_cond_t mCond;
+
+ sp<IGnssMeasurementCallback> mGnssMeasurementCbIface;
+
+ LocationCapabilitiesMask mLocationCapabilitiesMask;
+
+ LocationOptions mLocationOptions;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+#endif // GNSS_MEASUREMENT_API_CLINET_H
diff --git a/android/location_api/LocationUtil.cpp b/msm8998/android/location_api/LocationUtil.cpp
similarity index 100%
rename from android/location_api/LocationUtil.cpp
rename to msm8998/android/location_api/LocationUtil.cpp
diff --git a/android/location_api/LocationUtil.h b/msm8998/android/location_api/LocationUtil.h
similarity index 100%
rename from android/location_api/LocationUtil.h
rename to msm8998/android/location_api/LocationUtil.h
diff --git a/android/service.cpp b/msm8998/android/service.cpp
similarity index 100%
copy from android/service.cpp
copy to msm8998/android/service.cpp
diff --git a/msm8998/configure.ac b/msm8998/configure.ac
new file mode 100644
index 0000000..cf991c6
--- /dev/null
+++ b/msm8998/configure.ac
@@ -0,0 +1,91 @@
+# 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])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([utils/loc_cfg.cpp])
+# 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([QMI], [qmi])
+AC_SUBST([QMI_CFLAGS])
+AC_SUBST([QMI_LIBS])
+
+PKG_CHECK_MODULES([QMIF], [qmi-framework])
+AC_SUBST([QMIF_CFLAGS])
+AC_SUBST([QMIF_LIBS])
+
+PKG_CHECK_MODULES([DATA], [data])
+AC_SUBST([DATA_CFLAGS])
+AC_SUBST([DATA_LIBS])
+
+PKG_CHECK_MODULES([LOCPLA], [loc-pla])
+AC_SUBST([LOCPLA_CFLAGS])
+AC_SUBST([LOCPLA_LIBS])
+
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
+
+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_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 \
+ utils/Makefile \
+ core/Makefile \
+ loc_api/Makefile \
+ loc-hal.pc \
+ ])
+
+AC_OUTPUT
diff --git a/msm8998/core/Android.mk b/msm8998/core/Android.mk
new file mode 100644
index 0000000..b8d497e
--- /dev/null
+++ b/msm8998/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_VENDOR_MODULE := true
+LOCAL_MODULE_OWNER := qti
+LOCAL_MODULE_TAGS := optional
+
+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 := \
+ liblog \
+ libutils \
+ liblog \
+ libcutils \
+ libgps.utils \
+ libdl \
+ libloc_pla
+
+LOCAL_SRC_FILES += \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp \
+ SystemStatus.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_pla \
+ $(TARGET_OUT_HEADERS)/liblocation_api
+
+LOCAL_COPY_HEADERS_TO:= libloc_core/
+LOCAL_COPY_HEADERS:= \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ LBSProxyBase.h \
+ UlpProxyBase.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h \
+ SystemStatus.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8998/core/ContextBase.cpp b/msm8998/core/ContextBase.cpp
new file mode 100644
index 0000000..565f70c
--- /dev/null
+++ b/msm8998/core/ContextBase.cpp
@@ -0,0 +1,248 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <platform_lib_includes.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+loc_gps_cfg_s_type ContextBase::mGps_conf {};
+loc_sap_cfg_s_type ContextBase::mSap_conf {};
+
+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'},
+};
+
+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_USAGE", &mSap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &mSap_conf.SENSOR_PROVIDER, NULL, 'n'}
+};
+
+void ContextBase::readConfig()
+{
+ /*Defaults for gps.conf*/
+ mGps_conf.INTERMEDIATE_POS = 0;
+ mGps_conf.ACCURACY_THRES = 0;
+ mGps_conf.NMEA_PROVIDER = 0;
+ mGps_conf.GPS_LOCK = 0;
+ mGps_conf.SUPL_VER = 0x10000;
+ mGps_conf.SUPL_MODE = 0x3;
+ mGps_conf.SUPL_ES = 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;
+
+ /*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_USAGE = 0; /* Enabled */
+ 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;
+ /* default provider is SSC */
+ mSap_conf.SENSOR_PROVIDER = 1;
+
+ /* 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;
+
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
+ UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
+}
+
+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;
+
+ // Check the target
+ if (TARGET_NO_GNSS != loc_get_target()){
+
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
+ if (getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
+ __LINE__);
+ locApi = (*getter)(mMsgTask, 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)(mMsgTask, exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, 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())
+{
+}
+
+}
diff --git a/msm8998/core/ContextBase.h b/msm8998/core/ContextBase.h
new file mode 100644
index 0000000..83de999
--- /dev/null
+++ b/msm8998/core/ContextBase.h
@@ -0,0 +1,148 @@
+/* Copyright (c) 2011-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_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>
+
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+/* 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[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t 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;
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} 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() { delete mLocApi; delete mLBSProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+ inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
+ inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mLBSProxy->requestUlp(adapter, capabilities);
+ }
+ 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;
+
+ void readConfig();
+ static uint32_t getCarrierCapabilities();
+
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/msm8998/core/LBSProxyBase.h b/msm8998/core/LBSProxyBase.h
new file mode 100644
index 0000000..94ddd0f
--- /dev/null
+++ b/msm8998/core/LBSProxyBase.h
@@ -0,0 +1,80 @@
+/* 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>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
+
+ (void)msgTask;
+ (void)exMask;
+ (void)context;
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {
+
+ (void)adapter;
+ (void)capabilities;
+ }
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual bool hasCPIExtendedCapabilities() 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/msm8998/core/LocAdapterBase.cpp b/msm8998/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..aca5909
--- /dev/null
+++ b/msm8998/core/LocAdapterBase.cpp
@@ -0,0 +1,163 @@
+/* Copyright (c) 2011-2014, 2016-2017The 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_LocAdapterBase"
+
+#include <dlfcn.h>
+#include <LocAdapterBase.h>
+#include <loc_target.h>
+#include <platform_lib_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, LocAdapterProxyBase *adapterProxyBase) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask())
+{
+ mLocApi->addAdapter(this);
+}
+
+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,
+ bool fromUlp) {
+ if (mLocAdapterProxyBase != NULL) {
+ mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
+ (GpsLocationExtended&)locationExtended,
+ status,
+ loc_technology_mask);
+ } else {
+ DEFAULT_IMPL()
+ }
+}
+
+void LocAdapterBase::
+ reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportStatus(LocGpsStatusValue status)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmeaEvent(const char* nmea, size_t length, bool fromUlp)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength)
+DEFAULT_IMPL(false)
+
+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)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int connHandle)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportWwanZppFix(LocGpsLocation &zppLoc)
+DEFAULT_IMPL(false)
+
+} // namespace loc_core
diff --git a/msm8998/core/LocAdapterBase.h b/msm8998/core/LocAdapterBase.h
new file mode 100644
index 0000000..5c471fd
--- /dev/null
+++ b/msm8998/core/LocAdapterBase.h
@@ -0,0 +1,159 @@
+/* Copyright (c) 2011-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_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+#include <LocationAPI.h>
+#include <map>
+
+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 std::map<LocationSessionKey, LocationOptions> LocationSessionMap;
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+private:
+ static uint32_t mSessionIdCounter;
+protected:
+ LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ 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 bool isFeatureSupported(uint8_t featureVal) {
+ return mLocApi->isFeatureSupported(featureVal);
+ }
+
+ uint32_t generateSessionId();
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxyCommand(UlpProxyBase* ulp) {
+
+ (void)ulp;
+ }
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeCommand(LocPosMode& posMode) {
+
+ (void)posMode;
+ }
+ virtual void startTrackingCommand() {}
+ virtual void stopTrackingCommand() {}
+ virtual void getZppCommand() {}
+ virtual void reportPositionEvent(const UlpLocation& location,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ bool fromUlp=false);
+ virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
+ virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
+ virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
+ virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
+ virtual void reportStatus(LocGpsStatusValue status);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, LocAGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
+ inline virtual bool isInSession() { return false; }
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify);
+ virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/msm8998/core/LocAdapterProxyBase.h b/msm8998/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..044f59b
--- /dev/null
+++ b/msm8998/core/LocAdapterProxyBase.h
@@ -0,0 +1,78 @@
+/* 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):
+ mLocAdapterBase(new LocAdapterBase(mask, context, 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/msm8998/core/LocApiBase.cpp b/msm8998/core/LocApiBase.cpp
new file mode 100644
index 0000000..0036d88
--- /dev/null
+++ b/msm8998/core/LocApiBase.cpp
@@ -0,0 +1,602 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDEBUG 0 //Define to enable LOGV
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <platform_lib_log_util.h>
+#include <LocDualContext.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ inline LocOpenMsg(LocApiBase* locApi,
+ LOC_API_ADAPTER_EVENT_MASK_T mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->open(mMask);
+ }
+ inline void locallog() {
+ LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
+ __func__, __LINE__, mMask);
+ }
+ inline virtual void log() {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask),
+ mMask(0), mSupportedMsg(0), mContext(context)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+ memset(mFeaturesSupported, 0, sizeof(mFeaturesSupported));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ mMsgTask->sendMsg(new LocOpenMsg(this,
+ (adapter->getEvtMask())));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ }
+ }
+ }
+}
+
+void LocApiBase::updateEvtMask()
+{
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ LocDualContext::injectFeatureConfig(mContext);
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // 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)
+{
+ // 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: %lld\n rawDataSize: %d\n rawData: %p\n "
+ "Session status: %d\n Technology mask: %u\n "
+ "SV used in fix (gps/glo/bds/gal) : (%x/%x/%x/%x)",
+ 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, location.rawDataSize,
+ location.rawData, 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);
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportPositionEvent(location, locationExtended,
+ status, loc_technology_mask)
+ );
+}
+
+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::reportSv(GnssSvNotification& svNotify)
+{
+ const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
+ "QZSS", "BEIDOU", "GALILEO" };
+
+ // print the SV info before delivering
+ LOC_LOGV("num sv: %d\n"
+ " sv: constellation svid cN0"
+ " elevation azimuth flags",
+ svNotify.count);
+ for (int 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;
+ }
+ LOC_LOGV(" %03d: %*s %02d %f %f %f 0x%02X",
+ 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].gnssSvOptionsMask);
+ }
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvEvent(svNotify)
+ );
+}
+
+void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvMeasurementEvent(svMeasurementSet)
+ );
+}
+
+void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
+ );
+}
+
+void LocApiBase::reportStatus(LocGpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+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::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)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
+}
+
+void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
+{
+ mSupportedMsg = supportedMsgList;
+}
+
+void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
+{
+ memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurementsNotify));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ deleteAidingData(const GnssAidingData& data)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int enable)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* apn, int len)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double latitude, double longitude, float accuracy)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* data, int length)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int handle, int is_succ, char* apn,
+ AGpsBearerType bear, LocAGpsType agpsType)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int handle, int is_succ)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& posMode)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ setServer(const char* url, int len)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setServer(unsigned int ip, int port, LocServerType type)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ informNiResponse(GnssNiResponse userResponse, const void* passThroughData)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setSUPLVersion(GnssConfigSuplVersion version)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setNMEATypes (uint32_t typesMask)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPConfig(GnssConfigLppProfile profile)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int sensorUsage,
+ int sensorProvider)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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::
+ setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(LocGpsLocation& zppLoc)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(LocGpsLocation & zppLoc, LocPosTechMask & tech_mask)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ memset(&tech_mask, 0, sizeof(tech_mask));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+int LocApiBase::
+ initDataServiceClient(bool isDueToSsr)
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ releaseDataServiceClient()
+DEFAULT_IMPL()
+
+LocationError LocApiBase::
+ setGpsLock(GnssConfigGpsLock lock)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::
+ installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask)
+DEFAULT_IMPL()
+
+int LocApiBase::
+ getGpsLock()
+DEFAULT_IMPL(-1)
+
+LocationError LocApiBase::
+ setXtraVersionCheck(uint32_t check)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+bool LocApiBase::
+ gnssConstellationConfig()
+DEFAULT_IMPL(false)
+
+bool LocApiBase::
+ isFeatureSupported(uint8_t featureVal)
+{
+ uint8_t arrayIndex = featureVal >> 3;
+ uint8_t bitPos = featureVal & 7;
+
+ if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
+ return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
+}
+
+} // namespace loc_core
diff --git a/msm8998/core/LocApiBase.h b/msm8998/core/LocApiBase.h
new file mode 100644
index 0000000..86610e7
--- /dev/null
+++ b/msm8998/core/LocApiBase.h
@@ -0,0 +1,265 @@
+/* Copyright (c) 2011-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_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 <platform_lib_log_util.h>
+
+namespace loc_core {
+class ContextBase;
+
+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;
+
+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 class ContextBase;
+ const MsgTask* mMsgTask;
+ ContextBase *mContext;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+ uint64_t mSupportedMsg;
+ uint8_t mFeaturesSupported[MAX_FEATURE_LENGTH];
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+ 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);
+ void reportSv(GnssSvNotification& svNotify);
+ void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet);
+ void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
+ void reportStatus(LocGpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, LocAGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GnssNiNotification ¬ify, const void* data);
+ void saveSupportedMsgList(uint64_t supportedMsgList);
+ void reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify);
+ void saveSupportedFeatureList(uint8_t *featureList);
+ void reportWwanZppFix(LocGpsLocation &zppLoc);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual LocationError
+ deleteAidingData(const GnssAidingData& data);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, LocAGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual LocationError
+ setServer(const char* url, int len);
+ virtual LocationError
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual LocationError
+ informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
+ virtual LocationError setSUPLVersion(GnssConfigSuplVersion version);
+ virtual enum loc_api_adapter_err
+ setNMEATypes (uint32_t typesMask);
+ virtual LocationError setLPPConfig(GnssConfigLppProfile profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual LocationError
+ setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
+ virtual LocationError setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP);
+ virtual LocationError setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP);
+ virtual enum loc_api_adapter_err
+ getWwanZppFix();
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(LocGpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(LocGpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient(bool isDueToSsr);
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+ virtual void releaseDataServiceClient();
+ virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+ inline virtual void setInSession(bool inSession) {
+
+ (void)inSession;
+ }
+ inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
+
+ // confirm if msgID is not larger than the number of bits in
+ // mSupportedMsg
+ if ((uint64_t)msgID > (sizeof(mSupportedMsg) << 3)) {
+ return false;
+ } else {
+ uint32_t messageChecker = 1 << msgID;
+ return (messageChecker & mSupportedMsg) == messageChecker;
+ }
+ }
+
+ void updateEvtMask();
+
+ virtual LocationError setGpsLock(GnssConfigGpsLock lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+
+ virtual LocationError setXtraVersionCheck(uint32_t check);
+ /*
+ Check if the modem support the service
+ */
+ virtual bool gnssConstellationConfig();
+
+ /*
+ Check if a feature is supported
+ */
+ bool isFeatureSupported(uint8_t featureVal);
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/msm8998/core/LocDualContext.cpp b/msm8998/core/LocDualContext.cpp
new file mode 100644
index 0000000..9c2f61a
--- /dev/null
+++ b/msm8998/core/LocDualContext.cpp
@@ -0,0 +1,156 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <platform_lib_log_util.h>
+#include <loc_log.h>
+#include <SystemStatus.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+ContextBase* LocDualContext::mInjectContext = NULL;
+SystemStatus* LocDualContext::mSystemStatus = NULL;
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+#ifndef USE_GLIB
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
+#else
+const char* LocDualContext::mLBSLibName = "liblbs_core.so.1";
+#endif
+
+pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
+
+const MsgTask* LocDualContext::getMsgTask(LocThread::tCreate tCreator,
+ const char* name, bool joinable)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name, joinable);
+ }
+ return mMsgTask;
+}
+
+inline
+const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) {
+ return getMsgTask((LocThread::tCreate)NULL, name, joinable);
+}
+
+ContextBase* LocDualContext::getLocFgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mFgContext->sendMsg(firstMsg);
+ }
+
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mBgContext->sendMsg(firstMsg);
+ }
+
+ return mBgContext;
+}
+
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGd("Calling LBSProxy (%p) to inject feature config",
+ ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mLBSLibName)
+{
+}
+
+SystemStatus* LocDualContext::getSystemStatus(void)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ if (NULL == mSystemStatus) {
+ mSystemStatus = new SystemStatus();
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+ return mSystemStatus;
+}
+
+}
diff --git a/msm8998/core/LocDualContext.h b/msm8998/core/LocDualContext.h
new file mode 100644
index 0000000..5283dc6
--- /dev/null
+++ b/msm8998/core/LocDualContext.h
@@ -0,0 +1,80 @@
+/* Copyright (c) 2011-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_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class SystemStatus;
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+ static ContextBase* mInjectContext;
+ 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;
+ static SystemStatus* mSystemStatus;
+
+protected:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) {
+ return getLocFgContext(NULL, NULL, name, joinable);
+ }
+ static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) {
+ return getLocBgContext(NULL, NULL, name, joinable);
+ }
+
+ static void injectFeatureConfig(ContextBase *context);
+ static SystemStatus* getSystemStatus(void);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/msm8998/core/Makefile.am b/msm8998/core/Makefile.am
new file mode 100644
index 0000000..ad51e50
--- /dev/null
+++ b/msm8998/core/Makefile.am
@@ -0,0 +1,47 @@
+AM_CFLAGS = -I./ \
+ -I../utils \
+ $(LOCPLA_CFLAGS) \
+ $(GPSUTILS_CFLAGS) \
+ -I$(WORKSPACE)/gps-noship/flp \
+ -D__func__=__PRETTY_FUNCTION__ \
+ -fno-short-enums
+
+libloc_core_la_h_sources = \
+ LocApiBase.h \
+ LocAdapterBase.h \
+ ContextBase.h \
+ LocDualContext.h \
+ LBSProxyBase.h \
+ UlpProxyBase.h \
+ loc_core_log.h \
+ LocAdapterProxyBase.h \
+ SystemStatus.h
+
+libloc_core_la_c_sources = \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp \
+ SystemStatus.cpp
+
+library_includedir = $(pkgincludedir)/core
+
+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++ -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 = -lpthread -shared -version-info 1:0:0
+libloc_core_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_core_la_LIBADD = -lstdc++ -ldl $(LOCPLA_LIBS) $(GPSUTILS_LIBS)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_core.la
diff --git a/msm8998/core/SystemStatus.cpp b/msm8998/core/SystemStatus.cpp
new file mode 100644
index 0000000..939005d
--- /dev/null
+++ b/msm8998/core/SystemStatus.cpp
@@ -0,0 +1,1674 @@
+/* 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_SystemStatus"
+
+#include <string>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <pthread.h>
+#include <platform_lib_log_util.h>
+#include <loc_nmea.h>
+#include <SystemStatus.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
+};
+
+// 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,
+ eLeapSeconds = 23,
+ eLeapSecUnc = 24,
+ 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; }
+
+ SystemStatusPQWM1parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ memset(&mM1, 0, sizeof(mM1));
+ if (mField.size() < eMax) {
+ LOC_LOGE("PQWM1parser - invalid size=%d", 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());
+ mM1.mLeapSeconds = atoi(mField[eLeapSeconds].c_str());
+ mM1.mLeapSecUnc = atoi(mField[eLeapSecUnc].c_str());
+ }
+
+ 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 mGpsXtraValid;
+ uint32_t mGloXtraValid;
+ uint64_t mBdsXtraValid;
+ uint64_t mGalXtraValid;
+ uint8_t mQzssXtraValid;
+};
+
+class SystemStatusPQWP3parser : public SystemStatusNmeaBase
+{
+private:
+ 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 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; }
+
+ SystemStatusPQWP3parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP3, 0, sizeof(mP3));
+ 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 mGpsGoodMask;
+ uint32_t mGloGoodMask;
+ uint64_t mBdsGoodMask;
+ uint64_t mGalGoodMask;
+ uint8_t mQzssGoodMask;
+ uint32_t mGpsBadMask;
+ uint32_t mGloBadMask;
+ uint64_t mBdsBadMask;
+ uint64_t mGalBadMask;
+ uint8_t mQzssBadMask;
+};
+
+class SystemStatusPQWP5parser : public SystemStatusNmeaBase
+{
+private:
+ 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 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 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; }
+
+ SystemStatusPQWP5parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ return;
+ }
+ memset(&mP5, 0, sizeof(mP5));
+ 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,
+ eMax = 2 + SV_ALL_NUM*3
+ };
+ SystemStatusPQWP7 mP7;
+
+public:
+ SystemStatusPQWP7parser(const char *str_in, uint32_t len_in)
+ : SystemStatusNmeaBase(str_in, len_in)
+ {
+ if (mField.size() < eMax) {
+ LOC_LOGE("PQWP7parser - invalid size=%d", mField.size());
+ return;
+ }
+ for (uint32_t i=0; i<SV_ALL_NUM; 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)
+{
+}
+
+bool SystemStatusTimeAndClock::equals(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)) {
+ 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",
+ mUtcTime.tv_sec, mUtcTime.tv_nsec,
+ mGpsWeek,
+ mGpsTowMs,
+ mTimeValid,
+ mTimeSource,
+ mTimeUnc,
+ mClockFreqBias,
+ mClockFreqBiasUnc,
+ mLeapSeconds,
+ mLeapSecUnc);
+ return;
+}
+
+/******************************************************************************
+ SystemStatusXoState
+******************************************************************************/
+SystemStatusXoState::SystemStatusXoState(const SystemStatusPQWM1& nmea) :
+ mXoState(nmea.mXoState)
+{
+}
+
+bool SystemStatusXoState::equals(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)
+{
+}
+
+bool SystemStatusRfAndParams::equals(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)) {
+ 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(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(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(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),
+ mGpsXtraValid(nmea.mGpsXtraValid),
+ mGloXtraValid(nmea.mGloXtraValid),
+ mBdsXtraValid(nmea.mBdsXtraValid),
+ mGalXtraValid(nmea.mGalXtraValid),
+ mQzssXtraValid(nmea.mQzssXtraValid)
+{
+}
+
+bool SystemStatusXtra::equals(SystemStatusXtra& peer)
+{
+ if ((mXtraValidMask != peer.mXtraValidMask) ||
+ (mGpsXtraAge != peer.mGpsXtraAge) ||
+ (mGloXtraAge != peer.mGloXtraAge) ||
+ (mBdsXtraAge != peer.mBdsXtraAge) ||
+ (mGalXtraAge != peer.mGalXtraAge) ||
+ (mQzssXtraAge != peer.mQzssXtraAge) ||
+ (mGpsXtraValid != peer.mGpsXtraValid) ||
+ (mGloXtraValid != peer.mGloXtraValid) ||
+ (mBdsXtraValid != peer.mBdsXtraValid) ||
+ (mGalXtraValid != peer.mGalXtraValid) ||
+ (mQzssXtraValid != peer.mQzssXtraValid)) {
+ return false;
+ }
+ return true;
+}
+
+void SystemStatusXtra::dump()
+{
+ LOC_LOGV("SystemStatusXtra: u=%ld:%ld m=%x a=%d:%d:%d:%d:%d v=%x:%x:%x:%x:%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(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:%x:%x:%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),
+ mGpsGoodMask(nmea.mGpsGoodMask),
+ mGloGoodMask(nmea.mGloGoodMask),
+ mBdsGoodMask(nmea.mBdsGoodMask),
+ mGalGoodMask(nmea.mGalGoodMask),
+ mQzssGoodMask(nmea.mQzssGoodMask),
+ mGpsBadMask(nmea.mGpsBadMask),
+ mGloBadMask(nmea.mGloBadMask),
+ mBdsBadMask(nmea.mBdsBadMask),
+ mGalBadMask(nmea.mGalBadMask),
+ mQzssBadMask(nmea.mQzssBadMask)
+{
+}
+
+bool SystemStatusSvHealth::equals(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:%x:%x:%x g=%x:%x:%x:%x:%x b=%x:%x:%x:%x:%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(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(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(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(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()
+{
+ 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();
+}
+
+/******************************************************************************
+ SystemStatus - M1 functions
+******************************************************************************/
+bool SystemStatus::setTimeAndCLock(const SystemStatusPQWM1& nmea)
+{
+ SystemStatusTimeAndClock s(nmea);
+ if (!mCache.mTimeAndClock.empty() && mCache.mTimeAndClock.back().equals(s)) {
+ mCache.mTimeAndClock.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mTimeAndClock.push_back(s);
+ if (mCache.mTimeAndClock.size() > maxTimeAndClock) {
+ mCache.mTimeAndClock.erase(mCache.mTimeAndClock.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setXoState(const SystemStatusPQWM1& nmea)
+{
+ SystemStatusXoState s(nmea);
+ if (!mCache.mXoState.empty() && mCache.mXoState.back().equals(s)) {
+ mCache.mXoState.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mXoState.push_back(s);
+ if (mCache.mXoState.size() > maxXoState) {
+ mCache.mXoState.erase(mCache.mXoState.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setRfAndParams(const SystemStatusPQWM1& nmea)
+{
+ SystemStatusRfAndParams s(nmea);
+ if (!mCache.mRfAndParams.empty() && mCache.mRfAndParams.back().equals(s)) {
+ mCache.mRfAndParams.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mRfAndParams.push_back(s);
+ if (mCache.mRfAndParams.size() > maxRfAndParams) {
+ mCache.mRfAndParams.erase(mCache.mRfAndParams.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setErrRecovery(const SystemStatusPQWM1& nmea)
+{
+ SystemStatusErrRecovery s(nmea);
+ if (!mCache.mErrRecovery.empty() && mCache.mErrRecovery.back().equals(s)) {
+ mCache.mErrRecovery.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mErrRecovery.push_back(s);
+ if (mCache.mErrRecovery.size() > maxErrRecovery) {
+ mCache.mErrRecovery.erase(mCache.mErrRecovery.begin());
+ }
+ }
+ return true;
+}
+
+/******************************************************************************
+ SystemStatus - Px functions
+******************************************************************************/
+bool SystemStatus::setInjectedPosition(const SystemStatusPQWP1& nmea)
+{
+ SystemStatusInjectedPosition s(nmea);
+ if (!mCache.mInjectedPosition.empty() && mCache.mInjectedPosition.back().equals(s)) {
+ mCache.mInjectedPosition.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mInjectedPosition.push_back(s);
+ if (mCache.mInjectedPosition.size() > maxInjectedPosition) {
+ mCache.mInjectedPosition.erase(mCache.mInjectedPosition.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setBestPosition(const SystemStatusPQWP2& nmea)
+{
+ SystemStatusBestPosition s(nmea);
+ if (!mCache.mBestPosition.empty() && mCache.mBestPosition.back().equals(s)) {
+ mCache.mBestPosition.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mBestPosition.push_back(s);
+ if (mCache.mBestPosition.size() > maxBestPosition) {
+ mCache.mBestPosition.erase(mCache.mBestPosition.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setXtra(const SystemStatusPQWP3& nmea)
+{
+ SystemStatusXtra s(nmea);
+ if (!mCache.mXtra.empty() && mCache.mXtra.back().equals(s)) {
+ mCache.mXtra.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mXtra.push_back(s);
+ if (mCache.mXtra.size() > maxXtra) {
+ mCache.mXtra.erase(mCache.mXtra.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setEphemeris(const SystemStatusPQWP4& nmea)
+{
+ SystemStatusEphemeris s(nmea);
+ if (!mCache.mEphemeris.empty() && mCache.mEphemeris.back().equals(s)) {
+ mCache.mEphemeris.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mEphemeris.push_back(s);
+ if (mCache.mEphemeris.size() > maxEphemeris) {
+ mCache.mEphemeris.erase(mCache.mEphemeris.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setSvHealth(const SystemStatusPQWP5& nmea)
+{
+ SystemStatusSvHealth s(nmea);
+ if (!mCache.mSvHealth.empty() && mCache.mSvHealth.back().equals(s)) {
+ mCache.mSvHealth.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mSvHealth.push_back(s);
+ if (mCache.mSvHealth.size() > maxSvHealth) {
+ mCache.mSvHealth.erase(mCache.mSvHealth.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setPdr(const SystemStatusPQWP6& nmea)
+{
+ SystemStatusPdr s(nmea);
+ if (!mCache.mPdr.empty() && mCache.mPdr.back().equals(s)) {
+ mCache.mPdr.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mPdr.push_back(s);
+ if (mCache.mPdr.size() > maxPdr) {
+ mCache.mPdr.erase(mCache.mPdr.begin());
+ }
+ }
+ return true;
+}
+
+bool SystemStatus::setNavData(const SystemStatusPQWP7& nmea)
+{
+ SystemStatusNavData s(nmea);
+ if (!mCache.mNavData.empty() && mCache.mNavData.back().equals(s)) {
+ mCache.mNavData.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mNavData.push_back(s);
+ if (mCache.mNavData.size() > maxNavData) {
+ mCache.mNavData.erase(mCache.mNavData.begin());
+ }
+ }
+ return true;
+}
+
+/******************************************************************************
+ SystemStatus - Sx functions
+******************************************************************************/
+bool SystemStatus::setPositionFailure(const SystemStatusPQWS1& nmea)
+{
+ SystemStatusPositionFailure s(nmea);
+ if (!mCache.mPositionFailure.empty() && mCache.mPositionFailure.back().equals(s)) {
+ mCache.mPositionFailure.back().mUtcReported = s.mUtcReported;
+ } else {
+ mCache.mPositionFailure.push_back(s);
+ if (mCache.mPositionFailure.size() > maxPositionFailure) {
+ mCache.mPositionFailure.erase(mCache.mPositionFailure.begin());
+ }
+ }
+ return true;
+}
+
+/******************************************************************************
+@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 successfully done
+******************************************************************************/
+static uint32_t cnt = 0;
+static uint32_t cnt_m1 = 0;
+static uint32_t cnt_p1 = 0;
+static uint32_t cnt_p2 = 0;
+static uint32_t cnt_p3 = 0;
+static uint32_t cnt_p4 = 0;
+static uint32_t cnt_p5 = 0;
+static uint32_t cnt_p6 = 0;
+static uint32_t cnt_p7 = 0;
+static uint32_t cnt_s1 = 0;
+
+bool SystemStatus::setNmeaString(const char *data, uint32_t len)
+{
+ bool ret = false;
+ 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();
+ ret = setTimeAndCLock(s);
+ ret |= setXoState(s);
+ ret |= setRfAndParams(s);
+ ret |= setErrRecovery(s);
+ cnt_m1++;
+ }
+ else if (0 == strncmp(data, "$PQWP1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setInjectedPosition(SystemStatusPQWP1parser(buf, len).get());
+ cnt_p1++;
+ }
+ else if (0 == strncmp(data, "$PQWP2", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setBestPosition(SystemStatusPQWP2parser(buf, len).get());
+ cnt_p2++;
+ }
+ else if (0 == strncmp(data, "$PQWP3", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setXtra(SystemStatusPQWP3parser(buf, len).get());
+ cnt_p3++;
+ }
+ else if (0 == strncmp(data, "$PQWP4", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setEphemeris(SystemStatusPQWP4parser(buf, len).get());
+ cnt_p4++;
+ }
+ else if (0 == strncmp(data, "$PQWP5", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setSvHealth(SystemStatusPQWP5parser(buf, len).get());
+ cnt_p5++;
+ }
+ else if (0 == strncmp(data, "$PQWP6", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setPdr(SystemStatusPQWP6parser(buf, len).get());
+ cnt_p6++;
+ }
+ else if (0 == strncmp(data, "$PQWP7", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setNavData(SystemStatusPQWP7parser(buf, len).get());
+ cnt_p7++;
+ }
+ else if (0 == strncmp(data, "$PQWS1", SystemStatusNmeaBase::NMEA_MINSIZE)) {
+ ret = setPositionFailure(SystemStatusPQWS1parser(buf, len).get());
+ cnt_s1++;
+ }
+ else {
+ // do nothing
+ }
+ cnt++;
+ LOC_LOGV("setNmeaString: cnt=%d M:%d 1:%d 2:%d 3:%d 4:%d 5:%d 6:%d 7:%d S:%d",
+ cnt,
+ cnt_m1,
+ cnt_p1,
+ cnt_p2,
+ cnt_p3,
+ cnt_p4,
+ cnt_p5,
+ cnt_p6,
+ cnt_p7,
+ cnt_s1);
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return ret;
+}
+
+/******************************************************************************
+@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)
+{
+ SystemStatusLocation s(location, locationEx);
+ if (!mCache.mLocation.empty() && mCache.mLocation.back().equals(s)) {
+ mCache.mLocation.back().mUtcReported = s.mUtcReported;
+ }
+ else {
+ mCache.mLocation.push_back(s);
+ if (mCache.mLocation.size() > maxLocation) {
+ mCache.mLocation.erase(mCache.mLocation.begin());
+ }
+ }
+ LOC_LOGV("eventPosition - lat=%f lon=%f alt=%f speed=%f",
+ s.mLocation.gpsLocation.latitude,
+ s.mLocation.gpsLocation.longitude,
+ s.mLocation.gpsLocation.altitude,
+ s.mLocation.gpsLocation.speed);
+ return true;
+}
+
+/******************************************************************************
+@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
+ report.mLocation.clear();
+ if (mCache.mLocation.size() >= 1) {
+ report.mLocation.push_back(mCache.mLocation.back());
+ report.mLocation.back().dump();
+ }
+
+ report.mTimeAndClock.clear();
+ if (mCache.mTimeAndClock.size() >= 1) {
+ report.mTimeAndClock.push_back(mCache.mTimeAndClock.back());
+ report.mTimeAndClock.back().dump();
+ }
+ report.mXoState.clear();
+ if (mCache.mXoState.size() >= 1) {
+ report.mXoState.push_back(mCache.mXoState.back());
+ report.mXoState.back().dump();
+ }
+ report.mRfAndParams.clear();
+ if (mCache.mRfAndParams.size() >= 1) {
+ report.mRfAndParams.push_back(mCache.mRfAndParams.back());
+ report.mRfAndParams.back().dump();
+ }
+ report.mErrRecovery.clear();
+ if (mCache.mErrRecovery.size() >= 1) {
+ report.mErrRecovery.push_back(mCache.mErrRecovery.back());
+ report.mErrRecovery.back().dump();
+ }
+
+ report.mInjectedPosition.clear();
+ if (mCache.mInjectedPosition.size() >= 1) {
+ report.mInjectedPosition.push_back(mCache.mInjectedPosition.back());
+ report.mInjectedPosition.back().dump();
+ }
+ report.mBestPosition.clear();
+ if (mCache.mBestPosition.size() >= 1) {
+ report.mBestPosition.push_back(mCache.mBestPosition.back());
+ report.mBestPosition.back().dump();
+ }
+ report.mXtra.clear();
+ if (mCache.mXtra.size() >= 1) {
+ report.mXtra.push_back(mCache.mXtra.back());
+ report.mXtra.back().dump();
+ }
+ report.mEphemeris.clear();
+ if (mCache.mEphemeris.size() >= 1) {
+ report.mEphemeris.push_back(mCache.mEphemeris.back());
+ report.mEphemeris.back().dump();
+ }
+ report.mSvHealth.clear();
+ if (mCache.mSvHealth.size() >= 1) {
+ report.mSvHealth.push_back(mCache.mSvHealth.back());
+ report.mSvHealth.back().dump();
+ }
+ report.mPdr.clear();
+ if (mCache.mPdr.size() >= 1) {
+ report.mPdr.push_back(mCache.mPdr.back());
+ report.mPdr.back().dump();
+ }
+ report.mNavData.clear();
+ if (mCache.mNavData.size() >= 1) {
+ report.mNavData.push_back(mCache.mNavData.back());
+ report.mNavData.back().dump();
+ }
+
+ report.mPositionFailure.clear();
+ if (mCache.mPositionFailure.size() >= 1) {
+ report.mPositionFailure.push_back(mCache.mPositionFailure.back());
+ report.mPositionFailure.back().dump();
+ }
+ }
+ 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 = mCache;
+ }
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return true;
+}
+
+/******************************************************************************
+@brief API to set default report data
+
+@param[In] none
+
+@return true when successfully done
+******************************************************************************/
+bool SystemStatus::setDefaultReport(void)
+{
+ pthread_mutex_lock(&mMutexSystemStatus);
+
+ mCache.mLocation.push_back(SystemStatusLocation());
+ if (mCache.mLocation.size() > maxLocation) {
+ mCache.mLocation.erase(mCache.mLocation.begin());
+ }
+
+ mCache.mTimeAndClock.push_back(SystemStatusTimeAndClock());
+ if (mCache.mTimeAndClock.size() > maxTimeAndClock) {
+ mCache.mTimeAndClock.erase(mCache.mTimeAndClock.begin());
+ }
+ mCache.mXoState.push_back(SystemStatusXoState());
+ if (mCache.mXoState.size() > maxXoState) {
+ mCache.mXoState.erase(mCache.mXoState.begin());
+ }
+ mCache.mRfAndParams.push_back(SystemStatusRfAndParams());
+ if (mCache.mRfAndParams.size() > maxRfAndParams) {
+ mCache.mRfAndParams.erase(mCache.mRfAndParams.begin());
+ }
+ mCache.mErrRecovery.push_back(SystemStatusErrRecovery());
+ if (mCache.mErrRecovery.size() > maxErrRecovery) {
+ mCache.mErrRecovery.erase(mCache.mErrRecovery.begin());
+ }
+
+ mCache.mInjectedPosition.push_back(SystemStatusInjectedPosition());
+ if (mCache.mInjectedPosition.size() > maxInjectedPosition) {
+ mCache.mInjectedPosition.erase(mCache.mInjectedPosition.begin());
+ }
+ mCache.mBestPosition.push_back(SystemStatusBestPosition());
+ if (mCache.mBestPosition.size() > maxBestPosition) {
+ mCache.mBestPosition.erase(mCache.mBestPosition.begin());
+ }
+ mCache.mXtra.push_back(SystemStatusXtra());
+ if (mCache.mXtra.size() > maxXtra) {
+ mCache.mXtra.erase(mCache.mXtra.begin());
+ }
+ mCache.mEphemeris.push_back(SystemStatusEphemeris());
+ if (mCache.mEphemeris.size() > maxEphemeris) {
+ mCache.mEphemeris.erase(mCache.mEphemeris.begin());
+ }
+ mCache.mSvHealth.push_back(SystemStatusSvHealth());
+ if (mCache.mSvHealth.size() > maxSvHealth) {
+ mCache.mSvHealth.erase(mCache.mSvHealth.begin());
+ }
+ mCache.mPdr.push_back(SystemStatusPdr());
+ if (mCache.mPdr.size() > maxPdr) {
+ mCache.mPdr.erase(mCache.mPdr.begin());
+ }
+ mCache.mNavData.push_back(SystemStatusNavData());
+ if (mCache.mNavData.size() > maxNavData) {
+ mCache.mNavData.erase(mCache.mNavData.begin());
+ }
+
+ mCache.mPositionFailure.push_back(SystemStatusPositionFailure());
+ if (mCache.mPositionFailure.size() > maxPositionFailure) {
+ mCache.mPositionFailure.erase(mCache.mPositionFailure.begin());
+ }
+
+ pthread_mutex_unlock(&mMutexSystemStatus);
+ return true;
+}
+
+} // namespace loc_core
+
diff --git a/msm8998/core/SystemStatus.h b/msm8998/core/SystemStatus.h
new file mode 100644
index 0000000..78fc6f8
--- /dev/null
+++ b/msm8998/core/SystemStatus.h
@@ -0,0 +1,444 @@
+/* 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 __SYSTEM_STATUS__
+#define __SYSTEM_STATUS__
+
+#include <stdint.h>
+#include <vector>
+#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 GPS_NUM (32)
+#define SBAS_NUM (32)
+#define GLO_NUM (24)
+#define QZSS_NUM (5)
+#define BDS_NUM (37)
+#define GAL_NUM (36)
+#define SV_ALL_NUM (GPS_NUM+GLO_NUM+QZSS_NUM+BDS_NUM+GAL_NUM) //=134
+
+namespace loc_core
+{
+
+/******************************************************************************
+ SystemStatus report data structure
+******************************************************************************/
+class SystemStatusItemBase
+{
+public:
+ timespec mUtcTime; // UTC timestamp when this info was last updated
+ timespec mUtcReported; // UTC timestamp when this info was reported
+
+ SystemStatusItemBase() {
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ mUtcTime.tv_sec = tv.tv_sec;
+ mUtcTime.tv_nsec = tv.tv_usec *1000ULL;
+ mUtcReported = mUtcTime;
+ };
+ virtual ~SystemStatusItemBase() { };
+ virtual void dump(void) { };
+};
+
+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(SystemStatusLocation& peer);
+ void dump(void);
+};
+
+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;
+ inline SystemStatusTimeAndClock() :
+ mGpsWeek(0),
+ mGpsTowMs(0),
+ mTimeValid(0),
+ mTimeSource(0),
+ mTimeUnc(0),
+ mClockFreqBias(0),
+ mClockFreqBiasUnc(0),
+ mLeapSeconds(0),
+ mLeapSecUnc(0) {}
+ inline SystemStatusTimeAndClock(const SystemStatusPQWM1& nmea);
+ bool equals(SystemStatusTimeAndClock& peer);
+ void dump(void);
+};
+
+class SystemStatusXoState : public SystemStatusItemBase
+{
+public:
+ uint8_t mXoState;
+ inline SystemStatusXoState() :
+ mXoState(0) {}
+ inline SystemStatusXoState(const SystemStatusPQWM1& nmea);
+ bool equals(SystemStatusXoState& peer);
+ void dump(void);
+};
+
+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;
+ 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) {}
+ inline SystemStatusRfAndParams(const SystemStatusPQWM1& nmea);
+ bool equals(SystemStatusRfAndParams& peer);
+ void dump(void);
+};
+
+class SystemStatusErrRecovery : public SystemStatusItemBase
+{
+public:
+ uint32_t mRecErrorRecovery;
+ inline SystemStatusErrRecovery() :
+ mRecErrorRecovery(0) {};
+ inline SystemStatusErrRecovery(const SystemStatusPQWM1& nmea);
+ bool equals(SystemStatusErrRecovery& peer);
+ void dump(void);
+};
+
+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(SystemStatusInjectedPosition& peer);
+ void dump(void);
+};
+
+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(SystemStatusBestPosition& peer);
+ void dump(void);
+};
+
+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 mGpsXtraValid;
+ uint32_t mGloXtraValid;
+ uint64_t mBdsXtraValid;
+ uint64_t mGalXtraValid;
+ uint8_t mQzssXtraValid;
+ inline SystemStatusXtra() :
+ mXtraValidMask(0),
+ mGpsXtraAge(0),
+ mGloXtraAge(0),
+ mBdsXtraAge(0),
+ mGalXtraAge(0),
+ mQzssXtraAge(0),
+ mGpsXtraValid(0),
+ mGloXtraValid(0),
+ mBdsXtraValid(0ULL),
+ mGalXtraValid(0ULL),
+ mQzssXtraValid(0) {}
+ inline SystemStatusXtra(const SystemStatusPQWP3& nmea);
+ bool equals(SystemStatusXtra& peer);
+ void dump(void);
+};
+
+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(SystemStatusEphemeris& peer);
+ void dump(void);
+};
+
+class SystemStatusPQWP5;
+class SystemStatusSvHealth : public SystemStatusItemBase
+{
+public:
+ uint32_t mGpsUnknownMask;
+ uint32_t mGloUnknownMask;
+ uint64_t mBdsUnknownMask;
+ uint64_t mGalUnknownMask;
+ uint8_t mQzssUnknownMask;
+ uint32_t mGpsGoodMask;
+ uint32_t mGloGoodMask;
+ uint64_t mBdsGoodMask;
+ uint64_t mGalGoodMask;
+ uint8_t mQzssGoodMask;
+ uint32_t mGpsBadMask;
+ uint32_t mGloBadMask;
+ uint64_t mBdsBadMask;
+ uint64_t mGalBadMask;
+ uint8_t mQzssBadMask;
+ inline SystemStatusSvHealth() :
+ mGpsUnknownMask(0),
+ mGloUnknownMask(0),
+ mBdsUnknownMask(0ULL),
+ mGalUnknownMask(0ULL),
+ mQzssUnknownMask(0),
+ mGpsGoodMask(0),
+ mGloGoodMask(0),
+ mBdsGoodMask(0ULL),
+ mGalGoodMask(0ULL),
+ mQzssGoodMask(0),
+ mGpsBadMask(0),
+ mGloBadMask(0),
+ mBdsBadMask(0ULL),
+ mGalBadMask(0ULL),
+ mQzssBadMask(0) {}
+ inline SystemStatusSvHealth(const SystemStatusPQWP5& nmea);
+ bool equals(SystemStatusSvHealth& peer);
+ void dump(void);
+};
+
+class SystemStatusPQWP6;
+class SystemStatusPdr : public SystemStatusItemBase
+{
+public:
+ uint32_t mFixInfoMask;
+ inline SystemStatusPdr() :
+ mFixInfoMask(0) {}
+ inline SystemStatusPdr(const SystemStatusPQWP6& nmea);
+ bool equals(SystemStatusPdr& peer);
+ void dump(void);
+};
+
+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(SystemStatusNavData& peer);
+ void dump(void);
+};
+
+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(SystemStatusPositionFailure& peer);
+ void dump(void);
+};
+
+/******************************************************************************
+ SystemStatusReports
+******************************************************************************/
+class SystemStatusReports
+{
+public:
+ std::vector<SystemStatusLocation> mLocation;
+
+ std::vector<SystemStatusTimeAndClock> mTimeAndClock;
+ std::vector<SystemStatusXoState> mXoState;
+ std::vector<SystemStatusRfAndParams> mRfAndParams;
+ std::vector<SystemStatusErrRecovery> mErrRecovery;
+
+ 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;
+
+ std::vector<SystemStatusPositionFailure> mPositionFailure;
+};
+
+/******************************************************************************
+ SystemStatus
+******************************************************************************/
+class SystemStatus
+{
+ static pthread_mutex_t mMutexSystemStatus;
+
+ static const uint32_t maxLocation = 5;
+
+ static const uint32_t maxTimeAndClock = 5;
+ static const uint32_t maxXoState = 5;
+ static const uint32_t maxRfAndParams = 5;
+ static const uint32_t maxErrRecovery = 5;
+
+ static const uint32_t maxInjectedPosition = 5;
+ static const uint32_t maxBestPosition = 5;
+ static const uint32_t maxXtra = 5;
+ static const uint32_t maxEphemeris = 5;
+ static const uint32_t maxSvHealth = 5;
+ static const uint32_t maxPdr = 5;
+ static const uint32_t maxNavData = 5;
+
+ static const uint32_t maxPositionFailure = 5;
+
+ SystemStatusReports mCache;
+
+ bool setLocation(const UlpLocation& location);
+
+ bool setTimeAndCLock(const SystemStatusPQWM1& nmea);
+ bool setXoState(const SystemStatusPQWM1& nmea);
+ bool setRfAndParams(const SystemStatusPQWM1& nmea);
+ bool setErrRecovery(const SystemStatusPQWM1& nmea);
+
+ bool setInjectedPosition(const SystemStatusPQWP1& nmea);
+ bool setBestPosition(const SystemStatusPQWP2& nmea);
+ bool setXtra(const SystemStatusPQWP3& nmea);
+ bool setEphemeris(const SystemStatusPQWP4& nmea);
+ bool setSvHealth(const SystemStatusPQWP5& nmea);
+ bool setPdr(const SystemStatusPQWP6& nmea);
+ bool setNavData(const SystemStatusPQWP7& nmea);
+
+ bool setPositionFailure(const SystemStatusPQWS1& nmea);
+
+public:
+ SystemStatus();
+ ~SystemStatus() { }
+
+ bool eventPosition(const UlpLocation& location,const GpsLocationExtended& locationEx);
+ bool setNmeaString(const char *data, uint32_t len);
+ bool getReport(SystemStatusReports& reports, bool isLatestonly = false) const;
+ bool setDefaultReport(void);
+};
+
+} // namespace loc_core
+
+#endif //__SYSTEM_STATUS__
+
diff --git a/msm8998/core/UlpProxyBase.h b/msm8998/core/UlpProxyBase.h
new file mode 100644
index 0000000..8863b66
--- /dev/null
+++ b/msm8998/core/UlpProxyBase.h
@@ -0,0 +1,124 @@
+/* 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 ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+#include <LocationAPI.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ LocPosMode mPosMode;
+ bool mFixSet;
+ inline UlpProxyBase() {
+ mPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mFixSet = false;
+ }
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { mFixSet = true; return false; }
+ inline virtual bool sendStopFix() { mFixSet = false; return false; }
+ inline virtual bool sendFixMode(LocPosMode ¶ms) {
+ mPosMode = params;
+ return false;
+ }
+
+ inline virtual bool reportPosition(const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ (void)location;
+ (void)locationExtended;
+ (void)status;
+ (void)loc_technology_mask;
+ return false;
+ }
+ inline virtual bool reportSv(const GnssSvNotification& svNotify) {
+ (void)svNotify;
+ return false;
+ }
+ inline virtual bool reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) {
+ (void)svMeasurementSet;
+ return false;
+ }
+
+ inline virtual bool reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+ {
+ (void)svPolynomial;
+ return false;
+ }
+ inline virtual bool reportStatus(LocGpsStatusValue status) {
+
+ (void)status;
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* adapter) {
+
+ (void)adapter;
+ }
+ inline virtual void setCapabilities(unsigned long capabilities) {
+
+ (void)capabilities;
+ }
+ inline virtual bool reportBatchingSession(const LocationOptions& options, bool active)
+ {
+ (void)options;
+ (void)active;
+ return false;
+ }
+ inline virtual bool reportPositions(const UlpLocation* ulpLocations,
+ const GpsLocationExtended* extendedLocations,
+ const uint32_t* techMasks,
+ const size_t count)
+ {
+ (void)ulpLocations;
+ (void)extendedLocations;
+ (void)techMasks;
+ (void)count;
+ return false;
+ }
+ inline virtual bool reportDeleteAidingData(LocGpsAidingData aidingData)
+ {
+ (void)aidingData;
+ return false;
+ }
+ inline virtual bool reportNmea(const char* nmea, int length)
+ {
+ (void)nmea;
+ (void)length;
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/msm8998/core/loc_core_log.cpp b/msm8998/core/loc_core_log.cpp
new file mode 100644
index 0000000..b8addec
--- /dev/null
+++ b/msm8998/core/loc_core_log.cpp
@@ -0,0 +1,243 @@
+/* Copyright (c) 2011-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_NDDEBUG 0
+#define LOG_TAG "LocSvc_core_log"
+
+#include <loc_log.h>
+#include <loc_core_log.h>
+#include <platform_lib_includes.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static const loc_name_val_s_type 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 ),
+};
+static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(LocGpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(LocGpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( LOC_GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( LOC_GPS_POSITION_RECURRENCE_SINGLE )
+};
+static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( LOC_GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( LOC_GPS_DELETE_ALMANAC ),
+ NAME_VAL( LOC_GPS_DELETE_POSITION ),
+ NAME_VAL( LOC_GPS_DELETE_TIME ),
+ NAME_VAL( LOC_GPS_DELETE_IONO ),
+ NAME_VAL( LOC_GPS_DELETE_UTC ),
+ NAME_VAL( LOC_GPS_DELETE_HEALTH ),
+ NAME_VAL( LOC_GPS_DELETE_SVDIR ),
+ NAME_VAL( LOC_GPS_DELETE_SVSTEER ),
+ NAME_VAL( LOC_GPS_DELETE_SADATA ),
+ NAME_VAL( LOC_GPS_DELETE_RTI ),
+ NAME_VAL( LOC_GPS_DELETE_CELLDB_INFO ),
+ NAME_VAL( LOC_GPS_DELETE_ALL)
+};
+static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(LocGpsAidingData data)
+{
+ return NULL;
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(LocAGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(LocGpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(LocGpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(LocAGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/msm8998/core/loc_core_log.h b/msm8998/core/loc_core_log.h
new file mode 100644
index 0000000..2beb687
--- /dev/null
+++ b/msm8998/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/msm8998/etc/Android.mk b/msm8998/etc/Android.mk
new file mode 100644
index 0000000..d9eb0e1
--- /dev/null
+++ b/msm8998/etc/Android.mk
@@ -0,0 +1,12 @@
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/
+LOCAL_SRC_FILES := gps.conf
+
+include $(BUILD_PREBUILT)
+
diff --git a/msm8998/etc/gps.conf b/msm8998/etc/gps.conf
new file mode 100644
index 0000000..895ebb5
--- /dev/null
+++ b/msm8998/etc/gps.conf
@@ -0,0 +1,169 @@
+#Uncommenting these urls would only enable
+#the power up auto injection and force injection(test case).
+#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
+#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
+#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
+
+#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=/system/etc/security/cacerts
+
+# 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
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# Emergency SUPL, 1=enable, 0=disable
+#SUPL_ES=0
+
+#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
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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 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
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=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
+LPPE_CP_TECHNOLOGY = 0
+
+##################################################
+# Select technology for LPPe User Plane
+##################################################
+# 0x1: DBH for LPPe UP
+# 0x2: WLAN AP Measurements for LPPe UP
+LPPE_UP_TECHNOLOGY = 0
+
+# AP Coarse Timestamp Uncertainty
+##################################################
+# default : 10
+# or as per clock uncertainty of product
+AP_TIMESTAMP_UNCERTAINTY = 10
+
+#####################################
+# GNSS PPS settings
+#####################################
+#AP DR engine availability status
+# 0 : NO AP DR (default)
+# 1 : AP DR enabled
+#EXTERNAL_DR_ENABLED = 0
+
+#####################################
+#DR_SYNC Pulse Availability
+#####################################
+# 0 : DR_SYNC pulse not available (default)
+# 1 : DR_SYNC pulse available
+DR_SYNC_ENABLED = 0
+
+#####################################
+#PPS Device name
+#####################################
+PPS_DEVICENAME = /dev/pps0
+
+#####################################
+#AP Clock Accuracy
+#####################################
+AP_CLOCK_PPM = 100
+
+#####################################
+#MAX ms difference to detect missing pulse
+#####################################
+MISSING_PULSE_TIME_DELTA = 900
+
+#####################################
+#Propagation time uncertainty
+#####################################
+PROPAGATION_TIME_UNCERTAINTY = 1
diff --git a/msm8998/gnss/Agps.cpp b/msm8998/gnss/Agps.cpp
new file mode 100644
index 0000000..dcb9ad2
--- /dev/null
+++ b/msm8998/gnss/Agps.cpp
@@ -0,0 +1,965 @@
+/* Copyright (c) 2012-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_Agps"
+
+#include <Agps.h>
+#include <platform_lib_includes.h>
+#include <ContextBase.h>
+#include <loc_timer.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);
+
+ /* Send data request
+ * The if condition below is added so that if the data call setup
+ * fails for DS State Machine, we want to retry in released state.
+ * for Agps State Machine, sendRsrcRequest() will always return
+ * success. */
+ if(requestOrReleaseDataConn(true) == 0){
+ // If data request successful, move to pending state
+ 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;
+ notifyEventToSubscriber(
+ AGPS_EVENT_UNSUBSCRIBE, mCurrentSubscriber, false);
+ }
+ 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;
+ notifyEventToSubscriber(
+ AGPS_EVENT_UNSUBSCRIBE, mCurrentSubscriber, false);
+ }
+ 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:
+ LOC_LOGE("Unexpected event RELEASED in state %d", mState);
+ 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 */
+int AgpsStateMachine::requestOrReleaseDataConn(bool request){
+
+ AgpsFrameworkInterface::AGnssStatusIpV4 nifRequest;
+ memset(&nifRequest, 0, sizeof(nifRequest));
+
+ nifRequest.type = (AgpsFrameworkInterface::AGnssType)mAgpsType;
+
+ if(request){
+ LOC_LOGD("AGPS Data Conn Request");
+ nifRequest.status = (AgpsFrameworkInterface::AGnssStatusValue)
+ LOC_GPS_REQUEST_AGPS_DATA_CONN;
+ }
+ else{
+ LOC_LOGD("AGPS Data Conn Release");
+ nifRequest.status = (AgpsFrameworkInterface::AGnssStatusValue)
+ LOC_GPS_RELEASE_AGPS_DATA_CONN;
+ }
+
+ mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
+ return 0;
+}
+
+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(),
+ getBearer(), mAgpsType);
+ break;
+
+ case AGPS_EVENT_DENIED:
+ mAgpsManager->mAtlOpenStatusCb(
+ subscriberToNotify->mConnHandle, 0, getAPN(),
+ getBearer(), mAgpsType);
+ 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;
+ }
+
+ if(apn == NULL || len <= 0){
+ LOC_LOGD("Invalid apn len (%d) or null apn", len);
+ mAPN = NULL;
+ mAPNLen = 0;
+ }
+
+ if (NULL != apn) {
+ mAPN = new char[len+1];
+ 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;
+ }
+}
+
+/* --------------------------------------------------------------------
+ * DS State Machine Methods
+ * -------------------------------------------------------------------*/
+const int DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
+const int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
+
+/* Overridden method
+ * DS SM needs to handle one scenario differently */
+void DSStateMachine::processAgpsEvent(AgpsEvent event){
+
+ LOC_LOGD("DSStateMachine::processAgpsEvent() %d", event);
+
+ /* DS Client call setup APIs don't return failure/closure separately.
+ * Hence we receive RELEASED event in both cases.
+ * If we are in pending, we should consider RELEASED as DENIED */
+ if(event == AGPS_EVENT_RELEASED && mState == AGPS_STATE_PENDING){
+
+ LOC_LOGD("Translating RELEASED to DENIED event");
+ event = AGPS_EVENT_DENIED;
+ }
+
+ /* Redirect process to base class */
+ AgpsStateMachine::processAgpsEvent(event);
+}
+
+/* Timer Callback
+ * For the retry timer started in case of DS Client call setup failure */
+void delay_callback(void *callbackData, int result)
+{
+ LOC_LOGD("delay_callback(): cbData %p", callbackData);
+
+ (void)result;
+
+ if(callbackData == NULL) {
+ LOC_LOGE("delay_callback(): NULL argument received !");
+ return;
+ }
+ DSStateMachine* dsStateMachine = (DSStateMachine *)callbackData;
+ dsStateMachine->retryCallback();
+}
+
+/* Invoked from Timer Callback
+ * For the retry timer started in case of DS Client call setup failure */
+void DSStateMachine :: retryCallback()
+{
+ LOC_LOGD("DSStateMachine::retryCallback()");
+
+ /* Request SUPL ES
+ * There must be at least one active subscriber in list */
+ AgpsSubscriber* subscriber = getFirstSubscriber(false);
+ if(subscriber == NULL) {
+
+ LOC_LOGE("No active subscriber for DS Client call setup");
+ return;
+ }
+
+ /* Send message to retry */
+ mAgpsManager->mSendMsgToAdapterQueueFn(
+ new AgpsMsgRequestATL(
+ mAgpsManager, subscriber->mConnHandle,
+ LOC_AGPS_TYPE_SUPL_ES));
+}
+
+/* Overridden method
+ * Request or Release data connection
+ * bool request :
+ * true = Request data connection
+ * false = Release data connection */
+int DSStateMachine::requestOrReleaseDataConn(bool request){
+
+ LOC_LOGD("DSStateMachine::requestOrReleaseDataConn(): "
+ "request %d", request);
+
+ /* Release data connection required ? */
+ if(!request && mAgpsManager->mDSClientStopDataCallFn){
+
+ mAgpsManager->mDSClientStopDataCallFn();
+ LOC_LOGD("DS Client release data call request sent !");
+ return 0;
+ }
+
+ /* Setup data connection request
+ * There must be at least one active subscriber in list */
+ AgpsSubscriber* subscriber = getFirstSubscriber(false);
+ if(subscriber == NULL) {
+
+ LOC_LOGE("No active subscriber for DS Client call setup");
+ return -1;
+ }
+
+ /* DS Client Fn registered ? */
+ if(!mAgpsManager->mDSClientOpenAndStartDataCallFn){
+
+ LOC_LOGE("DS Client start fn not registered, fallback to SUPL ATL");
+ notifyEventToSubscriber(AGPS_EVENT_DENIED, subscriber, false);
+ return -1;
+ }
+
+ /* Setup the call */
+ int ret = mAgpsManager->mDSClientOpenAndStartDataCallFn();
+
+ /* Check if data call start failed */
+ switch (ret) {
+
+ case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
+ LOC_LOGE("DS Client open call failed, err: %d", ret);
+ mRetries++;
+ if(mRetries > MAX_START_DATA_CALL_RETRIES) {
+
+ LOC_LOGE("DS Client call retries exhausted, "
+ "falling back to normal SUPL ATL");
+ notifyEventToSubscriber(AGPS_EVENT_DENIED, subscriber, false);
+ }
+ /* Retry DS Client call setup after some delay */
+ else if(loc_timer_start(
+ DATA_CALL_RETRY_DELAY_MSEC, delay_callback, this)) {
+ LOC_LOGE("Error: Could not start delay thread\n");
+ return -1;
+ }
+ break;
+
+ case LOC_API_ADAPTER_ERR_UNSUPPORTED:
+ LOC_LOGE("No emergency profile found. Fall back to normal SUPL ATL");
+ notifyEventToSubscriber(AGPS_EVENT_DENIED, subscriber, false);
+ break;
+
+ case LOC_API_ADAPTER_ERR_SUCCESS:
+ LOC_LOGD("Request to start data call sent");
+ break;
+
+ default:
+ LOC_LOGE("Unrecognized return value: %d", ret);
+ }
+
+ return ret;
+}
+
+void DSStateMachine::notifyEventToSubscriber(
+ AgpsEvent event, AgpsSubscriber* subscriberToNotify,
+ bool deleteSubscriberPostNotify) {
+
+ LOC_LOGD("DSStateMachine::notifyEventToSubscriber(): "
+ "SM %p, Event %d Subscriber %p Delete %d",
+ this, event, subscriberToNotify, deleteSubscriberPostNotify);
+
+ switch (event){
+
+ case AGPS_EVENT_GRANTED:
+ mAgpsManager->mAtlOpenStatusCb(
+ subscriberToNotify->mConnHandle, 1, NULL,
+ AGPS_APN_BEARER_INVALID, LOC_AGPS_TYPE_SUPL_ES);
+ break;
+
+ case AGPS_EVENT_DENIED:
+ /* Now try with regular SUPL
+ * We need to send request via message queue */
+ mRetries = 0;
+ mAgpsManager->mSendMsgToAdapterQueueFn(
+ new AgpsMsgRequestATL(
+ mAgpsManager, subscriberToNotify->mConnHandle,
+ LOC_AGPS_TYPE_SUPL));
+ break;
+
+ case AGPS_EVENT_UNSUBSCRIBE:
+ mAgpsManager->mAtlCloseStatusCb(subscriberToNotify->mConnHandle, 1);
+ break;
+
+ case AGPS_EVENT_RELEASED:
+ mAgpsManager->mDSClientCloseDataCallFn();
+ break;
+
+ default:
+ LOC_LOGE("Invalid event %d", event);
+ }
+
+ /* Search this subscriber in list and delete */
+ if (deleteSubscriberPostNotify) {
+ deleteSubscriber(subscriberToNotify);
+ }
+}
+
+/* --------------------------------------------------------------------
+ * Loc AGPS Manager Methods
+ * -------------------------------------------------------------------*/
+
+/* CREATE AGPS STATE MACHINES
+ * Must be invoked in Msg Handler context */
+void AgpsManager::createAgpsStateMachines() {
+
+ 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) {
+ mInternetNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_WWAN_ANY);
+ LOC_LOGD("Internet NIF: %p", mInternetNif);
+ }
+ if (agpsCapable) {
+ if (NULL == mAgnssNif) {
+ mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL);
+ LOC_LOGD("AGNSS NIF: %p", mAgnssNif);
+ }
+ if (NULL == mDsNif &&
+ loc_core::ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL){
+
+ if(!mDSClientInitFn){
+
+ LOC_LOGE("DS Client Init Fn not registered !");
+ return;
+ }
+ if(mDSClientInitFn(false) != 0){
+
+ LOC_LOGE("Failed to init data service client");
+ return;
+ }
+ mDsNif = new DSStateMachine(this);
+ LOC_LOGD("DS NIF: %p", mDsNif);
+ }
+ }
+}
+
+AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) {
+
+ LOC_LOGD("AgpsManager::getAgpsStateMachine(): agpsType %d", agpsType);
+
+ switch (agpsType) {
+
+ case LOC_AGPS_TYPE_INVALID:
+ case LOC_AGPS_TYPE_SUPL:
+ if(mAgnssNif == NULL){
+ LOC_LOGE("NULL AGNSS NIF !");
+ }
+ return mAgnssNif;
+
+ case LOC_AGPS_TYPE_SUPL_ES:
+ if (loc_core::ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ if (mDsNif == NULL) {
+ createAgpsStateMachines();
+ }
+ return mDsNif;
+ } else {
+ return mAgnssNif;
+ }
+
+ default:
+ return mInternetNif;
+ }
+
+ LOC_LOGE("No SM found !");
+ return NULL;
+}
+
+void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType){
+
+ LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType %d",
+ connHandle, agpsType);
+
+ AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
+
+ if(sm == NULL){
+
+ LOC_LOGE("No AGPS State Machine for agpsType: %d", agpsType);
+ mAtlOpenStatusCb(
+ connHandle, 0, NULL, AGPS_APN_BEARER_INVALID, agpsType);
+ return;
+ }
+
+ /* Invoke AGPS SM processing */
+ AgpsSubscriber subscriber(connHandle, false, false);
+ sm->setCurrentSubscriber(&subscriber);
+
+ /* If DS State Machine, wait for close complete */
+ if(agpsType == LOC_AGPS_TYPE_SUPL_ES){
+ subscriber.mWaitForCloseComplete = true;
+ }
+
+ /* 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;
+ }
+ else if (mDsNif &&
+ (subscriber = mDsNif->getSubscriber(connHandle)) != NULL) {
+ sm = mDsNif;
+ }
+
+ if(sm == NULL){
+ LOC_LOGE("Subscriber with connHandle %d not found in any SM",
+ connHandle);
+ mAtlCloseStatusCb(connHandle, 0);
+ return;
+ }
+
+ /* Now send unsubscribe event */
+ sm->setCurrentSubscriber(subscriber);
+ sm->processAgpsEvent(AGPS_EVENT_UNSUBSCRIBE);
+}
+
+void AgpsManager::reportDataCallOpened(){
+
+ LOC_LOGD("AgpsManager::reportDataCallOpened");
+
+ if (mDsNif) {
+ mDsNif->processAgpsEvent(AGPS_EVENT_GRANTED);
+ }
+}
+
+void AgpsManager::reportDataCallClosed(){
+
+ LOC_LOGD("AgpsManager::reportDataCallClosed");
+
+ if (mDsNif) {
+ mDsNif->processAgpsEvent(AGPS_EVENT_RELEASED);
+ }
+}
+
+void AgpsManager::reportAtlOpenSuccess(
+ AGpsExtType agpsType, char* apnName, int apnLen,
+ LocApnIpType ipType){
+
+ LOC_LOGD("AgpsManager::reportAtlOpenSuccess(): "
+ "AgpsType %d, APN [%s], Len %d, IPType %d",
+ agpsType, apnName, apnLen, ipType);
+
+ /* Find the state machine instance */
+ AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
+
+ /* Convert LocApnIpType sent by framework to AGpsBearerType */
+ AGpsBearerType bearerType;
+ switch (ipType) {
+ case LOC_APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case LOC_APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case LOC_APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ }
+
+ /* 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();
+ }
+ if(mDsNif){
+ mDsNif->dropAllSubscribers();
+ }
+
+ // reinitialize DS client in SSR mode
+ if(loc_core::ContextBase::mGps_conf.
+ USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL){
+
+ mDSClientStopDataCallFn();
+ mDSClientCloseDataCallFn();
+ mDSClientReleaseFn();
+
+ mDSClientInitFn(true);
+ }
+}
+
+AGpsBearerType AgpsUtils::ipTypeToBearerType(LocApnIpType ipType) {
+
+ switch (ipType) {
+
+ case LOC_APN_IP_IPV4:
+ return AGPS_APN_BEARER_IPV4;
+
+ case LOC_APN_IP_IPV6:
+ return AGPS_APN_BEARER_IPV6;
+
+ case LOC_APN_IP_IPV4V6:
+ return AGPS_APN_BEARER_IPV4V6;
+
+ default:
+ return AGPS_APN_BEARER_IPV4;
+ }
+}
+
+LocApnIpType AgpsUtils::bearerTypeToIpType(AGpsBearerType bearerType){
+
+ switch (bearerType) {
+
+ case AGPS_APN_BEARER_IPV4:
+ return LOC_APN_IP_IPV4;
+
+ case AGPS_APN_BEARER_IPV6:
+ return LOC_APN_IP_IPV6;
+
+ case AGPS_APN_BEARER_IPV4V6:
+ return LOC_APN_IP_IPV4V6;
+
+ default:
+ return LOC_APN_IP_IPV4;
+ }
+}
diff --git a/msm8998/gnss/Agps.h b/msm8998/gnss/Agps.h
new file mode 100644
index 0000000..d3fc362
--- /dev/null
+++ b/msm8998/gnss/Agps.h
@@ -0,0 +1,449 @@
+/* Copyright (c) 2012-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 AGPS_H
+#define AGPS_H
+
+#include <functional>
+#include <list>
+#include <MsgTask.h>
+#include <gps_extended_c.h>
+#include <platform_lib_log_util.h>
+
+/* ATL callback function pointers
+ * Passed in by Adapter to AgpsManager */
+typedef std::function<void(
+ int handle, int isSuccess, char* apn,
+ AGpsBearerType bearerType, AGpsExtType agpsType)> AgpsAtlOpenStatusCb;
+
+typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
+
+/* DS Client control APIs
+ * Passed in by Adapter to AgpsManager */
+typedef std::function<int(bool isDueToSSR)> AgpsDSClientInitFn;
+typedef std::function<int()> AgpsDSClientOpenAndStartDataCallFn;
+typedef std::function<void()> AgpsDSClientStopDataCallFn;
+typedef std::function<void()> AgpsDSClientCloseDataCallFn;
+typedef std::function<void()> AgpsDSClientReleaseFn;
+
+/* 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;
+
+/* Framework AGNSS interface
+ * This interface is defined in IAGnssCallback provided by
+ * Android Framework.
+ * Must be kept in sync with that interface. */
+namespace AgpsFrameworkInterface {
+
+ /** AGNSS type **/
+ enum AGnssType : uint8_t {
+ TYPE_SUPL = 1,
+ TYPE_C2K = 2
+ };
+
+ enum AGnssStatusValue : uint8_t {
+ /** GNSS requests data connection for AGNSS. */
+ REQUEST_AGNSS_DATA_CONN = 1,
+ /** GNSS releases the AGNSS data connection. */
+ RELEASE_AGNSS_DATA_CONN = 2,
+ /** AGNSS data connection initiated */
+ AGNSS_DATA_CONNECTED = 3,
+ /** AGNSS data connection completed */
+ AGNSS_DATA_CONN_DONE = 4,
+ /** AGNSS data connection failed */
+ AGNSS_DATA_CONN_FAILED = 5
+ };
+
+ /*
+ * Represents the status of AGNSS augmented to support IPv4.
+ */
+ struct AGnssStatusIpV4 {
+ AGnssType type;
+ AGnssStatusValue status;
+ /*
+ * 32-bit IPv4 address.
+ */
+ unsigned int ipV4Addr;
+ };
+
+ /*
+ * Represents the status of AGNSS augmented to support IPv6.
+ */
+ struct AGnssStatusIpV6 {
+ AGnssType type;
+ AGnssStatusValue status;
+ /*
+ * 128-bit IPv6 address.
+ */
+ unsigned char ipV6Addr[16];
+ };
+
+ /*
+ * Callback with AGNSS(IpV4) status information.
+ *
+ * @param status Will be of type AGnssStatusIpV4.
+ */
+ typedef void (*AgnssStatusIpV4Cb)(AGnssStatusIpV4 status);
+
+ /*
+ * Callback with AGNSS(IpV6) status information.
+ *
+ * @param status Will be of type AGnssStatusIpV6.
+ */
+ typedef void (*AgnssStatusIpV6Cb)(AGnssStatusIpV6 status);
+}
+
+/* Classes in this header */
+class AgpsSubscriber;
+class AgpsManager;
+class AgpsStateMachine;
+class DSStateMachine;
+
+
+/* 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;
+
+ inline AgpsSubscriber(
+ int connHandle, bool waitForCloseComplete, bool isInactive) :
+ mConnHandle(connHandle),
+ mWaitForCloseComplete(waitForCloseComplete),
+ mIsInactive(isInactive) {}
+ 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); }
+};
+
+/* 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;
+
+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;
+
+ /* APN and IP Type info for AGPS Call */
+ char* mAPN;
+ unsigned int mAPNLen;
+ AGpsBearerType mBearer;
+
+public:
+ /* CONSTRUCTOR */
+ AgpsStateMachine(AgpsManager* agpsManager, AGpsExtType agpsType):
+ 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 void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
+ inline AGpsBearerType getBearer() const { return mBearer; }
+ inline AGpsExtType getType() const { return mAgpsType; }
+ inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
+ { mCurrentSubscriber = subscriber; }
+
+ /* 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) */
+ virtual int 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);
+};
+
+/* DS STATE MACHINE */
+class DSStateMachine : public AgpsStateMachine {
+
+private:
+ static const int MAX_START_DATA_CALL_RETRIES;
+ static const int DATA_CALL_RETRY_DELAY_MSEC;
+
+ int mRetries;
+
+public:
+ /* CONSTRUCTOR */
+ DSStateMachine(AgpsManager* agpsManager):
+ AgpsStateMachine(agpsManager, LOC_AGPS_TYPE_SUPL_ES), mRetries(0) {}
+
+ /* Overridden method
+ * DS SM needs to handle one event differently */
+ void processAgpsEvent(AgpsEvent event);
+
+ /* Retry callback, used in case call failure */
+ void retryCallback();
+
+private:
+ /* Overridden method, different functionality for DS SM
+ * Send call setup request to framework
+ * sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
+ * sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
+ int requestOrReleaseDataConn(bool request);
+
+ /* Overridden method, different functionality for DS SM */
+ void notifyEventToSubscriber(
+ AgpsEvent event, AgpsSubscriber* subscriber,
+ bool deleteSubscriberPostNotify);
+};
+
+/* LOC AGPS MANAGER */
+class AgpsManager {
+
+ friend class AgpsStateMachine;
+ friend class DSStateMachine;
+
+public:
+ /* CONSTRUCTOR */
+ AgpsManager():
+ mFrameworkStatusV4Cb(NULL),
+ mAtlOpenStatusCb(), mAtlCloseStatusCb(),
+ mDSClientInitFn(), mDSClientOpenAndStartDataCallFn(),
+ mDSClientStopDataCallFn(), mDSClientCloseDataCallFn(), mDSClientReleaseFn(),
+ mSendMsgToAdapterQueueFn(),
+ mAgnssNif(NULL), mInternetNif(NULL), mDsNif(NULL) {}
+
+ /* Register callbacks */
+ void registerCallbacks(
+ AgpsFrameworkInterface::AgnssStatusIpV4Cb
+ frameworkStatusV4Cb,
+
+ AgpsAtlOpenStatusCb atlOpenStatusCb,
+ AgpsAtlCloseStatusCb atlCloseStatusCb,
+
+ AgpsDSClientInitFn dsClientInitFn,
+ AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
+ AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
+ AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
+ AgpsDSClientReleaseFn dsClientReleaseFn,
+
+ SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn ){
+
+ mFrameworkStatusV4Cb = frameworkStatusV4Cb;
+
+ mAtlOpenStatusCb = atlOpenStatusCb;
+ mAtlCloseStatusCb = atlCloseStatusCb;
+
+ mDSClientInitFn = dsClientInitFn;
+ mDSClientOpenAndStartDataCallFn = dsClientOpenAndStartDataCallFn;
+ mDSClientStopDataCallFn = dsClientStopDataCallFn;
+ mDSClientCloseDataCallFn = dsClientCloseDataCallFn;
+ mDSClientReleaseFn = dsClientReleaseFn;
+
+ mSendMsgToAdapterQueueFn = sendMsgToAdapterQueueFn;
+ }
+
+ /* Create all AGPS state machines */
+ void createAgpsStateMachines();
+
+ /* Process incoming ATL requests */
+ void requestATL(int connHandle, AGpsExtType agpsType);
+ void releaseATL(int connHandle);
+
+ /* Process incoming DS Client data call events */
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+
+ /* Process incoming framework data call events */
+ void reportAtlOpenSuccess(
+ AGpsExtType agpsType, char* apnName, int apnLen,
+ LocApnIpType ipType);
+ void reportAtlOpenFailed(AGpsExtType agpsType);
+ void reportAtlClosed(AGpsExtType agpsType);
+
+ /* Handle Modem SSR */
+ void handleModemSSR();
+
+protected:
+ AgpsFrameworkInterface::AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
+
+ AgpsAtlOpenStatusCb mAtlOpenStatusCb;
+ AgpsAtlCloseStatusCb mAtlCloseStatusCb;
+
+ AgpsDSClientInitFn mDSClientInitFn;
+ AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn;
+ AgpsDSClientStopDataCallFn mDSClientStopDataCallFn;
+ AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn;
+ AgpsDSClientReleaseFn mDSClientReleaseFn;
+
+ SendMsgToAdapterMsgQueueFn mSendMsgToAdapterQueueFn;
+
+ AgpsStateMachine* mAgnssNif;
+ AgpsStateMachine* mInternetNif;
+ AgpsStateMachine* mDsNif;
+
+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;
+
+ inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle,
+ AGpsExtType agpsType) :
+ LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle), mAgpsType(
+ agpsType) {
+
+ LOC_LOGV("AgpsMsgRequestATL");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgRequestATL::proc()");
+ mAgpsManager->requestATL(mConnHandle, mAgpsType);
+ }
+};
+
+namespace AgpsUtils {
+
+AGpsBearerType ipTypeToBearerType(LocApnIpType ipType);
+LocApnIpType bearerTypeToIpType(AGpsBearerType bearerType);
+
+}
+
+#endif /* AGPS_H */
diff --git a/msm8998/gnss/Android.mk b/msm8998/gnss/Android.mk
new file mode 100644
index 0000000..fd8ceaa
--- /dev/null
+++ b/msm8998/gnss/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 := libgnss
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_OWNER := qti
+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
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER
+endif
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_core \
+ $(TARGET_OUT_HEADERS)/libloc_pla \
+ $(TARGET_OUT_HEADERS)/liblocation_api
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8998/gnss/GnssAdapter.cpp b/msm8998/gnss/GnssAdapter.cpp
new file mode 100644
index 0000000..9809125
--- /dev/null
+++ b/msm8998/gnss/GnssAdapter.cpp
@@ -0,0 +1,2855 @@
+/* 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_GnssAdapter"
+
+#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 <loc_log.h>
+#include <loc_nmea.h>
+#include <Agps.h>
+#include <SystemStatus.h>
+
+#include <loc_nmea.h>
+#include <vector>
+#include <string>
+
+using namespace loc_core;
+
+GnssAdapter::GnssAdapter() :
+ LocAdapterBase(0,
+ LocDualContext::getLocFgContext(NULL,
+ NULL,
+ LocDualContext::mLocationHalName,
+ false)),
+ mUlpProxy(new UlpProxyBase()),
+ mUlpPositionMode(),
+ mGnssSvIdUsedInPosition(),
+ mGnssSvIdUsedInPosAvail(false),
+ mControlCallbacks(),
+ mPowerVoteId(0),
+ mNiData(),
+ mAgpsManager()
+{
+ LOC_LOGD("%s]: Constructor %p", __func__, this);
+ mUlpPositionMode.mode = LOC_POSITION_MODE_INVALID;
+ readConfigCommand();
+ setConfigCommand();
+
+}
+
+inline
+GnssAdapter::~GnssAdapter()
+{
+ LOC_LOGD("%s]: Destructor", __func__);
+ delete mUlpProxy;
+}
+
+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 LocationOptions& options)
+{
+ LocPosMode locPosMode = {};
+ switch (options.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 = options.minInterval;
+}
+
+void
+GnssAdapter::convertLocation(Location& out, const LocGpsLocation& locGpsLocation,
+ const GpsLocationExtended& locationExtended,
+ const LocPosTechMask techMask)
+{
+ out.size = sizeof(Location);
+ if (LOC_GPS_LOCATION_HAS_LAT_LONG & locGpsLocation.flags) {
+ out.flags |= LOCATION_HAS_LAT_LONG_BIT;
+ out.latitude = locGpsLocation.latitude;
+ out.longitude = locGpsLocation.longitude;
+ }
+ if (LOC_GPS_LOCATION_HAS_ALTITUDE & locGpsLocation.flags) {
+ out.flags |= LOCATION_HAS_ALTITUDE_BIT;
+ out.altitude = locGpsLocation.altitude;
+ }
+ if (LOC_GPS_LOCATION_HAS_SPEED & locGpsLocation.flags) {
+ out.flags |= LOCATION_HAS_SPEED_BIT;
+ out.speed = locGpsLocation.speed;
+ }
+ if (LOC_GPS_LOCATION_HAS_BEARING & locGpsLocation.flags) {
+ out.flags |= LOCATION_HAS_BEARING_BIT;
+ out.bearing = locGpsLocation.bearing;
+ }
+ if (LOC_GPS_LOCATION_HAS_ACCURACY & locGpsLocation.flags) {
+ out.flags |= LOCATION_HAS_ACCURACY_BIT;
+ out.accuracy = locGpsLocation.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 = locGpsLocation.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;
+ }
+}
+
+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_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;
+ }
+}
+
+inline uint32_t
+GnssAdapter::convertGpsLock(const GnssConfigGpsLock gpsLock)
+{
+ switch (gpsLock) {
+ case GNSS_CONFIG_GPS_LOCK_MO:
+ return 1;
+ case GNSS_CONFIG_GPS_LOCK_NI:
+ return 2;
+ case GNSS_CONFIG_GPS_LOCK_MO_AND_NI:
+ return 3;
+ case GNSS_CONFIG_GPS_LOCK_NONE:
+ default:
+ return 0;
+ }
+}
+
+inline GnssConfigGpsLock
+GnssAdapter::convertGpsLock(const uint32_t gpsLock)
+{
+ switch (gpsLock) {
+ case 1:
+ return GNSS_CONFIG_GPS_LOCK_MO;
+ case 2:
+ return GNSS_CONFIG_GPS_LOCK_NI;
+ case 3:
+ return GNSS_CONFIG_GPS_LOCK_MO_AND_NI;
+ case 0:
+ default:
+ return GNSS_CONFIG_GPS_LOCK_NONE;
+ }
+}
+
+inline uint32_t
+GnssAdapter::convertSuplVersion(const GnssConfigSuplVersion suplVersion)
+{
+ switch (suplVersion) {
+ 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 GnssConfigSuplVersion
+GnssAdapter::convertSuplVersion(const uint32_t suplVersion)
+{
+ switch (suplVersion) {
+ case 0x00020000:
+ return GNSS_CONFIG_SUPL_VERSION_2_0_0;
+ case 0x00020002:
+ return GNSS_CONFIG_SUPL_VERSION_2_0_2;
+ case 0x00010000:
+ default:
+ return GNSS_CONFIG_SUPL_VERSION_1_0_0;
+ }
+}
+
+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;
+ }
+}
+
+inline GnssConfigLppProfile
+GnssAdapter::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;
+ }
+}
+
+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);
+ }
+ return mask;
+}
+
+GnssConfigLppeControlPlaneMask
+GnssAdapter::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;
+ }
+ 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);
+ }
+ return mask;
+}
+
+GnssConfigLppeUserPlaneMask
+GnssAdapter::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;
+ }
+ 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;
+}
+
+bool
+GnssAdapter::resolveInAddress(const char* hostAddress, struct in_addr* inAddress)
+{
+ bool ret = true;
+
+ struct hostent* hp;
+ hp = gethostbyname(hostAddress);
+ if (hp != NULL) { /* DNS OK */
+ memcpy(inAddress, hp->h_addr_list[0], hp->h_length);
+ } else {
+ /* Try IP representation */
+ if (inet_aton(hostAddress, inAddress) == 0) {
+ /* IP not valid */
+ LOC_LOGE("%s]: DNS query on '%s' failed", __func__, hostAddress);
+ ret = false;
+ }
+ }
+
+ return ret;
+}
+
+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 {
+ // reads config into mContext->mGps_conf
+ mContext.readConfig();
+ mContext.requestUlp((LocAdapterBase*)mAdapter, mContext.getCarrierCapabilities());
+ }
+ };
+
+ if (mContext != NULL) {
+ sendMsg(new MsgReadConfig(this, *mContext));
+ }
+}
+
+void
+GnssAdapter::setConfigCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgSetConfig : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ inline MsgSetConfig(GnssAdapter& adapter,
+ LocApiBase& api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ inline virtual void proc() const {
+ LocDualContext::injectFeatureConfig(mAdapter.getContext());
+ mApi.setSUPLVersion(mAdapter.convertSuplVersion(ContextBase::mGps_conf.SUPL_VER));
+ mApi.setLPPConfig(mAdapter.convertLppProfile(ContextBase::mGps_conf.LPP_PROFILE));
+ mApi.setSensorControlConfig(ContextBase::mSap_conf.SENSOR_USAGE,
+ ContextBase::mSap_conf.SENSOR_PROVIDER);
+ mApi.setAGLONASSProtocol(ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT);
+ mApi.setLPPeProtocolCp(
+ mAdapter.convertLppeCp(ContextBase::mGps_conf.LPPE_CP_TECHNOLOGY));
+ mApi.setLPPeProtocolUp(
+ mAdapter.convertLppeUp(ContextBase::mGps_conf.LPPE_UP_TECHNOLOGY));
+
+ // set nmea mask type
+ uint32_t mask = 0;
+ if (NMEA_PROVIDER_MP == ContextBase::mGps_conf.NMEA_PROVIDER) {
+ mask = LOC_NMEA_ALL_SUPPORTED_MASK;
+ } else {
+ mask = LOC_NMEA_MASK_DEBUG_V02;
+ }
+ mApi.setNMEATypes(mask);
+
+ mApi.setXtraVersionCheck(ContextBase::mGps_conf.XTRA_VERSION_CHECK);
+ if (ContextBase::mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID ||
+ ContextBase::mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ ContextBase::mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ ContextBase::mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
+ ContextBase::mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) {
+ mApi.setSensorProperties(
+ ContextBase::mSap_conf.GYRO_BIAS_RANDOM_WALK_VALID,
+ ContextBase::mSap_conf.GYRO_BIAS_RANDOM_WALK,
+ ContextBase::mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ ContextBase::mSap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY,
+ ContextBase::mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ ContextBase::mSap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY,
+ ContextBase::mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ ContextBase::mSap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY,
+ ContextBase::mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID,
+ ContextBase::mSap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY);
+ }
+ mApi.setSensorPerfControlConfig(
+ ContextBase::mSap_conf.SENSOR_CONTROL_MODE,
+ ContextBase::mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH,
+ ContextBase::mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC,
+ ContextBase::mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH,
+ ContextBase::mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC,
+ ContextBase::mSap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH,
+ ContextBase::mSap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH,
+ ContextBase::mSap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH,
+ ContextBase::mSap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH,
+ ContextBase::mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK);
+ }
+ };
+
+ sendMsg(new MsgSetConfig(*this, *mLocApi));
+}
+
+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];
+ 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;
+ uint32_t* mIds;
+ size_t mCount;
+ inline MsgGnssUpdateConfig(GnssAdapter& adapter,
+ LocApiBase& api,
+ GnssConfig config,
+ uint32_t* ids,
+ size_t count) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mConfig(config),
+ mIds(ids),
+ mCount(count) {}
+ inline virtual ~MsgGnssUpdateConfig()
+ {
+ delete[] mIds;
+ }
+ inline virtual void proc() const {
+ //const size_t MAX_BITS_COUNT = 10;
+ //LocationError errs[MAX_BITS_COUNT] = {};
+ LocationError* errs = new LocationError[mCount];
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ uint32_t index = 0;
+
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT) {
+ uint32_t newGpsLock = mAdapter.convertGpsLock(mConfig.gpsLock);
+ ContextBase::mGps_conf.GPS_LOCK = newGpsLock;
+ if (0 == mAdapter.getPowerVoteId()) {
+ err = mApi.setGpsLock(mConfig.gpsLock);
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT) {
+ uint32_t newSuplVersion = mAdapter.convertSuplVersion(mConfig.suplVersion);
+ if (newSuplVersion != ContextBase::mGps_conf.SUPL_VER) {
+ ContextBase::mGps_conf.SUPL_VER = newSuplVersion;
+ err = mApi.setSUPLVersion(mConfig.suplVersion);
+ } else {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
+ if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) {
+ char serverUrl[MAX_URL_LEN] = {};
+ uint32_t length = 0;
+ const char noHost[] = "NONE";
+ if (NULL == mConfig.assistanceServer.hostName ||
+ strncasecmp(noHost,
+ mConfig.assistanceServer.hostName,
+ sizeof(noHost)) == 0) {
+ } else {
+ length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u",
+ mConfig.assistanceServer.hostName,
+ mConfig.assistanceServer.port);
+ }
+
+ if (sizeof(serverUrl) > length) {
+ err = mApi.setServer(serverUrl, length);
+ } else {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ }
+ } else if (GNSS_ASSISTANCE_TYPE_C2K == mConfig.assistanceServer.type) {
+ struct in_addr addr;
+ if (!mAdapter.resolveInAddress(mConfig.assistanceServer.hostName, &addr)) {
+ LOC_LOGE("%s]: hostName %s cannot be resolved",
+ __func__, mConfig.assistanceServer.hostName);
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else {
+ unsigned int ip = htonl(addr.s_addr);
+ err = mApi.setServer(ip, mConfig.assistanceServer.port,
+ LOC_AGPS_CDMA_PDE_SERVER);
+ }
+ } else {
+ LOC_LOGE("%s]: Not a valid gnss assistance type %u",
+ __func__, mConfig.assistanceServer.type);
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT) {
+ uint32_t newLppProfile = mAdapter.convertLppProfile(mConfig.lppProfile);
+ if (newLppProfile != ContextBase::mGps_conf.LPP_PROFILE) {
+ ContextBase::mGps_conf.LPP_PROFILE = newLppProfile;
+ err = mApi.setLPPConfig(mConfig.lppProfile);
+ } else {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT) {
+ uint32_t newLppeControlPlaneMask =
+ mAdapter.convertLppeCp(mConfig.lppeControlPlaneMask);
+ if (newLppeControlPlaneMask != ContextBase::mGps_conf.LPPE_CP_TECHNOLOGY) {
+ ContextBase::mGps_conf.LPPE_CP_TECHNOLOGY = newLppeControlPlaneMask;
+ err = mApi.setLPPeProtocolCp(mConfig.lppeControlPlaneMask);
+ } else {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT) {
+ uint32_t newLppeUserPlaneMask =
+ mAdapter.convertLppeUp(mConfig.lppeUserPlaneMask);
+ if (newLppeUserPlaneMask != ContextBase::mGps_conf.LPPE_UP_TECHNOLOGY) {
+ ContextBase::mGps_conf.LPPE_UP_TECHNOLOGY = newLppeUserPlaneMask;
+ err = mApi.setLPPeProtocolUp(mConfig.lppeUserPlaneMask);
+ } else {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT) {
+ uint32_t newAGloProtMask =
+ mAdapter.convertAGloProt(mConfig.aGlonassPositionProtocolMask);
+ if (newAGloProtMask != ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT) {
+ ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT = newAGloProtMask;
+ err = mApi.setAGLONASSProtocol(mConfig.aGlonassPositionProtocolMask);
+ } else {
+ err = LOCATION_ERROR_SUCCESS;
+ }
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT) {
+ uint32_t newEP4ES = mAdapter.convertEP4ES(mConfig.emergencyPdnForEmergencySupl);
+ if (newEP4ES != ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
+ ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = newEP4ES;
+ }
+ err = LOCATION_ERROR_SUCCESS;
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT) {
+ uint32_t newSuplEs = mAdapter.convertSuplEs(mConfig.suplEmergencyServices);
+ if (newSuplEs != ContextBase::mGps_conf.SUPL_ES) {
+ ContextBase::mGps_conf.SUPL_ES = newSuplEs;
+ }
+ err = LOCATION_ERROR_SUCCESS;
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+ if (mConfig.flags & GNSS_CONFIG_FLAGS_SUPL_MODE_BIT) {
+ uint32_t newSuplMode = mAdapter.convertSuplMode(mConfig.suplModeMask);
+ if (newSuplMode != ContextBase::mGps_conf.SUPL_MODE) {
+ ContextBase::mGps_conf.SUPL_MODE = newSuplMode;
+ mAdapter.getUlpProxy()->setCapabilities(
+ ContextBase::getCarrierCapabilities());
+ }
+ err = LOCATION_ERROR_SUCCESS;
+ if (index < mCount) {
+ errs[index++] = err;
+ }
+ }
+
+ mAdapter.reportResponse(index, errs, mIds);
+ delete[] errs;
+ }
+ };
+
+ if (NULL != ids) {
+ sendMsg(new MsgGnssUpdateConfig(*this, *mLocApi, config, ids, count));
+ } else {
+ LOC_LOGE("%s]: No GNSS config items to update", __func__);
+ }
+
+ return ids;
+}
+
+uint32_t
+GnssAdapter::gnssDeleteAidingDataCommand(GnssAidingData& data)
+{
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGD("%s]: id %u", __func__, sessionId);
+
+ struct MsgDeleteAidingData : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ uint32_t mSessionId;
+ GnssAidingData mData;
+ inline MsgDeleteAidingData(GnssAdapter& adapter,
+ LocApiBase& api,
+ uint32_t sessionId,
+ GnssAidingData& data) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mSessionId(sessionId),
+ mData(data) {}
+ inline virtual void proc() const {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ err = mApi.deleteAidingData(mData);
+ mAdapter.reportResponse(err, mSessionId);
+ }
+ };
+
+ sendMsg(new MsgDeleteAidingData(*this, *mLocApi, sessionId, data));
+ return sessionId;
+}
+
+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;
+ double mLatitude;
+ double mLongitude;
+ float mAccuracy;
+ inline MsgInjectLocation(LocApiBase& api,
+ ContextBase& context,
+ double latitude,
+ double longitude,
+ float accuracy) :
+ LocMsg(),
+ mApi(api),
+ mContext(context),
+ mLatitude(latitude),
+ mLongitude(longitude),
+ mAccuracy(accuracy) {}
+ inline virtual void proc() const {
+ if (!mContext.hasCPIExtendedCapabilities()) {
+ mApi.injectPosition(mLatitude, mLongitude, mAccuracy);
+ }
+ }
+ };
+
+ sendMsg(new MsgInjectLocation(*mLocApi, *mContext, latitude, longitude, accuracy));
+}
+
+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));
+}
+
+void
+GnssAdapter::setUlpProxyCommand(UlpProxyBase* ulp)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgSetUlpProxy : public LocMsg {
+ GnssAdapter& mAdapter;
+ UlpProxyBase* mUlp;
+ inline MsgSetUlpProxy(GnssAdapter& adapter,
+ UlpProxyBase* ulp) :
+ LocMsg(),
+ mAdapter(adapter),
+ mUlp(ulp) {}
+ inline virtual void proc() const {
+ mAdapter.setUlpProxy(mUlp);
+ }
+ };
+
+ sendMsg(new MsgSetUlpProxy(*this, ulp));
+}
+
+void
+GnssAdapter::setUlpProxy(UlpProxyBase* ulp)
+{
+ if (ulp == mUlpProxy) {
+ //This takes care of the case when double initalization happens
+ //and we get the same object back for UlpProxyBase . Do nothing
+ return;
+ }
+
+ LOC_LOGV("%s]: %p", __func__, ulp);
+ if (NULL == ulp) {
+ LOC_LOGE("%s]: ulp pointer is NULL", __func__);
+ ulp = new UlpProxyBase();
+ }
+
+ if (LOC_POSITION_MODE_INVALID != mUlpProxy->mPosMode.mode) {
+ // need to send this mode and start msg to ULP
+ ulp->sendFixMode(mUlpProxy->mPosMode);
+ }
+
+ if (mUlpProxy->mFixSet) {
+ ulp->sendStartFix();
+ }
+
+ delete mUlpProxy;
+ mUlpProxy = ulp;
+}
+
+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 {
+ mAdapter.saveClient(mClient, mCallbacks);
+ }
+ };
+
+ sendMsg(new MsgAddClient(*this, client, callbacks));
+}
+
+void
+GnssAdapter::removeClientCommand(LocationAPI* client)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+
+ struct MsgRemoveClient : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocationAPI* mClient;
+ inline MsgRemoveClient(GnssAdapter& adapter,
+ LocationAPI* client) :
+ LocMsg(),
+ mAdapter(adapter),
+ mClient(client) {}
+ inline virtual void proc() const {
+ mAdapter.stopClientSessions(mClient);
+ mAdapter.eraseClient(mClient);
+ }
+ };
+
+ sendMsg(new MsgRemoveClient(*this, client));
+}
+
+void
+GnssAdapter::stopClientSessions(LocationAPI* client)
+{
+ LOC_LOGD("%s]: client %p", __func__, client);
+ for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end();) {
+ if (client == it->first.client) {
+ LocationError err = stopTrackingMultiplex(it->first.client, it->first.id);
+ if (LOCATION_ERROR_SUCCESS == err) {
+ it = mTrackingSessions.erase(it);
+ continue;
+ }
+ }
+ ++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) {
+ mask |= LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT;
+ }
+ if (it->second.gnssNiCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST;
+ }
+ if (it->second.gnssSvCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_SATELLITE_REPORT;
+ }
+ if (it->second.gnssNmeaCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT;
+ }
+ if (it->second.gnssMeasurementsCb != nullptr) {
+ mask |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT;
+ }
+ }
+ updateEvtMask(mask, LOC_REGISTRATION_MASK_SET);
+}
+
+void
+GnssAdapter::handleEngineUpEvent()
+{
+ struct MsgRestartSessions : public LocMsg {
+ GnssAdapter& mAdapter;
+ inline MsgRestartSessions(GnssAdapter& adapter) :
+ LocMsg(),
+ mAdapter(adapter) {}
+ virtual void proc() const {
+ mAdapter.restartSessions();
+ }
+ };
+
+ setConfigCommand();
+ sendMsg(new MsgRestartSessions(*this));
+}
+
+void
+GnssAdapter::restartSessions()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ if (mTrackingSessions.empty()) {
+ return;
+ }
+
+ // get the LocationOptions that has the smallest interval, which should be the active one
+ LocationOptions smallestIntervalOptions = {}; // size is zero until set for the first time
+ for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end(); ++it) {
+ if (0 == smallestIntervalOptions.size || //size of zero means we havent set it yet
+ it->second.minInterval < smallestIntervalOptions.minInterval) {
+ smallestIntervalOptions = it->second;
+ }
+ }
+
+ LocPosMode locPosMode = {};
+ convertOptions(locPosMode, smallestIntervalOptions);
+ mLocApi->startFix(locPosMode);
+}
+
+void
+GnssAdapter::requestCapabilitiesCommand(LocationAPI* client)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgRequestCapabilities : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ inline MsgRequestCapabilities(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client) {}
+ inline virtual void proc() const {
+ LocationCallbacks callbacks = mAdapter.getClientCallbacks(mClient);
+ if (callbacks.capabilitiesCb == nullptr) {
+ LOC_LOGE("%s]: capabilitiesCb is NULL", __func__);
+ return;
+ }
+
+ LocationCapabilitiesMask mask = {};
+ // time based tracking always supported
+ mask |= LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT;
+ if (mApi.isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING)){
+ mask |= LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT |
+ LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT;
+ }
+ if (mApi.isMessageSupported(LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING)) {
+ mask |= LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT;
+ }
+ // geofence always supported
+ mask |= LOCATION_CAPABILITIES_GEOFENCE_BIT;
+ if (mApi.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;
+ }
+
+ callbacks.capabilitiesCb(mask);
+ }
+ };
+
+ sendMsg(new MsgRequestCapabilities(*this, *mLocApi, client));
+}
+
+LocationCallbacks
+GnssAdapter::getClientCallbacks(LocationAPI* client)
+{
+ LocationCallbacks callbacks = {};
+ auto it = mClientData.find(client);
+ if (it != mClientData.end()) {
+ callbacks = it->second;
+ }
+ return callbacks;
+}
+
+void
+GnssAdapter::saveClient(LocationAPI* client, const LocationCallbacks& callbacks)
+{
+ mClientData[client] = callbacks;
+ updateClientsEventMask();
+}
+
+void
+GnssAdapter::eraseClient(LocationAPI* client)
+{
+ auto it = mClientData.find(client);
+ if (it != mClientData.end()) {
+ mClientData.erase(it);
+ }
+ updateClientsEventMask();
+}
+
+bool
+GnssAdapter::hasTrackingCallback(LocationAPI* client)
+{
+ auto it = mClientData.find(client);
+ return (it != mClientData.end() && it->second.trackingCb);
+}
+
+bool
+GnssAdapter::hasMeasurementsCallback(LocationAPI* client)
+{
+ auto it = mClientData.find(client);
+ return (it != mClientData.end() && it->second.gnssMeasurementsCb);
+}
+
+bool
+GnssAdapter::isTrackingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ return (mTrackingSessions.find(key) != mTrackingSessions.end());
+}
+
+void
+GnssAdapter::saveTrackingSession(LocationAPI* client, uint32_t sessionId,
+ const LocationOptions& options)
+{
+ LocationSessionKey key(client, sessionId);
+ mTrackingSessions[key] = options;
+}
+
+void
+GnssAdapter::eraseTrackingSession(LocationAPI* client, uint32_t sessionId)
+{
+ LocationSessionKey key(client, sessionId);
+ auto it = mTrackingSessions.find(key);
+ if (it != mTrackingSessions.end()) {
+ mTrackingSessions.erase(it);
+ }
+
+}
+
+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, LocationOptions& options)
+{
+ uint32_t sessionId = generateSessionId();
+ LOC_LOGD("%s]: client %p id %u minInterval %u mode %u",
+ __func__, client, sessionId, options.minInterval, options.mode);
+
+ struct MsgStartTracking : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocationAPI* mClient;
+ uint32_t mSessionId;
+ LocationOptions mOptions;
+ inline MsgStartTracking(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ LocationOptions options) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mOptions(options) {}
+ inline virtual void proc() const {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mAdapter.hasTrackingCallback(mClient) &&
+ !mAdapter.hasMeasurementsCallback(mClient)) {
+ err = LOCATION_ERROR_CALLBACK_MISSING;
+ } else if (0 == mOptions.size) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else {
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ err = mAdapter.startTrackingMultiplex(mOptions);
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+ }
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }
+ };
+
+ sendMsg(new MsgStartTracking(*this, *mLocApi, client, sessionId, options));
+ return sessionId;
+
+}
+
+LocationError
+GnssAdapter::startTrackingMultiplex(const LocationOptions& options)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ if (mTrackingSessions.empty()) {
+ err = startTracking(options);
+ } else {
+ // get the LocationOptions that has the smallest interval, which should be the active one
+ LocationOptions smallestIntervalOptions = {}; // size is zero until set for the first time
+ for (auto it = mTrackingSessions.begin(); it != mTrackingSessions.end(); ++it) {
+ if (0 == smallestIntervalOptions.size || //size of zero means we havent set it yet
+ it->second.minInterval < smallestIntervalOptions.minInterval) {
+ smallestIntervalOptions = it->second;
+ }
+ }
+ // if new session's minInterval is smaller than any in other sessions
+ if (options.minInterval < smallestIntervalOptions.minInterval) {
+ // restart time based tracking with new options
+ err = startTracking(options);
+ }
+ }
+
+ return err;
+}
+
+LocationError
+GnssAdapter::startTracking(const LocationOptions& options)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ LocPosMode locPosMode = {};
+ convertOptions(locPosMode, options);
+ if (!mUlpProxy->sendFixMode(locPosMode)) {
+ // do nothing
+ }
+ if (!mUlpProxy->sendStartFix()) {
+ loc_api_adapter_err apiErr = mLocApi->startFix(locPosMode);
+ if (LOC_API_ADAPTER_ERR_SUCCESS == apiErr) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ }
+
+ return err;
+}
+
+void
+GnssAdapter::setPositionModeCommand(LocPosMode& locPosMode)
+{
+ LOC_LOGD("%s]: min_interval %u mode %u",
+ __func__, locPosMode.min_interval, locPosMode.mode);
+
+ struct MsgSetPositionMode : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ LocPosMode mLocPosMode;
+ inline MsgSetPositionMode(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocPosMode& locPosMode) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mLocPosMode(locPosMode) {}
+ inline virtual void proc() const {
+ // saves the mode in adapter to be used when startTrackingCommand is called from ULP
+ mAdapter.setUlpPositionMode(mLocPosMode);
+ mApi.setPositionMode(mLocPosMode);
+ }
+ };
+
+ sendMsg(new MsgSetPositionMode(*this, *mLocApi, locPosMode));
+}
+
+void
+GnssAdapter::startTrackingCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgStartTracking : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ inline MsgStartTracking(GnssAdapter& adapter,
+ LocApiBase& api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ inline virtual void proc() const {
+ // we get this call from ULP, so just call LocApi without multiplexing because
+ // ulp would be doing the multiplexing for us if it is present
+ LocPosMode& ulpPositionMode = mAdapter.getUlpPositionMode();
+ mApi.startFix(ulpPositionMode);
+ }
+ };
+
+ sendMsg(new MsgStartTracking(*this, *mLocApi));
+}
+
+void
+GnssAdapter::updateTrackingOptionsCommand(LocationAPI* client, uint32_t id,
+ LocationOptions& 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;
+ LocationOptions mOptions;
+ inline MsgUpdateTracking(GnssAdapter& adapter,
+ LocApiBase& api,
+ LocationAPI* client,
+ uint32_t sessionId,
+ LocationOptions options) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api),
+ mClient(client),
+ mSessionId(sessionId),
+ mOptions(options) {}
+ inline virtual void proc() const {
+ if (mAdapter.isTrackingSession(mClient, mSessionId)) {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (0 == mOptions.size) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else {
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ err = mAdapter.updateTrackingMultiplex(mClient, mSessionId, mOptions);
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.saveTrackingSession(mClient, mSessionId, mOptions);
+ }
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }
+ // we do not reportResponse for the case where there is no existing tracking session
+ // for the client and id being used, since updateTrackingCommand can be sent to both
+ // GnssAdapter & FlpAdapter by LocationAPI and we want to avoid incorrect error response
+ }
+ };
+
+ sendMsg(new MsgUpdateTracking(*this, *mLocApi, client, id, options));
+}
+
+LocationError
+GnssAdapter::updateTrackingMultiplex(LocationAPI* client, uint32_t id,
+ const LocationOptions& options)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ if (1 == mTrackingSessions.size()) {
+ err = startTracking(options);
+ } else {
+ LocationSessionKey key(client, id);
+
+ // get the session we are updating
+ auto it = mTrackingSessions.find(key);
+ if (it != mTrackingSessions.end()) {
+ // find the smallest interval, other than the session we are updating
+ LocationOptions smallestIntervalOptions = {}; // size is 0 until set for the first time
+ for (auto it2 = mTrackingSessions.begin(); it2 != mTrackingSessions.end(); ++it2) {
+ // if session is not the one we are updating and either smallest interval is not set
+ // or there is a new smallest interval, then set the new smallest interval
+ if (it2->first != key && (0 == smallestIntervalOptions.size ||
+ it2->second.minInterval < smallestIntervalOptions.minInterval)) {
+ smallestIntervalOptions = it2->second;
+ }
+ }
+ // if session we are updating has smaller interval then next smallest
+ if (options.minInterval < smallestIntervalOptions.minInterval) {
+ // restart time based tracking with the newly updated interval
+ err = startTracking(options);
+ // else if the session we are updating used to be the smallest
+ } else if (it->second.minInterval < smallestIntervalOptions.minInterval) {
+ // restart time based tracking with the next smallest
+ err = startTracking(smallestIntervalOptions);
+ }
+ }
+ }
+
+ return err;
+}
+
+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 {
+ if (mAdapter.isTrackingSession(mClient, mSessionId)) {
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ // Api doesn't support multiple clients for time based tracking, so mutiplex
+ err = mAdapter.stopTrackingMultiplex(mClient, mSessionId);
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.eraseTrackingSession(mClient, mSessionId);
+ }
+ mAdapter.reportResponse(mClient, err, mSessionId);
+ }
+ // we do not reportResponse for the case where there is no existing tracking session
+ // for the client and id being used, since stopTrackingCommand can be sent to both
+ // GnssAdapter & FlpAdapter by LocationAPI and we want to avoid incorrect error response
+
+ }
+ };
+
+ sendMsg(new MsgStopTracking(*this, *mLocApi, client, id));
+}
+
+LocationError
+GnssAdapter::stopTrackingMultiplex(LocationAPI* client, uint32_t id)
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+
+ if (1 == mTrackingSessions.size()) {
+ err = stopTracking();
+ } else {
+ LocationSessionKey key(client, id);
+
+ // get the session we are stopping
+ auto it = mTrackingSessions.find(key);
+ if (it != mTrackingSessions.end()) {
+ // find the next smallest interval, other than the session we are stopping
+ LocationOptions smallestIntervalOptions = {}; // size is 0 until set for the first time
+ for (auto it2 = mTrackingSessions.begin(); it2 != mTrackingSessions.end(); ++it2) {
+ // if session is not the one we are stopping and either smallest interval is not set
+ // or there is a new smallest interval, then set the new smallest interval
+ if (it2->first != key && (0 == smallestIntervalOptions.size ||
+ it2->second.minInterval < smallestIntervalOptions.minInterval)) {
+ smallestIntervalOptions = it2->second;
+ }
+ }
+ // if session we are stopping has smaller interval then next smallest
+ if (it->second.minInterval < smallestIntervalOptions.minInterval) {
+ // restart time based tracking with next smallest interval
+ err = startTracking(smallestIntervalOptions);
+ }
+ }
+ }
+
+ return err;
+}
+
+LocationError
+GnssAdapter::stopTracking()
+{
+ LocationError err = LOCATION_ERROR_SUCCESS;
+ if (!mUlpProxy->sendStopFix()) {
+ loc_api_adapter_err apiErr = mLocApi->stopFix();
+ if (LOC_API_ADAPTER_ERR_SUCCESS == apiErr) {
+ err = LOCATION_ERROR_SUCCESS;
+ } else {
+ err = LOCATION_ERROR_GENERAL_FAILURE;
+ }
+ }
+
+ return err;
+}
+
+void
+GnssAdapter::stopTrackingCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgStopTracking : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ inline MsgStopTracking(GnssAdapter& adapter,
+ LocApiBase& api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ inline virtual void proc() const {
+ // clear the position mode
+ LocPosMode mLocPosMode = {};
+ mLocPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mAdapter.setUlpPositionMode(mLocPosMode);
+ // don't need to multiplex because ULP will do that for us if it is present
+ mApi.stopFix();
+ }
+ };
+
+ sendMsg(new MsgStopTracking(*this, *mLocApi));
+}
+
+void
+GnssAdapter::getZppCommand()
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgGetZpp : public LocMsg {
+ GnssAdapter& mAdapter;
+ LocApiBase& mApi;
+ inline MsgGetZpp(GnssAdapter& adapter,
+ LocApiBase& api) :
+ LocMsg(),
+ mAdapter(adapter),
+ mApi(api) {}
+ inline virtual void proc() const {
+ UlpLocation location = {};
+ LocPosTechMask techMask = LOC_POS_TECH_MASK_DEFAULT;
+ GpsLocationExtended locationExtended = {};
+ locationExtended.size = sizeof(locationExtended);
+
+ mApi.getBestAvailableZppFix(location.gpsLocation, techMask);
+ //Mark the location source as from ZPP
+ location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO;
+ location.position_source = ULP_LOCATION_IS_FROM_ZPP;
+
+ mAdapter.getUlpProxy()->reportPosition(location,
+ locationExtended,
+ LOC_SESS_SUCCESS,
+ techMask);
+ }
+ };
+
+ sendMsg(new MsgGetZpp(*this, *mLocApi));
+}
+
+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 {
+ LocApiBase& mApi;
+ const GnssNiResponse mResponse;
+ const void* mPayload;
+ inline MsgGnssNiResponse(LocApiBase& api,
+ const GnssNiResponse response,
+ const void* rawRequest) :
+ LocMsg(),
+ mApi(api),
+ mResponse(response),
+ mPayload(rawRequest) {}
+ inline virtual ~MsgGnssNiResponse() {
+ // this is a bit weird since mPayload is not
+ // allocated by this class. But there is no better way.
+ // mPayload actually won't be NULL here.
+ free((void*)mPayload);
+ }
+ inline virtual void proc() const {
+ mApi.informNiResponse(mResponse, mPayload);
+ }
+ };
+
+ sendMsg(new MsgGnssNiResponse(*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 powerVoteId = mAdapter.getPowerVoteId();
+ if (mTechType != LOCATION_TECHNOLOGY_TYPE_GNSS) {
+ err = LOCATION_ERROR_INVALID_PARAMETER;
+ } else if (powerVoteId > 0) {
+ err = LOCATION_ERROR_ALREADY_STARTED;
+ } else {
+ mContext.modemPowerVote(true);
+ mAdapter.setPowerVoteId(mSessionId);
+ mApi.setGpsLock(GNSS_CONFIG_GPS_LOCK_NONE);
+ }
+ 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 powerVoteId = mAdapter.getPowerVoteId();
+ if (powerVoteId != mSessionId) {
+ err = LOCATION_ERROR_ID_UNKNOWN;
+ } else {
+ mContext.modemPowerVote(false);
+ mAdapter.setPowerVoteId(0);
+ mApi.setGpsLock(mAdapter.convertGpsLock(ContextBase::mGps_conf.GPS_LOCK));
+ }
+ 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,
+ bool fromUlp)
+{
+ LOC_LOGD("%s]: fromUlp %u status %u", __func__, fromUlp, status);
+
+ // if this event is not called from ULP, then try to call into ULP and return if successfull
+ if (!fromUlp) {
+ if (mUlpProxy->reportPosition(ulpLocation, locationExtended,
+ status, techMask)) {
+ return;
+ }
+ }
+
+ struct MsgReportPosition : public LocMsg {
+ GnssAdapter& mAdapter;
+ const UlpLocation mUlpLocation;
+ const GpsLocationExtended mLocationExtended;
+ loc_sess_status mStatus;
+ LocPosTechMask mTechMask;
+ inline MsgReportPosition(GnssAdapter& adapter,
+ const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ loc_sess_status status,
+ LocPosTechMask techMask) :
+ LocMsg(),
+ mAdapter(adapter),
+ mUlpLocation(ulpLocation),
+ mLocationExtended(locationExtended),
+ mStatus(status),
+ mTechMask(techMask) {}
+ inline virtual void proc() const {
+ // extract bug report info - this returns true if consumed by systemstatus
+ SystemStatus* s = LocDualContext::getSystemStatus();
+ if ((nullptr != s) && (LOC_SESS_SUCCESS == mStatus)){
+ s->eventPosition(mUlpLocation, mLocationExtended);
+ }
+ mAdapter.reportPosition(mUlpLocation, mLocationExtended, mStatus, mTechMask);
+ }
+ };
+
+ sendMsg(new MsgReportPosition(*this, ulpLocation, locationExtended, status, techMask));
+}
+
+void
+GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask)
+{
+ bool reported = false;
+ // what's in the if is... (line by line)
+ // 1. this is a final fix; and
+ // 1.1 it is a Satellite fix; or
+ // 1.2 it is a sensor fix
+ // 2. (must be intermediate fix... implicit)
+ // 2.1 we accepte intermediate; and
+ // 2.2 it is NOT the case that
+ // 2.2.1 there is inaccuracy; and
+ // 2.2.2 we care about inaccuracy; and
+ // 2.2.3 the inaccuracy exceeds our tolerance
+ if ((LOC_SESS_SUCCESS == status &&
+ ((LOC_POS_TECH_MASK_SATELLITE |
+ LOC_POS_TECH_MASK_SENSORS |
+ LOC_POS_TECH_MASK_HYBRID) &
+ techMask)) ||
+ (LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS &&
+ !((ulpLocation.gpsLocation.flags &
+ LOC_GPS_LOCATION_HAS_ACCURACY) &&
+ (ContextBase::mGps_conf.ACCURACY_THRES != 0) &&
+ (ulpLocation.gpsLocation.accuracy >
+ ContextBase::mGps_conf.ACCURACY_THRES)))) {
+ if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA) {
+ mGnssSvIdUsedInPosAvail = true;
+ mGnssSvIdUsedInPosition = locationExtended.gnss_sv_used_ids;
+ }
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.trackingCb) {
+ Location location = {};
+ convertLocation(location, ulpLocation.gpsLocation, locationExtended, techMask);
+ it->second.trackingCb(location);
+ }
+ if (nullptr != it->second.gnssLocationInfoCb) {
+ GnssLocationInfoNotification locationInfo = {};
+ convertLocationInfo(locationInfo, locationExtended);
+ it->second.gnssLocationInfoCb(locationInfo);
+ }
+ }
+ reported = true;
+ } else {
+ LOC_LOGI("%s: not reported. Status: %d, techMask: %d, flags %d, accuracy %f",
+ __func__, (int)status, (int)techMask, (int)ulpLocation.gpsLocation.flags,
+ (float)ulpLocation.gpsLocation.accuracy);
+ }
+
+ if (NMEA_PROVIDER_AP == ContextBase::mGps_conf.NMEA_PROVIDER && !mTrackingSessions.empty()) {
+ uint8_t generate_nmea = (reported && status != LOC_SESS_FAILURE);
+ std::vector<std::string> nmeaArraystr;
+ loc_nmea_generate_pos(ulpLocation, locationExtended, generate_nmea, nmeaArraystr);
+ for (auto sentence : nmeaArraystr) {
+ reportNmea(sentence.c_str(), sentence.length());
+ }
+ }
+
+ // Free the allocated memory for rawData
+ UlpLocation* gp = (UlpLocation*)&(ulpLocation);
+ if (gp != NULL && gp->rawData != NULL)
+ {
+ delete (char*)gp->rawData;
+ gp->rawData = NULL;
+ gp->rawDataSize = 0;
+ }
+}
+
+void
+GnssAdapter::reportSvEvent(const GnssSvNotification& svNotify,
+ bool fromUlp)
+{
+ LOC_LOGD("%s]: fromUlp %u", __func__, fromUlp);
+
+ // if this event is not called from ULP, then try to call into ULP and return if successfull
+ if (!fromUlp) {
+ if (mUlpProxy->reportSv(svNotify)) {
+ 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;
+ int16_t gnssSvId = 0;
+ uint64_t svUsedIdMask = 0;
+ for (int i=0; i < numSv; i++) {
+ svUsedIdMask = 0;
+ gnssSvId = svNotify.gnssSvs[i].svId;
+ switch (svNotify.gnssSvs[i].type) {
+ case GNSS_SV_TYPE_GPS:
+ if (mGnssSvIdUsedInPosAvail) {
+ svUsedIdMask = mGnssSvIdUsedInPosition.gps_sv_used_ids_mask;
+ }
+ break;
+ case GNSS_SV_TYPE_GLONASS:
+ if (mGnssSvIdUsedInPosAvail) {
+ svUsedIdMask = mGnssSvIdUsedInPosition.glo_sv_used_ids_mask;
+ }
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ if (mGnssSvIdUsedInPosAvail) {
+ svUsedIdMask = mGnssSvIdUsedInPosition.bds_sv_used_ids_mask;
+ }
+ break;
+ case GNSS_SV_TYPE_GALILEO:
+ if (mGnssSvIdUsedInPosAvail) {
+ svUsedIdMask = mGnssSvIdUsedInPosition.gal_sv_used_ids_mask;
+ }
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ if (mGnssSvIdUsedInPosAvail) {
+ svUsedIdMask = mGnssSvIdUsedInPosition.qzss_sv_used_ids_mask;
+ }
+ // QZSS SV id's need to reported as it is to framework, since
+ // framework expects it as it is. See GnssStatus.java.
+ // SV id passed to here by LocApi is 1-based.
+ svNotify.gnssSvs[i].svId += (QZSS_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 (svUsedIdMask & (1 << (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 && !mTrackingSessions.empty()) {
+ std::vector<std::string> nmeaArraystr;
+ loc_nmea_generate_sv(svNotify, nmeaArraystr);
+ for (auto sentence : nmeaArraystr) {
+ reportNmea(sentence.c_str(), sentence.length());
+ }
+ }
+
+ mGnssSvIdUsedInPosAvail = false;
+}
+
+void
+GnssAdapter::reportNmeaEvent(const char* nmea, size_t length, bool fromUlp)
+{
+ // if this event is not called from ULP, then try to call into ULP and return if successfull
+ if (!fromUlp && !loc_nmea_is_debug(nmea, length)) {
+ if (mUlpProxy->reportNmea(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) {
+ 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 = LocDualContext::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);
+ }
+ }
+}
+
+bool
+GnssAdapter::requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data)
+{
+ 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;
+ const GnssNiNotification mNotify;
+ const void* mData;
+ inline MsgReportNiNotify(GnssAdapter& adapter,
+ const GnssNiNotification& notify,
+ const void* data) :
+ LocMsg(),
+ mAdapter(adapter),
+ mNotify(notify),
+ mData(data) {}
+ inline virtual void proc() const {
+ mAdapter.requestNiNotify(mNotify, mData);
+ }
+ };
+
+ sendMsg(new MsgReportNiNotify(*this, notify, data));
+
+ return true;
+}
+
+static void* niThreadProc(void *args)
+{
+ NiSession* pSession = (NiSession*)args;
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ pthread_mutex_lock(&pSession->tLock);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ 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)
+{
+ 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) {
+ 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::reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ struct MsgReportGnssMeasurementData : public LocMsg {
+ GnssAdapter& mAdapter;
+ const GnssMeasurementsNotification mMeasurementsNotify;
+ inline MsgReportGnssMeasurementData(GnssAdapter& adapter,
+ const GnssMeasurementsNotification& measurementsNotify) :
+ LocMsg(),
+ mAdapter(adapter),
+ mMeasurementsNotify(measurementsNotify) {}
+ inline virtual void proc() const {
+ mAdapter.reportGnssMeasurementData(mMeasurementsNotify);
+ }
+ };
+
+ sendMsg(new MsgReportGnssMeasurementData(*this, measurementsNotify));
+}
+
+void
+GnssAdapter::reportGnssMeasurementData(const GnssMeasurementsNotification& measurementsNotify)
+{
+ for (auto it=mClientData.begin(); it != mClientData.end(); ++it) {
+ if (nullptr != it->second.gnssMeasurementsCb) {
+ it->second.gnssMeasurementsCb(measurementsNotify);
+ }
+ }
+}
+
+void
+GnssAdapter::reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary.
+ mUlpProxy->reportSvMeasurement(svMeasurementSet);
+}
+
+void
+GnssAdapter::reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial)
+{
+ LOC_LOGD("%s]: ", __func__);
+
+ // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary.
+ mUlpProxy->reportSvPolynomial(svPolynomial);
+}
+
+/* INIT LOC AGPS MANAGER */
+void GnssAdapter::initAgpsCommand(void* statusV4Cb){
+
+ LOC_LOGI("GnssAdapter::initAgpsCommand");
+
+ /* Set ATL open/close callbacks */
+ AgpsAtlOpenStatusCb atlOpenStatusCb =
+ [this](int handle, int isSuccess, char* apn,
+ AGpsBearerType bearerType, AGpsExtType agpsType) {
+
+ mLocApi->atlOpenStatus(
+ handle, isSuccess, apn, bearerType, agpsType);
+ };
+ AgpsAtlCloseStatusCb atlCloseStatusCb =
+ [this](int handle, int isSuccess) {
+
+ mLocApi->atlCloseStatus(handle, isSuccess);
+ };
+
+ /* Register DS Client APIs */
+ AgpsDSClientInitFn dsClientInitFn =
+ [this](bool isDueToSSR) {
+
+ return mLocApi->initDataServiceClient(isDueToSSR);
+ };
+
+ AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn =
+ [this] {
+
+ return mLocApi->openAndStartDataCall();
+ };
+
+ AgpsDSClientStopDataCallFn dsClientStopDataCallFn =
+ [this] {
+
+ mLocApi->stopDataCall();
+ };
+
+ AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn =
+ [this] {
+
+ mLocApi->closeDataCall();
+ };
+
+ AgpsDSClientReleaseFn dsClientReleaseFn =
+ [this] {
+
+ mLocApi->releaseDataServiceClient();
+ };
+
+ /* Send Msg function */
+ SendMsgToAdapterMsgQueueFn sendMsgFn =
+ [this](LocMsg* msg) {
+
+ sendMsg(msg);
+ };
+
+ /* Message to initialize AGPS module */
+ struct AgpsMsgInit: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+
+ AgpsFrameworkInterface::AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
+
+ AgpsAtlOpenStatusCb mAtlOpenStatusCb;
+ AgpsAtlCloseStatusCb mAtlCloseStatusCb;
+
+ AgpsDSClientInitFn mDSClientInitFn;
+ AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn;
+ AgpsDSClientStopDataCallFn mDSClientStopDataCallFn;
+ AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn;
+ AgpsDSClientReleaseFn mDSClientReleaseFn;
+
+ SendMsgToAdapterMsgQueueFn mSendMsgFn;
+ GnssAdapter& mAdapter;
+
+ inline AgpsMsgInit(AgpsManager* agpsManager,
+ AgpsFrameworkInterface::AgnssStatusIpV4Cb frameworkStatusV4Cb,
+ AgpsAtlOpenStatusCb atlOpenStatusCb,
+ AgpsAtlCloseStatusCb atlCloseStatusCb,
+ AgpsDSClientInitFn dsClientInitFn,
+ AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
+ AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
+ AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
+ AgpsDSClientReleaseFn dsClientReleaseFn,
+ SendMsgToAdapterMsgQueueFn sendMsgFn,
+ GnssAdapter& adapter) :
+ LocMsg(), mAgpsManager(agpsManager), mFrameworkStatusV4Cb(
+ frameworkStatusV4Cb), mAtlOpenStatusCb(atlOpenStatusCb), mAtlCloseStatusCb(
+ atlCloseStatusCb), mDSClientInitFn(dsClientInitFn), mDSClientOpenAndStartDataCallFn(
+ dsClientOpenAndStartDataCallFn), mDSClientStopDataCallFn(
+ dsClientStopDataCallFn), mDSClientCloseDataCallFn(
+ dsClientCloseDataCallFn), mDSClientReleaseFn(
+ dsClientReleaseFn), mSendMsgFn(sendMsgFn),
+ mAdapter(adapter) {
+
+ LOC_LOGV("AgpsMsgInit");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgInit::proc()");
+
+ mAgpsManager->registerCallbacks(mFrameworkStatusV4Cb, mAtlOpenStatusCb,
+ mAtlCloseStatusCb, mDSClientInitFn,
+ mDSClientOpenAndStartDataCallFn, mDSClientStopDataCallFn,
+ mDSClientCloseDataCallFn, mDSClientReleaseFn, mSendMsgFn);
+
+ mAgpsManager->createAgpsStateMachines();
+
+ /* Register for AGPS event mask */
+ mAdapter.updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST,
+ LOC_REGISTRATION_MASK_ENABLED);
+ }
+ };
+
+ /* Send message to initialize AGPS Manager */
+ sendMsg(new AgpsMsgInit(
+ &mAgpsManager,
+ (AgpsFrameworkInterface::AgnssStatusIpV4Cb)statusV4Cb,
+ atlOpenStatusCb, atlCloseStatusCb,
+ dsClientInitFn, dsClientOpenAndStartDataCallFn,
+ dsClientStopDataCallFn, dsClientCloseDataCallFn,
+ dsClientReleaseFn,
+ sendMsgFn,
+ *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 */
+bool GnssAdapter::requestATL(int connHandle, LocAGpsType agpsType){
+
+ LOC_LOGI("GnssAdapter::requestATL");
+
+ sendMsg( new AgpsMsgRequestATL(
+ &mAgpsManager, connHandle, (AGpsExtType)agpsType));
+
+ return true;
+}
+
+/* GnssAdapter::requestSuplES
+ * 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_AGNSS_EMERGENCY_V02 */
+bool GnssAdapter::requestSuplES(int connHandle){
+
+ LOC_LOGI("GnssAdapter::requestSuplES");
+
+ sendMsg( new AgpsMsgRequestATL(
+ &mAgpsManager, connHandle, LOC_AGPS_TYPE_SUPL_ES));
+
+ 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;
+}
+
+/* GnssAdapter::reportDataCallOpened
+ * DS Client data call opened successfully.
+ * Send message to AGPS Manager to handle. */
+bool GnssAdapter::reportDataCallOpened(){
+
+ LOC_LOGI("GnssAdapter::reportDataCallOpened");
+
+ struct AgpsMsgSuplEsOpened: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+
+ inline AgpsMsgSuplEsOpened(AgpsManager* agpsManager) :
+ LocMsg(), mAgpsManager(agpsManager) {
+
+ LOC_LOGV("AgpsMsgSuplEsOpened");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgSuplEsOpened::proc()");
+ mAgpsManager->reportDataCallOpened();
+ }
+ };
+
+ sendMsg( new AgpsMsgSuplEsOpened(&mAgpsManager));
+
+ return true;
+}
+
+/* GnssAdapter::reportDataCallClosed
+ * DS Client data call closed.
+ * Send message to AGPS Manager to handle. */
+bool GnssAdapter::reportDataCallClosed(){
+
+ LOC_LOGI("GnssAdapter::reportDataCallClosed");
+
+ struct AgpsMsgSuplEsClosed: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+
+ inline AgpsMsgSuplEsClosed(AgpsManager* agpsManager) :
+ LocMsg(), mAgpsManager(agpsManager) {
+
+ LOC_LOGV("AgpsMsgSuplEsClosed");
+ }
+
+ inline virtual void proc() const {
+
+ LOC_LOGV("AgpsMsgSuplEsClosed::proc()");
+ mAgpsManager->reportDataCallClosed();
+ }
+ };
+
+ sendMsg( new AgpsMsgSuplEsClosed(&mAgpsManager));
+
+ return true;
+}
+
+void GnssAdapter::dataConnOpenCommand(
+ AGpsExtType agpsType,
+ const char* apnName, int apnLen, LocApnIpType ipType){
+
+ LOC_LOGI("GnssAdapter::frameworkDataConnOpen");
+
+ struct AgpsMsgAtlOpenSuccess: public LocMsg {
+
+ AgpsManager* mAgpsManager;
+ AGpsExtType mAgpsType;
+ char* mApnName;
+ int mApnLen;
+ LocApnIpType mIpType;
+
+ inline AgpsMsgAtlOpenSuccess(AgpsManager* agpsManager, AGpsExtType agpsType,
+ const char* apnName, int apnLen, LocApnIpType ipType) :
+ LocMsg(), mAgpsManager(agpsManager), mAgpsType(agpsType), mApnName(
+ new char[apnLen + 1]), mApnLen(apnLen), mIpType(ipType) {
+
+ LOC_LOGV("AgpsMsgAtlOpenSuccess");
+ 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,
+ mIpType);
+ }
+ };
+
+ sendMsg( new AgpsMsgAtlOpenSuccess(
+ &mAgpsManager, (AGpsExtType)agpsType, apnName, apnLen, ipType));
+}
+
+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;
+ default:
+ return;
+ }
+
+ // extract each sv info from systemstatus report
+ for(uint32_t i=0; i<svid_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 = LocDualContext::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);
+ r.mLocation.mLocation.longitude =
+ (double)(reports.mBestPosition.back().mBestLon);
+ r.mLocation.mLocation.altitude =
+ reports.mBestPosition.back().mBestAlt;
+
+ r.mLocation.mLocation.timestamp =
+ reports.mBestPosition.back().mUtcReported.tv_sec * 1000ULL +
+ reports.mBestPosition.back().mUtcReported.tv_nsec / 1000000ULL;
+ }
+ 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);
+
+ r.mTime.timeUncertaintyNs =
+ (float)((reports.mTimeAndClock.back().mTimeUnc +
+ reports.mTimeAndClock.back().mLeapSecUnc)*1000);
+ r.mTime.frequencyUncertaintyNsPerSec =
+ (float)(reports.mTimeAndClock.back().mClockFreqBiasUnc);
+ LOC_LOGV("getDebugReport - timeestimate=%ld 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);
+ LOC_LOGV("getDebugReport - satellite=%lu", r.mSatelliteInfo.size());
+
+ return true;
+}
\ No newline at end of file
diff --git a/msm8998/gnss/GnssAdapter.h b/msm8998/gnss/GnssAdapter.h
new file mode 100644
index 0000000..d857558
--- /dev/null
+++ b/msm8998/gnss/GnssAdapter.h
@@ -0,0 +1,262 @@
+/* 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 GNSS_ADAPTER_H
+#define GNSS_ADAPTER_H
+
+#include <LocAdapterBase.h>
+#include <LocDualContext.h>
+#include <UlpProxyBase.h>
+#include <LocationAPI.h>
+#include <Agps.h>
+#include <SystemStatus.h>
+
+#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
+
+class GnssAdapter;
+
+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;
+
+using namespace loc_core;
+
+class GnssAdapter : public LocAdapterBase {
+ /* ==== ULP ============================================================================ */
+ UlpProxyBase* mUlpProxy;
+
+ /* ==== CLIENT ========================================================================= */
+ typedef std::map<LocationAPI*, LocationCallbacks> ClientDataMap;
+ ClientDataMap mClientData;
+
+ /* ==== TRACKING ======================================================================= */
+ LocationSessionMap mTrackingSessions;
+ LocPosMode mUlpPositionMode;
+ GnssSvUsedInPosition mGnssSvIdUsedInPosition;
+ bool mGnssSvIdUsedInPosAvail;
+
+ /* ==== CONTROL ======================================================================== */
+ LocationControlCallbacks mControlCallbacks;
+ uint32_t mPowerVoteId;
+
+ /* ==== NI ============================================================================= */
+ NiData mNiData;
+
+ /* ==== AGPS ========================================================*/
+ // This must be initialized via initAgps()
+ AgpsManager mAgpsManager;
+
+ /*==== CONVERSION ===================================================================*/
+ static void convertOptions(LocPosMode& out, const LocationOptions& options);
+ static void convertLocation(Location& out, const LocGpsLocation& locGpsLocation,
+ const GpsLocationExtended& locationExtended,
+ const LocPosTechMask techMask);
+ static void convertLocationInfo(GnssLocationInfoNotification& out,
+ const GpsLocationExtended& locationExtended);
+
+public:
+
+ GnssAdapter();
+ virtual ~GnssAdapter();
+
+ /* ==== SSR ============================================================================ */
+ /* ======== EVENTS ====(Called from QMI Thread)========================================= */
+ virtual void handleEngineUpEvent();
+ /* ======== UTILITIES ================================================================== */
+ void restartSessions();
+
+ /* ==== ULP ============================================================================ */
+ /* ======== COMMANDS ====(Called from ULP Thread)==================================== */
+ virtual void setUlpProxyCommand(UlpProxyBase* ulp);
+ /* ======== UTILITIES ================================================================== */
+ void setUlpProxy(UlpProxyBase* ulp);
+ inline UlpProxyBase* getUlpProxy() { return mUlpProxy; }
+
+ /* ==== CLIENT ========================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ void addClientCommand(LocationAPI* client, const LocationCallbacks& callbacks);
+ void removeClientCommand(LocationAPI* client);
+ void requestCapabilitiesCommand(LocationAPI* client);
+ /* ======== UTILITIES ================================================================== */
+ void saveClient(LocationAPI* client, const LocationCallbacks& callbacks);
+ void eraseClient(LocationAPI* client);
+ void updateClientsEventMask();
+ void stopClientSessions(LocationAPI* client);
+ LocationCallbacks getClientCallbacks(LocationAPI* client);
+
+ /* ==== TRACKING ======================================================================= */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ uint32_t startTrackingCommand(LocationAPI* client, LocationOptions& options);
+ void updateTrackingOptionsCommand(LocationAPI* client, uint32_t id, LocationOptions& options);
+ void stopTrackingCommand(LocationAPI* client, uint32_t id);
+ /* ======================(Called from ULP Thread)======================================= */
+ virtual void setPositionModeCommand(LocPosMode& locPosMode);
+ virtual void startTrackingCommand();
+ virtual void stopTrackingCommand();
+ virtual void getZppCommand();
+ /* ======== RESPONSES ================================================================== */
+ void reportResponse(LocationAPI* client, LocationError err, uint32_t sessionId);
+ /* ======== UTILITIES ================================================================== */
+ bool hasTrackingCallback(LocationAPI* client);
+ bool hasMeasurementsCallback(LocationAPI* client);
+ bool isTrackingSession(LocationAPI* client, uint32_t sessionId);
+ void saveTrackingSession(LocationAPI* client, uint32_t sessionId,
+ const LocationOptions& options);
+ void eraseTrackingSession(LocationAPI* client, uint32_t sessionId);
+ void setUlpPositionMode(const LocPosMode& mode) { mUlpPositionMode = mode; }
+ LocPosMode& getUlpPositionMode() { return mUlpPositionMode; }
+ LocationError startTrackingMultiplex(const LocationOptions& options);
+ LocationError startTracking(const LocationOptions& options);
+ LocationError stopTrackingMultiplex(LocationAPI* client, uint32_t id);
+ LocationError stopTracking();
+ LocationError updateTrackingMultiplex(LocationAPI* client, uint32_t id,
+ const LocationOptions& options);
+
+ /* ==== 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 ======================================================================== */
+ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
+ uint32_t enableCommand(LocationTechnologyType techType);
+ void disableCommand(uint32_t id);
+ void setControlCallbacksCommand(LocationControlCallbacks& controlCallbacks);
+ void readConfigCommand();
+ void setConfigCommand();
+ uint32_t* gnssUpdateConfigCommand(GnssConfig config);
+ uint32_t gnssDeleteAidingDataCommand(GnssAidingData& data);
+
+ void initAgpsCommand(void* statusV4Cb);
+ void dataConnOpenCommand(
+ AGpsExtType agpsType,
+ const char* apnName, int apnLen, LocApnIpType ipType);
+ void dataConnClosedCommand(AGpsExtType agpsType);
+ void dataConnFailedCommand(AGpsExtType agpsType);
+
+ /* ======== 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 setPowerVoteId(uint32_t id) { mPowerVoteId = id; }
+ uint32_t getPowerVoteId() { return mPowerVoteId; }
+ bool resolveInAddress(const char* hostAddress, struct in_addr* inAddress);
+
+ /* ==== REPORTS ======================================================================== */
+ /* ======== EVENTS ====(Called from QMI/ULP Thread)===================================== */
+ virtual void reportPositionEvent(const UlpLocation& ulpLocation,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask,
+ bool fromUlp=false);
+ virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
+ virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
+ virtual bool requestNiNotifyEvent(const GnssNiNotification& notify, const void* data);
+ virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurementsNotify);
+ virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
+ virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
+
+ virtual bool requestATL(int connHandle, LocAGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+
+ /* ======== UTILITIES ================================================================= */
+ void reportPosition(const UlpLocation &ulpLocation,
+ const GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask techMask);
+ void reportSv(GnssSvNotification& svNotify);
+ void reportNmea(const char* nmea, size_t length);
+ bool requestNiNotify(const GnssNiNotification& notify, const void* data);
+ void reportGnssMeasurementData(const GnssMeasurementsNotification& measurementsNotify);
+
+ /*======== GNSSDEBUG ================================================================*/
+ bool getDebugReport(GnssDebugReport& report);
+
+ /*==== CONVERSION ===================================================================*/
+ static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock);
+ static GnssConfigGpsLock convertGpsLock(const uint32_t gpsLock);
+ static uint32_t convertSuplVersion(const GnssConfigSuplVersion suplVersion);
+ static GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
+ static uint32_t convertLppProfile(const GnssConfigLppProfile lppProfile);
+ static GnssConfigLppProfile convertLppProfile(const uint32_t lppProfile);
+ static uint32_t convertEP4ES(const GnssConfigEmergencyPdnForEmergencySupl);
+ static uint32_t convertSuplEs(const GnssConfigSuplEmergencyServices suplEmergencyServices);
+ static uint32_t convertLppeCp(const GnssConfigLppeControlPlaneMask lppeControlPlaneMask);
+ static GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
+ static uint32_t convertLppeUp(const GnssConfigLppeUserPlaneMask lppeUserPlaneMask);
+ static GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t 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);
+ void injectLocationCommand(double latitude, double longitude, float accuracy);
+ void injectTimeCommand(int64_t time, int64_t timeReference, int32_t uncertainty);
+
+};
+
+#endif //GNSS_ADAPTER_H
diff --git a/msm8998/gnss/location_gnss.cpp b/msm8998/gnss/location_gnss.cpp
new file mode 100644
index 0000000..0f905fd
--- /dev/null
+++ b/msm8998/gnss/location_gnss.cpp
@@ -0,0 +1,250 @@
+/* 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.
+ *
+ */
+
+#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);
+static void requestCapabilities(LocationAPI* client);
+
+static uint32_t startTracking(LocationAPI* client, LocationOptions& options);
+static void updateTrackingOptions(LocationAPI* client, uint32_t id, LocationOptions& options);
+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 setControlCallbacks(LocationControlCallbacks& controlCallbacks);
+static uint32_t enable(LocationTechnologyType techType);
+static void disable(uint32_t id);
+static uint32_t* gnssUpdateConfig(GnssConfig config);
+
+static void injectLocation(double latitude, double longitude, float accuracy);
+static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty);
+
+static void agpsInit(void* statusV4Cb);
+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 const GnssInterface gGnssInterface = {
+ sizeof(GnssInterface),
+ initialize,
+ deinitialize,
+ addClient,
+ removeClient,
+ requestCapabilities,
+ startTracking,
+ updateTrackingOptions,
+ stopTracking,
+ gnssNiResponse,
+ setControlCallbacks,
+ enable,
+ disable,
+ gnssUpdateConfig,
+ gnssDeleteAidingData,
+ injectLocation,
+ injectTime,
+ agpsInit,
+ agpsDataConnOpen,
+ agpsDataConnClosed,
+ agpsDataConnFailed,
+ getDebugReport,
+};
+
+#ifndef DEBUG_X86
+extern "C" const GnssInterface* getGnssInterface()
+#else
+const GnssInterface* getGnssInterface()
+#endif // DEBUG_X86
+{
+ 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)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->removeClientCommand(client);
+ }
+}
+
+static void requestCapabilities(LocationAPI* client)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->requestCapabilitiesCommand(client);
+ }
+}
+
+static uint32_t startTracking(LocationAPI* client, LocationOptions& options)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->startTrackingCommand(client, options);
+ } else {
+ return 0;
+ }
+}
+
+static void updateTrackingOptions(LocationAPI* client, uint32_t id, LocationOptions& options)
+{
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->updateTrackingOptionsCommand(client, id, options);
+ }
+}
+
+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) {
+ return 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) {
+ return gGnssAdapter->disableCommand(id);
+ }
+}
+
+static uint32_t* gnssUpdateConfig(GnssConfig config)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssUpdateConfigCommand(config);
+ } else {
+ return NULL;
+ }
+}
+
+static uint32_t gnssDeleteAidingData(GnssAidingData& data)
+{
+ if (NULL != gGnssAdapter) {
+ return gGnssAdapter->gnssDeleteAidingDataCommand(data);
+ } else {
+ return 0;
+ }
+}
+
+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(void* statusV4Cb) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->initAgpsCommand(statusV4Cb);
+ }
+}
+static void agpsDataConnOpen(
+ AGpsExtType agpsType, const char* apnName, int apnLen, int ipType) {
+
+ if (NULL != gGnssAdapter) {
+ gGnssAdapter->dataConnOpenCommand(
+ agpsType, apnName, apnLen, 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);
+ }
+}
diff --git a/msm8998/loc-hal.pc.in b/msm8998/loc-hal.pc.in
new file mode 100644
index 0000000..c6ece74
--- /dev/null
+++ b/msm8998/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} -lloc_core -lloc_eng_so -lloc_ds_api -lloc_api_v02
+Cflags: -I${includedir} -I${includedir}/loc-hal/utils -I${includedir}/loc-hal/core -I${includedir}/loc-hal
diff --git a/msm8998/location/Android.mk b/msm8998/location/Android.mk
new file mode 100644
index 0000000..b414338
--- /dev/null
+++ b/msm8998/location/Android.mk
@@ -0,0 +1,41 @@
+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_VENDOR_MODULE := true
+LOCAL_MODULE_OWNER := qti
+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_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/gps.utils
+
+LOCAL_COPY_HEADERS_TO:= liblocation_api/
+LOCAL_COPY_HEADERS:= \
+ LocationAPI.h \
+ LocationAPIClientBase.h \
+ location_interface.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8998/location/LocationAPI.cpp b/msm8998/location/LocationAPI.cpp
new file mode 100644
index 0000000..ed3cc6b
--- /dev/null
+++ b/msm8998/location/LocationAPI.cpp
@@ -0,0 +1,642 @@
+/* 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_LocationAPI"
+
+#include <location_interface.h>
+#include <dlfcn.h>
+#include <log_util.h>
+#include <pthread.h>
+#include <map>
+
+typedef void* (getLocationInterface)();
+typedef std::map<LocationAPI*, LocationCallbacks> LocationClientMap;
+typedef struct {
+ LocationClientMap clientData;
+ LocationControlAPI* controlAPI;
+ LocationControlCallbacks controlCallbacks;
+ GnssInterface* gnssInterface;
+ GeofenceInterface* geofenceInterface;
+ FlpInterface* flpInterface;
+} LocationAPIData;
+static LocationAPIData gData = {};
+static pthread_mutex_t gDataMutex = PTHREAD_MUTEX_INITIALIZER;
+static bool gGnssLoadFailed = false;
+static bool gFlpLoadFailed = false;
+static bool gGeofenceLoadFailed = false;
+
+static bool needsGnssTrackingInfo(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.gnssLocationInfoCb != nullptr ||
+ locationCallbacks.gnssSvCb != nullptr ||
+ locationCallbacks.gnssNmeaCb != nullptr ||
+ locationCallbacks.gnssMeasurementsCb != nullptr);
+}
+
+static bool isGnssClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.gnssNiCb != nullptr ||
+ locationCallbacks.trackingCb != nullptr ||
+ locationCallbacks.gnssMeasurementsCb != nullptr);
+}
+
+static bool isFlpClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.trackingCb != nullptr ||
+ locationCallbacks.batchingCb != nullptr);
+}
+
+static bool isGeofenceClient(LocationCallbacks& locationCallbacks)
+{
+ return (locationCallbacks.geofenceBreachCb != nullptr ||
+ locationCallbacks.geofenceStatusCb != nullptr);
+}
+
+static void* loadLocationInterface(const char* library, const char* name) {
+ LOC_LOGD("%s]: loading %s::%s ...", __func__, library, name);
+ if (NULL == library || NULL == name) {
+ return NULL;
+ }
+ getLocationInterface* getter = NULL;
+ const char *error = NULL;
+ dlerror();
+ void *handle = dlopen(library, RTLD_NOW);
+ if (NULL == handle || (error = dlerror()) != NULL) {
+ LOC_LOGW("dlopen for %s failed, error = %s", library, error);
+ } else {
+ getter = (getLocationInterface*)dlsym(handle, name);
+ if ((error = dlerror()) != NULL) {
+ LOC_LOGW("dlsym for %s::%s failed, error = %s", library, name, error);
+ getter = NULL;
+ }
+ }
+
+ if (NULL == getter) {
+ return (void*)getter;
+ } else {
+ return (*getter)();
+ }
+}
+
+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("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 (isFlpClient(locationCallbacks)) {
+ if (NULL == gData.flpInterface && !gFlpLoadFailed) {
+ gData.flpInterface =
+ (FlpInterface*)loadLocationInterface("libflp.so", "getFlpInterface");
+ if (NULL == gData.flpInterface) {
+ gFlpLoadFailed = true;
+ LOC_LOGW("%s:%d]: No flp interface available", __func__, __LINE__);
+ } else {
+ gData.flpInterface->initialize();
+ }
+ }
+ if (NULL != gData.flpInterface) {
+ gData.flpInterface->addClient(newLocationAPI, locationCallbacks);
+ if (!requestedCapabilities) {
+ gData.flpInterface->requestCapabilities(newLocationAPI);
+ requestedCapabilities = true;
+ }
+ }
+ }
+
+ if (isGeofenceClient(locationCallbacks)) {
+ if (NULL == gData.geofenceInterface && !gGeofenceLoadFailed) {
+ gData.geofenceInterface =
+ (GeofenceInterface*)loadLocationInterface("libgeofence.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()
+{
+ delete this;
+}
+
+LocationAPI::LocationAPI()
+{
+ LOC_LOGD("LOCATION API CONSTRUCTOR");
+}
+
+LocationAPI::~LocationAPI()
+{
+ LOC_LOGD("LOCATION API DESTRUCTOR");
+ pthread_mutex_lock(&gDataMutex);
+
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ if (isGnssClient(it->second) && NULL != gData.gnssInterface) {
+ gData.gnssInterface->removeClient(it->first);
+ }
+ if (isFlpClient(it->second) && NULL != gData.flpInterface) {
+ gData.flpInterface->removeClient(it->first);
+ }
+ if (isGeofenceClient(it->second) && NULL != gData.geofenceInterface) {
+ gData.geofenceInterface->removeClient(it->first);
+ }
+ gData.clientData.erase(it);
+ } else {
+ LOC_LOGE("%s:%d]: Location API client %p not found in client data",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+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("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 (isFlpClient(locationCallbacks)) {
+ if (NULL == gData.flpInterface && !gFlpLoadFailed) {
+ gData.flpInterface =
+ (FlpInterface*)loadLocationInterface("libflp.so", "getFlpInterface");
+ if (NULL == gData.flpInterface) {
+ gFlpLoadFailed = true;
+ LOC_LOGW("%s:%d]: No flp interface available", __func__, __LINE__);
+ } else {
+ gData.flpInterface->initialize();
+ }
+ }
+ if (NULL != gData.flpInterface) {
+ // either adds new Client or updates existing Client
+ gData.flpInterface->addClient(this, locationCallbacks);
+ }
+ }
+
+ if (isGeofenceClient(locationCallbacks)) {
+ if (NULL == gData.geofenceInterface && !gGeofenceLoadFailed) {
+ gData.geofenceInterface =
+ (GeofenceInterface*)loadLocationInterface("libgeofence.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(LocationOptions& locationOptions)
+{
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ if (gData.flpInterface != NULL && locationOptions.minDistance > 0) {
+ id = gData.flpInterface->startTracking(this, locationOptions);
+ } else if (gData.gnssInterface != NULL && needsGnssTrackingInfo(it->second)) {
+ id = gData.gnssInterface->startTracking(this, locationOptions);
+ } else if (gData.flpInterface != NULL) {
+ id = gData.flpInterface->startTracking(this, locationOptions);
+ } else if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->startTracking(this, locationOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No gnss/flp 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()) {
+ // we don't know if tracking was started on flp or gnss, so we call stop on both, where
+ // stopTracking call to the incorrect interface will fail without response back to client
+ if (gData.gnssInterface != NULL) {
+ gData.gnssInterface->stopTracking(this, id);
+ }
+ if (gData.flpInterface != NULL) {
+ gData.flpInterface->stopTracking(this, id);
+ }
+ if (gData.flpInterface == NULL && gData.gnssInterface == NULL) {
+ LOC_LOGE("%s:%d]: No gnss/flp 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, LocationOptions& locationOptions)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ auto it = gData.clientData.find(this);
+ if (it != gData.clientData.end()) {
+ // we don't know if tracking was started on flp or gnss, so we call update on both, where
+ // updateTracking call to the incorrect interface will fail without response back to client
+ if (gData.gnssInterface != NULL) {
+ gData.gnssInterface->updateTrackingOptions(this, id, locationOptions);
+ }
+ if (gData.flpInterface != NULL) {
+ gData.flpInterface->updateTrackingOptions(this, id, locationOptions);
+ }
+ if (gData.flpInterface == NULL && gData.gnssInterface == NULL) {
+ LOC_LOGE("%s:%d]: No gnss/flp 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(LocationOptions& locationOptions)
+{
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.flpInterface != NULL) {
+ id = gData.flpInterface->startBatching(this, locationOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No flp 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 (gData.flpInterface != NULL) {
+ gData.flpInterface->stopBatching(this, id);
+ } else {
+ LOC_LOGE("%s:%d]: No flp interface available for Location API client %p ",
+ __func__, __LINE__, this);
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+}
+
+void
+LocationAPI::updateBatchingOptions(uint32_t id, LocationOptions& locationOptions)
+{
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.flpInterface != NULL) {
+ gData.flpInterface->updateBatchingOptions(this,
+ id,
+ locationOptions);
+ } else {
+ LOC_LOGE("%s:%d]: No flp 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.flpInterface != NULL) {
+ gData.flpInterface->getBatchedLocations(this, id, count);
+ } else {
+ LOC_LOGE("%s:%d]: No flp 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("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::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;
+}
diff --git a/msm8998/location/LocationAPI.h b/msm8998/location/LocationAPI.h
new file mode 100644
index 0000000..d128d5e
--- /dev/null
+++ b/msm8998/location/LocationAPI.h
@@ -0,0 +1,934 @@
+/* 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 LOCATION_H
+#define LOCATION_H
+
+#include <vector>
+#include <stdint.h>
+#include <functional>
+
+#define GNSS_NI_REQUESTOR_MAX 256
+#define GNSS_NI_MESSAGE_ID_MAX 2048
+#define GNSS_SV_MAX 64
+#define GNSS_MEASUREMENTS_MAX 64
+#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)
+
+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
+} 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 enum {
+ LOCATION_RELIABILITY_NOT_SET = 0,
+ LOCATION_RELIABILITY_VERY_LOW,
+ LOCATION_RELIABILITY_LOW,
+ LOCATION_RELIABILITY_MEDIUM,
+ LOCATION_RELIABILITY_HIGH,
+} LocationReliability;
+
+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
+} 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),
+} LocationCapabilitiesBits;
+
+typedef enum {
+ LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
+} LocationTechnologyType;
+
+// Configures how GPS is locked when GPS is disabled (through GnssDisable)
+typedef 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
+} 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,
+} 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
+} 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
+} 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),
+} 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,
+} 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),
+} GnssSvOptionsBits;
+
+typedef enum {
+ GNSS_ASSISTANCE_TYPE_SUPL = 0,
+ GNSS_ASSISTANCE_TYPE_C2K,
+} GnssAssistanceType;
+
+typedef enum {
+ GNSS_SUPL_MODE_STANDALONE = 0,
+ GNSS_SUPL_MODE_MSB,
+ GNSS_SUPL_MODE_MSA,
+} GnssSuplMode;
+
+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),
+} GnssMeasurementsAdrStateBits;
+
+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),
+} 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),
+} 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
+} 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),
+} GnssAidingDataSvTypeBits;
+
+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
+} GnssAidingData;
+
+typedef struct {
+ size_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;
+} Location;
+
+typedef struct {
+ size_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
+} LocationOptions;
+
+typedef struct {
+ size_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 {
+ size_t size; // set to sizeof(GeofenceInfo)
+ double latitude; // in degrees
+ double longitude; // in degrees
+ double radius; // in meters
+} GeofenceInfo;
+
+typedef struct {
+ size_t size; // set to sizeof(GeofenceBreachNotification)
+ size_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 {
+ size_t size; // set to sizeof(GeofenceBreachNotification)
+ GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES
+ LocationTechnologyType techType; // GNSS
+} GeofenceStatusNotification;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssLocationInfo)
+ 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 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
+} GnssLocationInfoNotification;
+
+typedef struct {
+ size_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;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssSv)
+ uint16_t svId; // Unique Identifier
+ 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
+} GnssSv;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssConfigSetAssistanceServer)
+ GnssAssistanceType type; // SUPL or C2K
+ const char* hostName; // null terminated string
+ uint32_t port; // port of server
+} GnssConfigSetAssistanceServer;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssMeasurementsData)
+ GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits
+ 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;
+} GnssMeasurementsData;
+
+typedef struct {
+ size_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;
+} GnssMeasurementsClock;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssSvNotification)
+ size_t count; // number of SVs in the GnssSv array
+ GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs
+} GnssSvNotification;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssNmeaNotification)
+ uint64_t timestamp; // timestamp
+ const char* nmea; // nmea text
+ size_t length; // length of the nmea text
+} GnssNmeaNotification;
+
+typedef struct {
+ size_t size; // set to sizeof(GnssMeasurementsNotification)
+ size_t count; // number of items in GnssMeasurements array
+ GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX];
+ GnssMeasurementsClock clock; // clock
+} GnssMeasurementsNotification;
+
+typedef struct {
+ size_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
+} GnssConfig;
+
+typedef struct {
+ size_t size; // set to sizeof
+ bool mValid;
+ Location mLocation;
+ double verticalAccuracyMeters;
+ double speedAccuracyMetersPerSecond;
+ double bearingAccuracyDegrees;
+ timespec mUtcReported;
+} GnssDebugLocation;
+
+typedef struct {
+ size_t size; // set to sizeof
+ bool mValid;
+ int64_t timeEstimate;
+ float timeUncertaintyNs;
+ float frequencyUncertaintyNsPerSec;
+} GnssDebugTime;
+
+typedef struct {
+ size_t size; // set to sizeof
+ uint32_t svid;
+ GnssSvType constellation;
+ GnssEphemerisType mEphemerisType;
+ GnssEphemerisSource mEphemerisSource;
+ GnssEphemerisHealth mEphemerisHealth;
+ float ephemerisAgeSeconds;
+ bool serverPredictionIsAvailable;
+ float serverPredictionAgeSeconds;
+} GnssDebugSatelliteInfo;
+
+typedef struct {
+ size_t size; // set to sizeof
+ GnssDebugLocation mLocation;
+ GnssDebugTime mTime;
+ std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
+} GnssDebugReport;
+
+/* 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(
+ size_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(
+ size_t count, // number of locations in array
+ Location* location // array of locations
+)> batchingCallback;
+
+/* 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;
+
+/* 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 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;
+
+typedef struct {
+ size_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
+ gnssMeasurementsCallback gnssMeasurementsCb; // optional
+} LocationCallbacks;
+
+class LocationAPI
+{
+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 LocationAPI object is
+ no longer needed. LocationAPI* returned from createInstance will no longer valid
+ after destroy is called */
+ void destroy();
+
+ /* updates/changes the callbacks that will be called.
+ mandatory callbacks must be present for callbacks to be successfully updated
+ no return value */
+ void updateCallbacks(LocationCallbacks&);
+
+ /* ================================== 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 LocationOptions parameter is invalid */
+ uint32_t startTracking(LocationOptions&); // returns session id
+
+ /* 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 */
+ void stopTracking(uint32_t id);
+
+ /* updateTrackingOptions 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 */
+ void updateTrackingOptions(uint32_t id, LocationOptions&);
+
+ /* ================================== 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 */
+ uint32_t startBatching(LocationOptions&); // returns session id
+
+ /* 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 */
+ void stopBatching(uint32_t id);
+
+ /* updateBatchingOptions 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 */
+ void updateBatchingOptions(uint32_t id, LocationOptions&);
+
+ /* 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 */
+ void getBatchedLocations(uint32_t id, size_t count);
+
+ /* ================================== 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 */
+ uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*); // returns id array
+
+ /* 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 */
+ void removeGeofences(size_t count, uint32_t* ids);
+
+ /* 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 */
+ void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options);
+
+ /* 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 */
+ void pauseGeofences(size_t count, uint32_t* ids);
+
+ /* 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 */
+ void resumeGeofences(size_t count, uint32_t* ids);
+
+ /* ================================== 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 */
+ void gnssNiResponse(uint32_t id, GnssNiResponse response);
+};
+
+typedef struct {
+ size_t size; // set to sizeof(LocationControlCallbacks)
+ responseCallback responseCb; // mandatory
+ collectiveResponseCallback collectiveResponseCb; // mandatory
+} LocationControlCallbacks;
+
+class LocationControlAPI
+{
+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 */
+ uint32_t* gnssUpdateConfig(GnssConfig config);
+
+ /* 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 */
+ uint32_t gnssDeleteAidingData(GnssAidingData& data);
+};
+
+#endif /* LOCATION_H */
diff --git a/msm8998/location/LocationAPIClientBase.cpp b/msm8998/location/LocationAPIClientBase.cpp
new file mode 100644
index 0000000..606a7b7
--- /dev/null
+++ b/msm8998/location/LocationAPIClientBase.cpp
@@ -0,0 +1,833 @@
+/* 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_APIClientBase"
+
+#include <log_util.h>
+#include <loc_cfg.h>
+#include "LocationAPIClientBase.h"
+
+#define FLP_CONF_FILE "/vendor/etc/flp.conf"
+#define GEOFENCE_SESSION_ID -1
+
+LocationAPIClientBase::LocationAPIClientBase() :
+ mTrackingCallback(nullptr),
+ mBatchingCallback(nullptr),
+ mGeofenceBreachCallback(nullptr),
+ mLocationAPI(nullptr),
+ mLocationControlAPI(nullptr),
+ mBatchSize(-1),
+ mEnabled(false),
+ 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] = nullptr;
+ }
+
+ memset(&mConfig, 0, sizeof(GnssConfig));
+}
+
+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 (mLocationAPI == nullptr ) {
+ mLocationAPI = LocationAPI::createInstance(locationCallbacks);
+ } else {
+ mLocationAPI->updateCallbacks(locationCallbacks);
+ }
+
+ if (mLocationControlAPI == nullptr) {
+ 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);
+ }
+
+ pthread_mutex_unlock(&mMutex);
+}
+
+LocationAPIClientBase::~LocationAPIClientBase()
+{
+ pthread_mutex_lock(&mMutex);
+
+ if (mLocationAPI) {
+ mLocationAPI->destroy();
+ mLocationAPI = nullptr;
+ }
+ if (mLocationControlAPI) {
+ mLocationControlAPI->destroy();
+ mLocationControlAPI = nullptr;
+ }
+
+ for (int i = 0; i < REQUEST_MAX; i++) {
+ if (mRequestQueues[i]) {
+ delete mRequestQueues[i];
+ mRequestQueues[i] = nullptr;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ pthread_mutex_destroy(&mMutex);
+}
+
+uint32_t LocationAPIClientBase::locAPIStartTracking(LocationOptions& 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 {
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_TRACKING] = nullptr;
+ }
+ 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]
+ requests = new RequestQueue(session);
+ requests->push(new StartTrackingRequest(*this));
+ mRequestQueues[REQUEST_TRACKING] = requests;
+ 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;
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ session = requests->getSession();
+ if (session > 0) {
+ requests->push(new StopTrackingRequest(*this));
+ mLocationAPI->stopTracking(session);
+ mTracking = false;
+ }
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIUpdateTrackingOptions(LocationOptions& options)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t session = 0;
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ session = requests->getSession();
+ if (session > 0) {
+ requests->push(new UpdateTrackingOptionsRequest(*this));
+ mLocationAPI->updateTrackingOptions(session, options);
+ }
+ }
+ }
+ 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(FLP_CONF_FILE, 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,
+ LocationOptions& options)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+
+ if (mSessionMap.find(id) != mSessionMap.end()) {
+ 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) {
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_TRACKING] = nullptr;
+ }
+ trackingSession = mLocationAPI->startTracking(options);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, trackingSession);
+ requests = new RequestQueue(trackingSession);
+ requests->push(new StartTrackingRequest(*this));
+ mRequestQueues[REQUEST_TRACKING] = requests;
+ } else if (sessionMode == SESSION_MODE_ON_FULL) {
+ RequestQueue* requests = mRequestQueues[REQUEST_BATCHING];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_BATCHING] = nullptr;
+ }
+ batchingSession = mLocationAPI->startBatching(options);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, batchingSession);
+ requests = new RequestQueue(batchingSession);
+ requests->push(new StartBatchingRequest(*this));
+ mRequestQueues[REQUEST_BATCHING] = requests;
+ }
+
+ SessionEntity entity;
+ entity.id = id;
+ entity.trackingSession = trackingSession;
+ entity.batchingSession = batchingSession;
+ entity.sessionMode = sessionMode;
+ mSessionMap[id] = 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 (mSessionMap.find(id) != mSessionMap.end()) {
+ SessionEntity entity = mSessionMap[id];
+
+ uint32_t trackingSession = entity.trackingSession;
+ uint32_t batchingSession = entity.batchingSession;
+ uint32_t sMode = entity.sessionMode;
+
+ mSessionMap.erase(id);
+
+ if (sMode == SESSION_MODE_ON_FIX) {
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ requests->push(new StopTrackingRequest(*this));
+ mLocationAPI->stopTracking(trackingSession);
+ }
+ } else if (sMode == SESSION_MODE_ON_FULL) {
+ RequestQueue* requests = mRequestQueues[REQUEST_BATCHING];
+ if (requests) {
+ requests->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,
+ LocationOptions& options)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+
+ if (mSessionMap.find(id) != mSessionMap.end()) {
+ SessionEntity& entity = mSessionMap[id];
+
+ uint32_t trackingSession = entity.trackingSession;
+ uint32_t batchingSession = entity.batchingSession;
+ uint32_t sMode = entity.sessionMode;
+
+ if (sessionMode == SESSION_MODE_ON_FIX) {
+ if (sMode == SESSION_MODE_ON_FIX) {
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ requests->push(new UpdateTrackingOptionsRequest(*this));
+ mLocationAPI->updateTrackingOptions(trackingSession, options);
+ }
+ } else if (sMode == SESSION_MODE_ON_FULL) {
+ // stop batching
+ {
+ RequestQueue* requests = mRequestQueues[REQUEST_BATCHING];
+ if (requests) {
+ requests->push(new StopBatchingRequest(*this));
+ mLocationAPI->stopBatching(batchingSession);
+ batchingSession = 0;
+ }
+ }
+ // start tracking
+ {
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_TRACKING] = nullptr;
+ }
+ trackingSession = mLocationAPI->startTracking(options);
+ LOC_LOGI("%s:%d] start new session: %d",
+ __FUNCTION__, __LINE__, trackingSession);
+ requests = new RequestQueue(trackingSession);
+ requests->push(new StartTrackingRequest(*this));
+ mRequestQueues[REQUEST_TRACKING] = requests;
+ }
+ }
+ } else if (sessionMode == SESSION_MODE_ON_FULL) {
+ if (sMode == SESSION_MODE_ON_FIX) {
+ // stop tracking
+ {
+ RequestQueue* requests = mRequestQueues[REQUEST_TRACKING];
+ if (requests) {
+ requests->push(new StopTrackingRequest(*this));
+ mLocationAPI->stopTracking(trackingSession);
+ trackingSession = 0;
+ }
+ }
+ // start batching
+ {
+ RequestQueue* requests = mRequestQueues[REQUEST_BATCHING];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_BATCHING] = nullptr;
+ }
+ batchingSession = mLocationAPI->startBatching(options);
+ LOC_LOGI("%s:%d] start new session: %d",
+ __FUNCTION__, __LINE__, batchingSession);
+ requests = new RequestQueue(batchingSession);
+ requests->push(new StartBatchingRequest(*this));
+ mRequestQueues[REQUEST_BATCHING] = requests;
+ }
+ } else if (sMode == SESSION_MODE_ON_FULL) {
+ RequestQueue* requests = mRequestQueues[REQUEST_BATCHING];
+ requests = mRequestQueues[REQUEST_BATCHING];
+ if (requests) {
+ requests->push(new UpdateBatchingOptionsRequest(*this));
+ mLocationAPI->updateBatchingOptions(batchingSession, options);
+ }
+ }
+ }
+
+ entity.trackingSession = trackingSession;
+ entity.batchingSession = batchingSession;
+ entity.sessionMode = sessionMode;
+
+ 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;
+}
+
+void LocationAPIClientBase::locAPIGetBatchedLocations(size_t count)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ uint32_t session = 0;
+ RequestQueue* requests = mRequestQueues[REQUEST_BATCHING];
+ if (requests) {
+ session = requests->getSession();
+ if (session > 0) {
+ requests->push(new GetBatchedLocationsRequest(*this));
+ mLocationAPI->getBatchedLocations(session, count);
+ }
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+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) {
+ RequestQueue* requests = mRequestQueues[REQUEST_GEOFENCE];
+ if (!requests) {
+ // Create a new RequestQueue for Geofenceing if we've not had one.
+ // The RequestQueue will be released when LocationAPIClientBase is released.
+ requests = new RequestQueue(GEOFENCE_SESSION_ID);
+ mRequestQueues[REQUEST_GEOFENCE] = requests;
+ }
+ uint32_t* sessions = mLocationAPI->addGeofences(count, options, data);
+ if (sessions) {
+ LOC_LOGI("%s:%d] start new sessions: %p", __FUNCTION__, __LINE__, sessions);
+ requests->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);
+
+ RequestQueue* requests = mRequestQueues[REQUEST_GEOFENCE];
+ if (requests) {
+ 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) {
+ requests->push(new RemoveGeofencesRequest(*this));
+ mLocationAPI->removeGeofences(j, sessions);
+ }
+ }
+
+ 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);
+
+ RequestQueue* requests = mRequestQueues[REQUEST_GEOFENCE];
+ if (requests) {
+ 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) {
+ requests->push(new ModifyGeofencesRequest(*this));
+ mLocationAPI->modifyGeofences(j, sessions, options);
+ }
+ }
+
+ 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);
+
+ RequestQueue* requests = mRequestQueues[REQUEST_GEOFENCE];
+ if (requests) {
+ 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) {
+ requests->push(new PauseGeofencesRequest(*this));
+ mLocationAPI->pauseGeofences(j, sessions);
+ }
+ }
+
+ 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);
+
+ RequestQueue* requests = mRequestQueues[REQUEST_GEOFENCE];
+ if (requests) {
+ 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) {
+ requests->push(new ResumeGeofencesRequest(*this));
+ mLocationAPI->resumeGeofences(j, sessions);
+ }
+ }
+
+ free(sessions);
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIRemoveAllGeofences()
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ std::vector<uint32_t> sessionsVec = mGeofenceBiDict.getAllSessions();
+ size_t count = sessionsVec.size();
+ uint32_t* sessions = (uint32_t*)malloc(sizeof(uint32_t) * count);
+
+ RequestQueue* requests = mRequestQueues[REQUEST_GEOFENCE];
+ if (requests) {
+ size_t j = 0;
+ for (size_t i = 0; i < count; i++) {
+ sessions[j] = sessionsVec[i];
+ if (sessions[j] > 0) {
+ j++;
+ }
+ }
+ if (j > 0) {
+ requests->push(new RemoveGeofencesRequest(*this));
+ mLocationAPI->removeGeofences(j, sessions);
+ }
+ }
+
+ free(sessions);
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+void LocationAPIClientBase::locAPIGnssNiResponse(uint32_t id, GnssNiResponse response)
+{
+ pthread_mutex_lock(&mMutex);
+ if (mLocationAPI) {
+ RequestQueue* requests = mRequestQueues[REQUEST_NIRESPONSE];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_NIRESPONSE] = nullptr;
+ }
+ uint32_t session = id;
+ mLocationAPI->gnssNiResponse(id, response);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ requests = new RequestQueue(session);
+ requests->push(new GnssNiResponseRequest(*this));
+ mRequestQueues[REQUEST_NIRESPONSE] = requests;
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+uint32_t LocationAPIClientBase::locAPIGnssDeleteAidingData(GnssAidingData& data)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ pthread_mutex_lock(&mMutex);
+ if (mLocationControlAPI) {
+ RequestQueue* requests = mRequestQueues[REQUEST_DELETEAIDINGDATA];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_DELETEAIDINGDATA] = nullptr;
+ }
+ uint32_t session = mLocationControlAPI->gnssDeleteAidingData(data);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ requests = new RequestQueue(session);
+ requests->push(new GnssDeleteAidingDataRequest(*this));
+ mRequestQueues[REQUEST_DELETEAIDINGDATA] = requests;
+
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+uint32_t LocationAPIClientBase::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) {
+ RequestQueue* requests = mRequestQueues[REQUEST_CONTROL];
+ if (requests) {
+ delete requests;
+ mRequestQueues[REQUEST_CONTROL] = nullptr;
+ }
+ uint32_t session = mLocationControlAPI->enable(techType);
+ LOC_LOGI("%s:%d] start new session: %d", __FUNCTION__, __LINE__, session);
+ requests = new RequestQueue(session);
+ mRequestQueues[REQUEST_CONTROL] = requests;
+ if (requests) {
+ requests->push(new EnableRequest(*this));
+ retVal = LOCATION_ERROR_SUCCESS;
+ mEnabled = true;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+
+ return retVal;
+}
+
+void LocationAPIClientBase::locAPIDisable()
+{
+ pthread_mutex_lock(&mMutex);
+ if (mEnabled && mLocationControlAPI) {
+ uint32_t session = 0;
+ RequestQueue* requests = mRequestQueues[REQUEST_CONTROL];
+ if (requests) {
+ session = requests->getSession();
+ if (session > 0) {
+ requests->push(new DisableRequest(*this));
+ mLocationControlAPI->disable(session);
+ mEnabled = false;
+ }
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+}
+
+uint32_t LocationAPIClientBase::locAPIGnssUpdateConfig(GnssConfig config)
+{
+ uint32_t retVal = LOCATION_ERROR_GENERAL_FAILURE;
+ if (memcmp(&mConfig, &config, sizeof(GnssConfig)) == 0) {
+ LOC_LOGV("%s:%d] GnssConfig is identical to previous call", __FUNCTION__, __LINE__);
+ retVal = LOCATION_ERROR_SUCCESS;
+ return retVal;
+ }
+
+ pthread_mutex_lock(&mMutex);
+ if (mLocationControlAPI) {
+
+ memcpy(&mConfig, &config, sizeof(GnssConfig));
+
+ uint32_t session = 0;
+ RequestQueue* requests = mRequestQueues[REQUEST_CONFIG];
+ uint32_t* idArray = mLocationControlAPI->gnssUpdateConfig(config);
+ LOC_LOGV("%s:%d] gnssUpdateConfig return array: %p", __FUNCTION__, __LINE__, idArray);
+ if (!requests && idArray != nullptr) {
+ requests = new RequestQueue(idArray[0]);
+ mRequestQueues[REQUEST_CONFIG] = requests;
+ }
+ if (requests) {
+ requests->push(new GnssUpdateConfigRequest(*this));
+ retVal = LOCATION_ERROR_SUCCESS;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ return retVal;
+}
+
+void LocationAPIClientBase::beforeGeofenceBreachCb(
+ GeofenceBreachNotification geofenceBreachNotification)
+{
+ if (mGeofenceBreachCallback == nullptr)
+ return;
+ uint32_t* ids = (uint32_t*)malloc(sizeof(uint32_t) * geofenceBreachNotification.count);
+ uint32_t* backup = geofenceBreachNotification.ids;
+ size_t n = geofenceBreachNotification.count;
+
+ size_t count = 0;
+ for (size_t i = 0; i < n; i++) {
+ uint32_t id = mGeofenceBiDict.getId(geofenceBreachNotification.ids[i]);
+ GeofenceBreachTypeMask type = mGeofenceBiDict.getType(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;
+ mGeofenceBreachCallback(geofenceBreachNotification);
+
+ // restore ids
+ geofenceBreachNotification.ids = backup;
+ geofenceBreachNotification.count = n;
+ free(ids);
+}
+
+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] error: %d id: %d", __FUNCTION__, __LINE__, error, id);
+ }
+ LocationAPIRequest* request = getRequestBySession(id);
+ if (request) {
+ request->onResponse(error);
+ 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] error: %d id: %d", __FUNCTION__, __LINE__, errors[i], ids[i]);
+ }
+ }
+ LocationAPIRequest* request = nullptr;
+ pthread_mutex_lock(&mMutex);
+ if (mRequestQueues[REQUEST_GEOFENCE] != nullptr) {
+ request = mRequestQueues[REQUEST_GEOFENCE]->pop();
+ }
+ pthread_mutex_unlock(&mMutex);
+ if (request) {
+ request->onCollectiveResponse(count, errors, ids);
+ delete request;
+ }
+}
+
+void LocationAPIClientBase::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] error: %d id: %d", __FUNCTION__, __LINE__, error, id);
+ }
+ LocationAPIRequest* request = getRequestBySession(id);
+ if (request) {
+ request->onResponse(error);
+ delete request;
+ }
+}
+
+void LocationAPIClientBase::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] error: %d id: %d", __FUNCTION__, __LINE__, errors[i], ids[i]);
+ }
+ }
+ LocationAPIRequest* request = nullptr;
+ pthread_mutex_lock(&mMutex);
+ if (mRequestQueues[REQUEST_CONFIG] != nullptr) {
+ request = mRequestQueues[REQUEST_CONFIG]->pop();
+ }
+ pthread_mutex_unlock(&mMutex);
+ if (request) {
+ request->onCollectiveResponse(count, errors, ids);
+ delete request;
+ }
+}
+
+LocationAPIClientBase::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_CONFIG &&
+ mRequestQueues[i] &&
+ mRequestQueues[i]->getSession() == session) {
+ request = mRequestQueues[i]->pop();
+ break;
+ }
+ }
+ pthread_mutex_unlock(&mMutex);
+ return request;
+}
diff --git a/msm8998/location/LocationAPIClientBase.h b/msm8998/location/LocationAPIClientBase.h
new file mode 100644
index 0000000..3a1d994
--- /dev/null
+++ b/msm8998/location/LocationAPIClientBase.h
@@ -0,0 +1,471 @@
+/* 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 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"
+
+enum SESSION_MODE {
+ SESSION_MODE_NONE = 0,
+ SESSION_MODE_ON_FULL,
+ SESSION_MODE_ON_FIX,
+};
+
+enum REQUEST_TYPE {
+ REQUEST_TRACKING = 0,
+ REQUEST_BATCHING,
+ REQUEST_GEOFENCE,
+ REQUEST_NIRESPONSE,
+ REQUEST_DELETEAIDINGDATA,
+ REQUEST_CONTROL,
+ REQUEST_CONFIG,
+ REQUEST_MAX,
+};
+
+class LocationAPIClientBase
+{
+public:
+ LocationAPIClientBase();
+ virtual ~LocationAPIClientBase();
+ LocationAPIClientBase(const LocationAPIClientBase&) = delete;
+ LocationAPIClientBase& operator=(const LocationAPIClientBase&) = delete;
+
+ void locAPISetCallbacks(LocationCallbacks& locationCallbacks);
+
+ // LocationAPI
+ uint32_t locAPIStartTracking(LocationOptions& options);
+ void locAPIStopTracking();
+ void locAPIUpdateTrackingOptions(LocationOptions& options);
+
+ int32_t locAPIGetBatchSize();
+ uint32_t locAPIStartSession(uint32_t id, uint32_t sessionMode,
+ LocationOptions& options);
+ uint32_t locAPIStopSession(uint32_t id);
+ uint32_t locAPIUpdateSessionOptions(uint32_t id, uint32_t sessionMode,
+ LocationOptions& options);
+ void locAPIGetBatchedLocations(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);
+ uint32_t locAPIGnssDeleteAidingData(GnssAidingData& data);
+
+ uint32_t locAPIEnable(LocationTechnologyType techType);
+ void locAPIDisable();
+ uint32_t locAPIGnssUpdateConfig(GnssConfig config);
+
+ // callbacks
+ void onResponseCb(LocationError error, uint32_t id);
+ void onCollectiveResponseCb(size_t count, LocationError* errors, uint32_t* ids);
+
+ void onCtrlResponseCb(LocationError error, uint32_t id);
+ void onCtrlCollectiveResponseCb(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 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*/) {}
+ 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 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*/) {}
+
+private:
+ // private inner classes
+ typedef struct {
+ uint32_t id;
+ uint32_t trackingSession;
+ uint32_t batchingSession;
+ uint32_t sessionMode;
+ } SessionEntity;
+
+ class BiDict {
+ public:
+ BiDict() {
+ pthread_mutex_init(&mBiDictMutex, nullptr);
+ }
+ ~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;
+ }
+ void set(uint32_t id, uint32_t session, uint32_t type) {
+ pthread_mutex_lock(&mBiDictMutex);
+ mForwardMap[id] = session;
+ mBackwardMap[session] = id;
+ mTypeMap[session] = type;
+ pthread_mutex_unlock(&mBiDictMutex);
+ }
+ void clear() {
+ pthread_mutex_lock(&mBiDictMutex);
+ mForwardMap.clear();
+ mBackwardMap.clear();
+ mTypeMap.clear();
+ pthread_mutex_unlock(&mBiDictMutex);
+ }
+ void rmById(uint32_t id) {
+ pthread_mutex_lock(&mBiDictMutex);
+ mBackwardMap.erase(mForwardMap[id]);
+ mTypeMap.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);
+ mTypeMap.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;
+ }
+ uint32_t getType(uint32_t session) {
+ pthread_mutex_lock(&mBiDictMutex);
+ uint32_t ret = 0;
+ auto it = mTypeMap.find(session);
+ if (it != mTypeMap.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;
+ // mTypeMap mapping session->type
+ std::map<uint32_t, uint32_t> mTypeMap;
+ };
+
+ class LocationAPIRequest {
+ public:
+ LocationAPIRequest(LocationAPIClientBase& API) : mAPI(API) {}
+ virtual ~LocationAPIRequest() {}
+ virtual void onResponse(LocationError /*error*/) {};
+ virtual void onCollectiveResponse(
+ size_t /*count*/, LocationError* /*errors*/, uint32_t* /*ids*/) {};
+ LocationAPIClientBase& mAPI;
+ };
+
+ class StartTrackingRequest : public LocationAPIRequest {
+ public:
+ StartTrackingRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onStartTrackingCb(error);
+ }
+ };
+
+ class StopTrackingRequest : public LocationAPIRequest {
+ public:
+ StopTrackingRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onStopTrackingCb(error);
+ }
+ };
+
+ class UpdateTrackingOptionsRequest : public LocationAPIRequest {
+ public:
+ UpdateTrackingOptionsRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onUpdateTrackingOptionsCb(error);
+ }
+ };
+
+ class StartBatchingRequest : public LocationAPIRequest {
+ public:
+ StartBatchingRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onStartBatchingCb(error);
+ }
+ };
+
+ class StopBatchingRequest : public LocationAPIRequest {
+ public:
+ StopBatchingRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onStopBatchingCb(error);
+ }
+ };
+
+ class UpdateBatchingOptionsRequest : public LocationAPIRequest {
+ public:
+ UpdateBatchingOptionsRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onUpdateBatchingOptionsCb(error);
+ }
+ };
+
+ class GetBatchedLocationsRequest : public LocationAPIRequest {
+ public:
+ GetBatchedLocationsRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onGetBatchedLocationsCb(error);
+ }
+ };
+
+ class AddGeofencesRequest : public LocationAPIRequest {
+ public:
+ AddGeofencesRequest(LocationAPIClientBase& API) : LocationAPIRequest(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.onAddGeofencesCb(count, errors, ids);
+ free(ids);
+ }
+ };
+
+ class RemoveGeofencesRequest : public LocationAPIRequest {
+ public:
+ RemoveGeofencesRequest(LocationAPIClientBase& API) : LocationAPIRequest(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.mGeofenceBiDict.rmBySession(sessions[i]);
+ }
+ mAPI.onRemoveGeofencesCb(count, errors, ids);
+ free(ids);
+ }
+ };
+
+ class ModifyGeofencesRequest : public LocationAPIRequest {
+ public:
+ ModifyGeofencesRequest(LocationAPIClientBase& API) : LocationAPIRequest(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);
+ }
+ };
+
+ class PauseGeofencesRequest : public LocationAPIRequest {
+ public:
+ PauseGeofencesRequest(LocationAPIClientBase& API) : LocationAPIRequest(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);
+ }
+ };
+
+ class ResumeGeofencesRequest : public LocationAPIRequest {
+ public:
+ ResumeGeofencesRequest(LocationAPIClientBase& API) : LocationAPIRequest(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);
+ }
+ };
+
+ class GnssNiResponseRequest : public LocationAPIRequest {
+ public:
+ GnssNiResponseRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onGnssNiResponseCb(error);
+ }
+ };
+
+ class GnssDeleteAidingDataRequest : public LocationAPIRequest {
+ public:
+ GnssDeleteAidingDataRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onGnssDeleteAidingDataCb(error);
+ }
+ };
+
+ class EnableRequest : public LocationAPIRequest {
+ public:
+ EnableRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onEnableCb(error);
+ }
+ };
+
+ class DisableRequest : public LocationAPIRequest {
+ public:
+ DisableRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onResponse(LocationError error) {
+ mAPI.onDisableCb(error);
+ }
+ };
+
+ class GnssUpdateConfigRequest : public LocationAPIRequest {
+ public:
+ GnssUpdateConfigRequest(LocationAPIClientBase& API) : LocationAPIRequest(API) {}
+ inline void onCollectiveResponse(size_t count, LocationError* errors, uint32_t* ids) {
+ mAPI.onGnssUpdateConfigCb(count, errors, ids);
+ }
+ };
+
+ class RequestQueue {
+ public:
+ RequestQueue(uint32_t session): mSession(session) {
+ }
+ ~RequestQueue() {
+ LocationAPIRequest* request = nullptr;
+ while (!mQueue.empty()) {
+ request = mQueue.front();
+ mQueue.pop();
+ delete request;
+ }
+ }
+ 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; }
+ private:
+ uint32_t mSession;
+ std::queue<LocationAPIRequest*> mQueue;
+ };
+
+ LocationAPIRequest* getRequestBySession(uint32_t session);
+
+private:
+ pthread_mutex_t mMutex;
+
+ trackingCallback mTrackingCallback;
+ batchingCallback mBatchingCallback;
+ geofenceBreachCallback mGeofenceBreachCallback;
+
+ LocationAPI* mLocationAPI;
+ LocationControlAPI* mLocationControlAPI;
+
+ BiDict mGeofenceBiDict;
+ RequestQueue* mRequestQueues[REQUEST_MAX];
+ std::map<uint32_t, SessionEntity> mSessionMap;
+ int32_t mBatchSize;
+ bool mEnabled;
+ bool mTracking;
+
+ GnssConfig mConfig;
+};
+
+#endif /* LOCATION_API_CLINET_BASE_H */
diff --git a/msm8998/location/location_interface.h b/msm8998/location/location_interface.h
new file mode 100644
index 0000000..86febd3
--- /dev/null
+++ b/msm8998/location/location_interface.h
@@ -0,0 +1,91 @@
+/* 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 LOCATION_INTERFACE_H
+#define LOCATION_INTERFACE_H
+
+#include <LocationAPI.h>
+
+struct GnssInterface {
+ size_t size;
+ void (*initialize)(void);
+ void (*deinitialize)(void);
+ void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
+ void (*removeClient)(LocationAPI* client);
+ void (*requestCapabilities)(LocationAPI* client);
+ uint32_t (*startTracking)(LocationAPI* client, LocationOptions& options);
+ void (*updateTrackingOptions)(LocationAPI* client, uint32_t id, LocationOptions& options);
+ 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 (*gnssDeleteAidingData)(GnssAidingData& data);
+ void (*injectLocation)(double latitude, double longitude, float accuracy);
+ void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
+ void (*agpsInit)(void* statusV4Cb);
+ void (*agpsDataConnOpen)(short agpsType, const char* apnName, int apnLen, int ipType);
+ void (*agpsDataConnClosed)(short agpsType);
+ void (*agpsDataConnFailed)(short agpsType);
+ void (*getDebugReport)(GnssDebugReport& report);
+};
+
+struct FlpInterface {
+ size_t size;
+ void (*initialize)(void);
+ void (*deinitialize)(void);
+ void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
+ void (*removeClient)(LocationAPI* client);
+ void (*requestCapabilities)(LocationAPI* client);
+ uint32_t (*startTracking)(LocationAPI* client, LocationOptions& options);
+ void (*updateTrackingOptions)(LocationAPI* client, uint32_t id, LocationOptions& options);
+ void (*stopTracking)(LocationAPI* client, uint32_t id);
+ uint32_t (*startBatching)(LocationAPI* client, LocationOptions&);
+ void (*stopBatching)(LocationAPI* client, uint32_t id);
+ void (*updateBatchingOptions)(LocationAPI* client, uint32_t id, LocationOptions&);
+ void (*getBatchedLocations)(LocationAPI* client, uint32_t id, size_t count);
+ void (*getPowerStateChanges)(void* powerStateCb);
+};
+
+struct GeofenceInterface {
+ size_t size;
+ void (*initialize)(void);
+ void (*deinitialize)(void);
+ void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
+ void (*removeClient)(LocationAPI* client);
+ 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/msm8998/utils/Android.mk b/msm8998/utils/Android.mk
new file mode 100644
index 0000000..ff18f2f
--- /dev/null
+++ b/msm8998/utils/Android.mk
@@ -0,0 +1,78 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_pla
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp \
+ loc_nmea.cpp
+
+# 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_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/libloc_pla \
+ $(TARGET_OUT_HEADERS)/liblocation_api \
+
+LOCAL_COPY_HEADERS_TO:= gps.utils/
+LOCAL_COPY_HEADERS:= \
+ loc_log.h \
+ loc_cfg.h \
+ log_util.h \
+ linked_list.h \
+ msg_q.h \
+ MsgTask.h \
+ LocHeap.h \
+ LocThread.h \
+ LocTimer.h \
+ loc_target.h \
+ loc_timer.h \
+ LocSharedLock.h \
+ loc_misc_utils.h \
+ loc_nmea.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_gps.h
+
+LOCAL_MODULE := libgps.utils
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_OWNER := qti
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, platform_lib_abstractions))
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/utils/LocHeap.cpp b/msm8998/utils/LocHeap.cpp
similarity index 100%
copy from utils/LocHeap.cpp
copy to msm8998/utils/LocHeap.cpp
diff --git a/utils/LocHeap.h b/msm8998/utils/LocHeap.h
similarity index 100%
copy from utils/LocHeap.h
copy to msm8998/utils/LocHeap.h
diff --git a/utils/LocSharedLock.h b/msm8998/utils/LocSharedLock.h
similarity index 100%
copy from utils/LocSharedLock.h
copy to msm8998/utils/LocSharedLock.h
diff --git a/msm8998/utils/LocThread.cpp b/msm8998/utils/LocThread.cpp
new file mode 100644
index 0000000..685841e
--- /dev/null
+++ b/msm8998/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 <platform_lib_macros.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(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 = NULL;
+ }
+
+ if (mThandle) {
+ // set thread name
+ char lname[16];
+ int len = (sizeof(lname)>sizeof(threadName)) ?
+ (sizeof(threadName) -1):(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/utils/LocThread.h b/msm8998/utils/LocThread.h
similarity index 100%
copy from utils/LocThread.h
copy to msm8998/utils/LocThread.h
diff --git a/msm8998/utils/LocTimer.cpp b/msm8998/utils/LocTimer.cpp
new file mode 100644
index 0000000..d6415df
--- /dev/null
+++ b/msm8998/utils/LocTimer.cpp
@@ -0,0 +1,743 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <errno.h>
+#include <loc_timer.h>
+#include <sys/timerfd.h>
+#include <sys/epoll.h>
+#include <unistd.h>
+#include <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, bool wakeOnExpire);
+ 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 = {0};
+ 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 = {0};
+ 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, bool wakeOnExpire)
+ : mClient(&client),
+ mLock(mClient->mLock->share()),
+ mFutureTime(futureTime),
+ mContainer(LocTimerContainer::get(wakeOnExpire)) {
+ // 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;
+ }
+ mTimer = new LocTimerDelegate(*this, futureTime, wakeOnExpire);
+ // 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/utils/LocTimer.h b/msm8998/utils/LocTimer.h
similarity index 100%
copy from utils/LocTimer.h
copy to msm8998/utils/LocTimer.h
diff --git a/msm8998/utils/Makefile.am b/msm8998/utils/Makefile.am
new file mode 100644
index 0000000..d7a2a7e
--- /dev/null
+++ b/msm8998/utils/Makefile.am
@@ -0,0 +1,62 @@
+AM_CFLAGS = -Wundef \
+ -I./ \
+ $(LOCPLA_CFLAGS)
+
+AM_CPPFLAGS = -Wundef \
+ -I./ \
+ $(LOCPLA_CFLAGS)
+
+libgps_utils_so_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 \
+ loc_misc_utils.h \
+ loc_nmea.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_gps.h
+
+libgps_utils_so_la_c_sources = \
+ linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ loc_target.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp \
+ loc_nmea.cpp
+
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lcutils -lstdc++ -llog $(LOCPLA_LIBS)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+
+pkgconfig_DATA = gps-utils.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/msm8998/utils/MsgTask.cpp b/msm8998/utils/MsgTask.cpp
new file mode 100644
index 0000000..f7450b9
--- /dev/null
+++ b/msm8998/utils/MsgTask.cpp
@@ -0,0 +1,101 @@
+/* Copyright (c) 2011-2013, 2015, 2017The 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_NDDEBUG 0
+#define LOG_TAG "LocSvc_MsgTask"
+
+#include <unistd.h>
+#include <MsgTask.h>
+#include <msg_q.h>
+#include <loc_log.h>
+#include <platform_lib_includes.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 {
+ msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
+}
+
+void MsgTask::prerun() {
+ // make sure we do not run in background scheduling group
+ platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND);
+}
+
+bool MsgTask::run() {
+ //LOC_LOGV("MsgTask::loop() listening ...\n");
+ 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/utils/MsgTask.h b/msm8998/utils/MsgTask.h
similarity index 100%
copy from utils/MsgTask.h
copy to msm8998/utils/MsgTask.h
diff --git a/utils/gps_extended.h b/msm8998/utils/gps_extended.h
similarity index 100%
copy from utils/gps_extended.h
copy to msm8998/utils/gps_extended.h
diff --git a/msm8998/utils/gps_extended_c.h b/msm8998/utils/gps_extended_c.h
new file mode 100644
index 0000000..26b1866
--- /dev/null
+++ b/msm8998/utils/gps_extended_c.h
@@ -0,0 +1,1165 @@
+/* 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_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>
+#include <time.h>
+
+/**
+ * @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
+
+/** 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 source is ZPP only */
+#define ULP_LOCATION_IS_FROM_ZPP 0x0004
+/** Position is from a Geofence Breach Event */
+#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008
+/** Position is from Hardware FLP */
+#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010
+/** Position is from NLP */
+#define ULP_LOCATION_IS_FROM_NLP 0x0020
+/** Position is from PIP */
+#define ULP_LOCATION_IS_FROM_PIP 0x0040
+/** Position is from external DR solution*/
+#define ULP_LOCATION_IS_FROM_EXT_DR 0X0080
+
+#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
+
+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)
+
+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_enum;
+
+typedef struct {
+ /** set to sizeof(UlpLocation) */
+ size_t size;
+ LocGpsLocation gpsLocation;
+ /* Provider indicator for HYBRID or GPS */
+ uint16_t position_source;
+ LocPosTechMask tech_mask;
+ /*allows HAL to pass additional information related to the location */
+ int rawDataSize; /* in # of bytes */
+ void * rawData;
+ bool is_indoor;
+ float floor_number;
+ char map_url[GPS_LOCATION_MAP_URL_SIZE];
+ unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE];
+} UlpLocation;
+
+typedef struct {
+ /** set to sizeof(UlpNmea) */
+ size_t size;
+ char nmea_str[ULP_MAX_NMEA_STRING_SIZE];
+ unsigned int len;
+} UlpNmea;
+
+
+/** AGPS type */
+typedef int16_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 -1
+#define AGPS_APN_BEARER_IPV4 0
+#define AGPS_APN_BEARER_IPV6 1
+#define AGPS_APN_BEARER_IPV4V6 2
+
+/** GPS extended callback structure. */
+typedef struct {
+ /** set to sizeof(LocGpsCallbacks) */
+ size_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) */
+ size_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
+} 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 uint16_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
+
+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)
+
+/** 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 QZSS_SV_PRN_MIN 193
+#define QZSS_SV_PRN_MAX 197
+#define BDS_SV_PRN_MIN 201
+#define BDS_SV_PRN_MAX 235
+#define GAL_SV_PRN_MIN 301
+#define GAL_SV_PRN_MAX 336
+
+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)
+
+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 struct {
+ struct timespec 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;
+} GnssSvUsedInPosition;
+
+/** Represents gps location extended. */
+typedef struct {
+ /** set to sizeof(GpsLocationExtended) */
+ size_t size;
+ /** Contains GpsLocationExtendedFlags bits. */
+ uint16_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;
+ /** Nav solution mask to indicate sbas corrections */
+ LocNavSolutionMask navSolutionMask;
+ /** Position technology used in computing this fix */
+ LocPosTechMask tech_mask;
+} GpsLocationExtended;
+
+enum loc_sess_status {
+ LOC_SESS_SUCCESS,
+ LOC_SESS_INTERMEDIATE,
+ LOC_SESS_FAILURE
+};
+
+// 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_ALL_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_DEBUG_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,
+ LOC_API_ADAPTER_ERR_ALREADY_INITIALIZED = 11,
+ LOC_API_ADAPTER_ERR_OCCUPIED = 12,
+
+ /* 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_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)
+
+
+typedef unsigned int 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_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
+#define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 16
+
+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_VALID_FLAGS
+
+};
+
+#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)
+
+
+typedef enum
+{
+ 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_COMPASS = 4,
+ /**< COMPASS satellite. */
+ GNSS_LOC_SV_SYSTEM_GLONASS = 5,
+ /**< GLONASS satellite. */
+ GNSS_LOC_SV_SYSTEM_BDS = 6
+ /**< BDS satellite. */
+} Gnss_LocSvSystemEnumType;
+
+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
+{
+ size_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
+{
+ size_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
+{
+ size_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
+{
+ size_t size;
+ uint16_t systemWeek;
+ /**< System week number for GPS, BDS and GAL satellite systems. \n
+ Set to 65535 when invalid or not available. \n
+ Not valid for GLONASS system. \n
+ */
+
+ uint32_t systemMsec;
+ /**< System time msec. Time of Week for GPS, BDS, GAL and
+ Time of Day for GLONASS.
+ - Units: msec \n
+ */
+ float systemClkTimeBias;
+ /**< System clock time bias \n
+ - Units: msec \n
+ System time = systemMsec - systemClkTimeBias \n
+ */
+ float systemClkTimeUncMs;
+ /**< Single sided maximum time bias uncertainty \n
+ - Units: msec \n
+ */
+}Gnss_LocSystemTimeStructType;
+
+typedef struct {
+
+ size_t size;
+ uint8_t gloFourYear;
+ /**< GLONASS four year number from 1996. Refer to GLONASS ICD.\n
+ Applicable only for GLONASS and shall be ignored for other constellations. \n
+ If unknown shall be set to 255
+ */
+
+ uint16_t gloDays;
+ /**< GLONASS day number in four years. Refer to GLONASS ICD.
+ Applicable only for GLONASS and shall be ignored for other constellations. \n
+ If unknown shall be set to 65535
+ */
+
+ uint32_t gloMsec;
+ /**< GLONASS time of day in msec. Refer to GLONASS ICD.
+ - Units: msec \n
+ */
+
+ float gloClkTimeBias;
+ /**< System clock time bias (sub-millisecond) \n
+ - Units: msec \n
+ System time = systemMsec - systemClkTimeBias \n
+ */
+
+ float gloClkTimeUncMs;
+ /**< Single sided maximum time bias uncertainty \n
+ - Units: msec \n
+ */
+}Gnss_LocGloTimeStructType; /* Type */
+
+typedef struct {
+
+ size_t size;
+ uint32_t refFCount;
+ /**< Receiver frame counter value at reference tick */
+
+ uint8_t systemRtc_valid;
+ /**< Validity indicator for System RTC */
+
+ uint64_t systemRtcMs;
+ /**< Platform system RTC value \n
+ - Units: msec \n
+ */
+
+ uint32_t sourceOfTime;
+ /**< Source of time information */
+
+}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_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 = 0x000001000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x000002000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x000004000,
+ /**< Don't use measurement if bit is set */
+ GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x000008000
+ /**< Don't use measurement if bit is set */
+}Gnss_LocSvMeasStatusMaskType;
+
+typedef struct
+{
+ size_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 struct
+{
+ size_t size;
+ uint16_t gnssSvId;
+ /**< GNSS SV ID.
+ \begin{itemize1}
+ \item Range: \begin{itemize1}
+ \item For GPS: 1 to 32
+ \item For GLONASS: 1 to 32
+ \item For SBAS: 120 to 151
+ \item For BDS: 201 to 237
+ \end{itemize1} \end{itemize1}
+ The GPS and GLONASS SVs can be disambiguated using the system field.
+ */
+ 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
+ @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
+ */
+} Gnss_SVMeasurementStructType;
+
+/**< Maximum number of satellites in measurement block for given system. */
+
+typedef struct
+{
+ size_t size;
+ Gnss_LocSvSystemEnumType system;
+ /**< Specifies the Satellite System Type
+ */
+ bool isSystemTimeValid;
+ /**< Indicates whether System Time is Valid:\n
+ - 0x01 (TRUE) -- System Time is valid \n
+ - 0x00 (FALSE) -- System Time is not valid
+ */
+ Gnss_LocSystemTimeStructType systemTime;
+ /**< System Time Information \n
+ */
+ bool isGloTime_valid;
+ Gnss_LocGloTimeStructType gloTime;
+
+ bool isSystemTimeExt_valid;
+ Gnss_LocGnssTimeExtStructType systemTimeExt;
+
+ uint8_t numSvs;
+ /* Number of SVs in this report block */
+
+ Gnss_SVMeasurementStructType svMeasurement[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE];
+ /**< Satellite measurement Information \n
+ */
+} Gnss_ClockMeasurementStructType;
+
+
+typedef struct
+{
+ size_t size;
+ uint8_t seqNum;
+ /**< Current message Number */
+ uint8_t maxMessageNum;
+ /**< Maximum number of message that will be sent for present time epoch. */
+
+ bool leapSecValid;
+ Gnss_LeapSecondInfoStructType leapSec;
+
+ Gnss_InterSystemBiasStructType gpsGloInterSystemBias;
+
+ Gnss_InterSystemBiasStructType gpsBdsInterSystemBias;
+
+ Gnss_InterSystemBiasStructType gpsGalInterSystemBias;
+
+ Gnss_InterSystemBiasStructType bdsGloInterSystemBias;
+
+ Gnss_InterSystemBiasStructType galGloInterSystemBias;
+
+ Gnss_InterSystemBiasStructType galBdsInterSystemBias;
+
+ bool clockFreqValid;
+ Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */
+ bool gnssMeasValid;
+ Gnss_ClockMeasurementStructType gnssMeas;
+ Gnss_ApTimeStampStructType timeStamp;
+
+} GnssSvMeasurementSet;
+
+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
+{
+ size_t size;
+ uint16_t gnssSvId;
+ /* GPS: 1-32, GLO: 65-96, 0: Invalid,
+ SBAS: 120-151, BDS:201-237,GAL:301 to 336
+ All others are reserved
+ */
+ int8_t freqNum;
+ /* Freq index, only valid if u_SysInd is GLO */
+
+ uint8_t svPolyFlags;
+ /* Indicate the validity of the elements
+ as per Gnss_SvPolyStatusMaskType
+ */
+
+ 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 */
+} GnssSvPolynomial;
+
+/* 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
+{
+ size_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;
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* GPS_EXTENDED_C_H */
diff --git a/msm8998/utils/linked_list.c b/msm8998/utils/linked_list.c
new file mode 100644
index 0000000..2c2e686
--- /dev/null
+++ b/msm8998/utils/linked_list.c
@@ -0,0 +1,327 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include <platform_lib_includes.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+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*))
+{
+ //LOC_LOGV("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, 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;
+ 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)
+{
+ //LOC_LOGV("%s: Removing from list\n", __FUNCTION__);
+ 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)
+{
+ //LOC_LOGV("%s: Search the list\n", __FUNCTION__);
+ 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/msm8998/utils/linked_list.h b/msm8998/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/msm8998/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/msm8998/utils/loc_cfg.cpp b/msm8998/utils/loc_cfg.cpp
new file mode 100644
index 0000000..926781a
--- /dev/null
+++ b/msm8998/utils/loc_cfg.cpp
@@ -0,0 +1,400 @@
+/* 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 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_NDDEBUG 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 <loc_cfg.h>
+#include <platform_lib_includes.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint32_t DEBUG_LEVEL = 0xff;
+static uint32_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, 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;
+
+/*===========================================================================
+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 + 1);
+ }
+ /* 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, "=", &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;
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ 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);
+}
diff --git a/msm8998/utils/loc_cfg.h b/msm8998/utils/loc_cfg.h
new file mode 100644
index 0000000..9045e1d
--- /dev/null
+++ b/msm8998/utils/loc_cfg.h
@@ -0,0 +1,91 @@
+/* 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 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>
+
+#define LOC_MAX_PARAM_NAME 80
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING)
+
+#define 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;
+ uint8_t *param_set; /* was this value set by config file? */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for float */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/msm8998/utils/loc_gps.h b/msm8998/utils/loc_gps.h
new file mode 100644
index 0000000..2e495b8
--- /dev/null
+++ b/msm8998/utils/loc_gps.h
@@ -0,0 +1,2205 @@
+/*
+ * 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
+
+/** 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_CELLDB_INFO 0x8000
+#define LOC_GPS_DELETE_ALL 0xFFFF
+
+/** AGPS type */
+typedef uint16_t LocAGpsType;
+#define LOC_AGPS_TYPE_SUPL 1
+#define LOC_AGPS_TYPE_C2K 2
+
+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 uint16_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) */
+ size_t size;
+ /** Contains LocGpsLocationFlags bits. */
+ uint16_t flags;
+ /** 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 speed in meters per second. */
+ float speed;
+ /** Represents heading in degrees. */
+ float bearing;
+ /** Represents expected accuracy in meters. */
+ float accuracy;
+ /** Timestamp for the location fix. */
+ LocGpsUtcTime timestamp;
+} 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/msm8998/utils/loc_log.cpp b/msm8998/utils/loc_log.cpp
new file mode 100644
index 0000000..49136ef
--- /dev/null
+++ b/msm8998/utils/loc_log.cpp
@@ -0,0 +1,239 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#include <platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+static const loc_name_val_s_type target_name[] =
+{
+ NAME_VAL(GNSS_NONE),
+ NAME_VAL(GNSS_MSM),
+ NAME_VAL(GNSS_GSS),
+ NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_QCA1530),
+ NAME_VAL(GNSS_AUTO),
+ NAME_VAL(GNSS_UNKNOWN)
+};
+
+static const size_t target_name_num = LOC_TABLE_SIZE(target_name);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ static char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index < 0 || (unsigned)index >= target_name_num )
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ snprintf(ret, sizeof(ret), " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ snprintf(ret, sizeof(ret), " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/msm8998/utils/loc_log.h b/msm8998/utils/loc_log.h
new file mode 100644
index 0000000..be492b1
--- /dev/null
+++ b/msm8998/utils/loc_log.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#ifndef LOC_LOG_H
+#define LOC_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ const char *name;
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#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]))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask);
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, size_t buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/msm8998/utils/loc_misc_utils.cpp b/msm8998/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..dfe19a2
--- /dev/null
+++ b/msm8998/utils/loc_misc_utils.cpp
@@ -0,0 +1,114 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#include <stdio.h>
+#include <string.h>
+#include <platform_lib_log_util.h>
+#include <loc_misc_utils.h>
+#include <ctype.h>
+
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+
+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;
+}
diff --git a/msm8998/utils/loc_misc_utils.h b/msm8998/utils/loc_misc_utils.h
new file mode 100644
index 0000000..7d66d84
--- /dev/null
+++ b/msm8998/utils/loc_misc_utils.h
@@ -0,0 +1,99 @@
+/* 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/msm8998/utils/loc_nmea.cpp b/msm8998/utils/loc_nmea.cpp
new file mode 100644
index 0000000..9fbed98
--- /dev/null
+++ b/msm8998/utils/loc_nmea.cpp
@@ -0,0 +1,1106 @@
+/* Copyright (c) 2012-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_NDDEBUG 0
+#define LOG_TAG "LocSvc_nmea"
+#include <loc_nmea.h>
+#include <math.h>
+#include <platform_lib_includes.h>
+
+#define GLONASS_SV_ID_OFFSET 64
+#define MAX_SATELLITES_IN_USE 12
+
+// GNSS system id according to NMEA spec
+#define SYSTEM_ID_GPS 1
+#define SYSTEM_ID_GLONASS 2
+#define SYSTEM_ID_GALILEO 3
+// Extended systems
+#define SYSTEM_ID_BEIDOU 4
+#define SYSTEM_ID_QZSS 5
+
+typedef struct loc_nmea_sv_meta_s
+{
+ char talker[3];
+ LocGnssConstellationType svType;
+ uint32_t mask;
+ uint32_t svCount;
+ uint32_t svIdOffset;
+ uint32_t systemId;
+} loc_nmea_sv_meta;
+
+typedef struct loc_sv_cache_info_s
+{
+ uint32_t gps_used_mask;
+ uint32_t glo_used_mask;
+ uint32_t gal_used_mask;
+ uint32_t qzss_used_mask;
+ uint32_t bds_used_mask;
+ uint32_t gps_count;
+ uint32_t glo_count;
+ uint32_t gal_count;
+ uint32_t qzss_count;
+ uint32_t bds_count;
+ float hdop;
+ float pdop;
+ float vdop;
+} loc_sv_cache_info;
+
+static loc_sv_cache_info sv_cache_info;
+
+/*===========================================================================
+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,
+ GnssSvType svType,
+ 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.svCount = sv_cache_info.gps_count;
+ sv_meta.systemId = SYSTEM_ID_GPS;
+ 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;
+ sv_meta.svCount = sv_cache_info.glo_count;
+ // GLONASS SV ids are from 65-96
+ sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET;
+ sv_meta.systemId = SYSTEM_ID_GLONASS;
+ 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;
+ sv_meta.svCount = sv_cache_info.gal_count;
+ sv_meta.systemId = SYSTEM_ID_GALILEO;
+ break;
+ case GNSS_SV_TYPE_QZSS:
+ sv_meta.talker[0] = 'P';
+ sv_meta.talker[1] = 'Q';
+ sv_meta.mask = sv_cache_info.qzss_used_mask;
+ sv_meta.svCount = sv_cache_info.qzss_count;
+ // QZSS SV ids are from 193-197. So keep svIdOffset 0
+ sv_meta.systemId = SYSTEM_ID_QZSS;
+ break;
+ case GNSS_SV_TYPE_BEIDOU:
+ sv_meta.talker[0] = 'P';
+ sv_meta.talker[1] = 'Q';
+ sv_meta.mask = sv_cache_info.bds_used_mask;
+ sv_meta.svCount = sv_cache_info.bds_count;
+ // BDS SV ids are from 201-235. So keep svIdOffset 0
+ sv_meta.systemId = SYSTEM_ID_BEIDOU;
+ break;
+ default:
+ LOC_LOGE("NMEA Error unknow constellation type: %d", svType);
+ return NULL;
+ }
+ 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) > 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[32] = {0};
+
+ char fixType = '\0';
+
+ const char* talker = sv_meta_p->talker;
+ uint32_t svIdOffset = sv_meta_p->svIdOffset;
+ uint32_t mask = sv_meta_p->mask;
+
+ for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++)
+ {
+ if (mask & 1)
+ svUsedList[svUsedCount++] = i + svIdOffset;
+ mask = mask >> 1;
+ }
+
+ if (svUsedCount == 0 && GNSS_SV_TYPE_GPS != sv_meta_p->svType)
+ return 0;
+
+ if (svUsedCount == 0)
+ fixType = '1'; // no fix
+ else if (svUsedCount <= 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*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
+ // 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
+ - $GNGSV: 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)
+ {
+ // no svs in view, so just send a blank $--GSV sentence
+ snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,", talker);
+ length = loc_nmea_put_checksum(sentence, bufSize);
+ nmeaArraystr.push_back(sentence);
+ return;
+ }
+
+ 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++)
+ {
+ if (sv_meta_p->svType == svNotify.gnssSvs[svNumber - 1].type)
+ {
+ 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++;
+ }
+
+ }
+
+ // The following entries are specific to QZSS and BDS
+ if ((sv_meta_p->svType == GNSS_SV_TYPE_QZSS) ||
+ (sv_meta_p->svType == GNSS_SV_TYPE_BEIDOU))
+ {
+ // last one is System id and second last is Signal Id which is always zero
+ length = snprintf(pMarker, lengthRemaining,",%d,%d",0,sv_meta_p->systemId);
+ pMarker += length;
+ lengthRemaining -= length;
+ }
+
+ length = loc_nmea_put_checksum(sentence, bufSize);
+ nmeaArraystr.push_back(sentence);
+ sentenceNumber++;
+
+ } //while
+}
+
+/*===========================================================================
+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,
+ unsigned char generate_nmea,
+ std::vector<std::string> &nmeaArraystr)
+{
+ ENTRY_LOG();
+ time_t utcTime(location.gpsLocation.timestamp/1000);
+ tm * pTm = gmtime(&utcTime);
+ if (NULL == pTm) {
+ LOC_LOGE("gmtime failed");
+ return;
+ }
+
+ char sentence[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;
+
+ 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, GNSS_SV_TYPE_GPS, 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, GNSS_SV_TYPE_GLONASS, 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, GNSS_SV_TYPE_GALILEO, true), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ talker[0] = sv_meta.talker[0];
+ talker[1] = sv_meta.talker[1];
+ }
+
+ // --------------------------
+ // ---$PQGSA/$GNGSA (QZSS)---
+ // --------------------------
+
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ // talker should be default "GP". If GPS, GLO etc is used, it should be "GN"
+ }
+
+ // ----------------------------
+ // ---$PQGSA/$GNGSA (BEIDOU)---
+ // ----------------------------
+ count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr);
+ if (count > 0)
+ {
+ svUsedCount += count;
+ // talker should be default "GP". If GPS, GLO etc is used, it should be "GN"
+ }
+
+ // -------------------
+ // ------$--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;
+
+ if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
+ // N means no fix
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N');
+ else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
+ // D means differential
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D');
+ else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
+ // E means estimated (dead reckoning)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'E');
+ else // A means autonomous
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A');
+
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ // -------------------
+ // ------$--RMC-------
+ // -------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A," ,
+ 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 = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
+ // N means no fix
+ length = snprintf(pMarker, lengthRemaining, "%c", 'N');
+ else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
+ // D means differential
+ length = snprintf(pMarker, lengthRemaining, "%c", 'D');
+ else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
+ // E means estimated (dead reckoning)
+ length = snprintf(pMarker, lengthRemaining, "%c", 'E');
+ else // A means autonomous
+ length = snprintf(pMarker, lengthRemaining, "%c", 'A');
+
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ // -------------------
+ // ------$--GGA-------
+ // -------------------
+
+ pMarker = sentence;
+ lengthRemaining = sizeof(sentence);
+
+ 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 = location.gpsLocation.latitude;
+ double longitude = location.gpsLocation.longitude;
+ 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;
+
+ char gpsQuality;
+ if (!(location.gpsLocation.flags & LOC_GPS_LOCATION_HAS_LAT_LONG))
+ gpsQuality = '0'; // 0 means no fix
+ else if (LOC_NAV_MASK_SBAS_CORRECTION_IONO & locationExtended.navSolutionMask)
+ gpsQuality = '2'; // 2 means DGPS fix
+ else if (LOC_POS_TECH_MASK_SENSORS == locationExtended.tech_mask)
+ gpsQuality = '6'; // 6 means estimated (dead reckoning)
+ else
+ gpsQuality = '1'; // 1 means GPS fix
+
+ // 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, "%c,%02d,%.1f,",
+ gpsQuality, svUsedCount, locationExtended.hdop);
+ }
+ else
+ { // no hdop
+ length = snprintf(pMarker, lengthRemaining, "%c,%02d,,",
+ gpsQuality, 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,,",
+ location.gpsLocation.altitude - locationExtended.altitudeMeanSeaLevel);
+ }
+ else
+ {
+ length = snprintf(pMarker, lengthRemaining,",,,");
+ }
+
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ // clear the cache so they can't be used again
+ sv_cache_info.gps_used_mask = 0;
+ sv_cache_info.glo_used_mask = 0;
+ sv_cache_info.gal_used_mask = 0;
+ sv_cache_info.qzss_used_mask = 0;
+ sv_cache_info.bds_used_mask = 0;
+ }
+ //Send blank NMEA reports for non-final fixes
+ else {
+ strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$GNGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence));
+ length = loc_nmea_put_checksum(sentence, sizeof(sentence));
+ nmeaArraystr.push_back(sentence);
+
+ strlcpy(sentence, "$PQGSA,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, "$GPRMC,,V,,,,,,,,,,N", 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};
+ char* pMarker = sentence;
+ int lengthRemaining = sizeof(sentence);
+ int length = 0;
+ int svCount = svNotify.count;
+ int sentenceCount = 0;
+ int sentenceNumber = 1;
+ int svNumber = 1;
+
+ //Count GPS SVs for saparating GPS from GLONASS and throw others
+
+ sv_cache_info.gps_used_mask = 0;
+ sv_cache_info.glo_used_mask = 0;
+ sv_cache_info.gal_used_mask = 0;
+ sv_cache_info.qzss_used_mask = 0;
+ sv_cache_info.bds_used_mask = 0;
+
+ sv_cache_info.gps_count = 0;
+ sv_cache_info.glo_count = 0;
+ sv_cache_info.gal_count = 0;
+ sv_cache_info.qzss_count = 0;
+ sv_cache_info.bds_count = 0;
+ for(svNumber=1; svNumber <= svCount; svNumber++) {
+ if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svNumber - 1].type)
+ {
+ // 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[svNumber - 1].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ sv_cache_info.gps_used_mask |= (1 << (svNotify.gnssSvs[svNumber - 1].svId - 1));
+ }
+ sv_cache_info.gps_count++;
+ }
+ else if (GNSS_SV_TYPE_GLONASS == svNotify.gnssSvs[svNumber - 1].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[svNumber - 1].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ sv_cache_info.glo_used_mask |= (1 << (svNotify.gnssSvs[svNumber - 1].svId - 1));
+ }
+ sv_cache_info.glo_count++;
+ }
+ else if (GNSS_SV_TYPE_GALILEO == svNotify.gnssSvs[svNumber - 1].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[svNumber - 1].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ sv_cache_info.gal_used_mask |= (1 << (svNotify.gnssSvs[svNumber - 1].svId - 1));
+ }
+ sv_cache_info.gal_count++;
+ }
+ else if (GNSS_SV_TYPE_QZSS == svNotify.gnssSvs[svNumber - 1].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[svNumber - 1].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ sv_cache_info.qzss_used_mask |= (1 << (svNotify.gnssSvs[svNumber - 1].svId - 1));
+ }
+ sv_cache_info.qzss_count++;
+ }
+ else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svNumber - 1].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[svNumber - 1].gnssSvOptionsMask &
+ GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
+ {
+ sv_cache_info.bds_used_mask |= (1 << (svNotify.gnssSvs[svNumber - 1].svId - 1));
+ }
+ sv_cache_info.bds_count++;
+ }
+ }
+
+ loc_nmea_sv_meta sv_meta;
+ // ------------------
+ // ------$GPGSV------
+ // ------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GPS, false), nmeaArraystr);
+
+ // ------------------
+ // ------$GLGSV------
+ // ------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GLONASS, false), nmeaArraystr);
+
+ // ------------------
+ // ------$GAGSV------
+ // ------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GALILEO, false), nmeaArraystr);
+
+ // -------------------------
+ // ------$PQGSV (QZSS)------
+ // -------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
+
+ // ---------------------------
+ // ------$PQGSV (BEIDOU)------
+ // ---------------------------
+
+ loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
+ loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr);
+
+ EXIT_LOG(%d, 0);
+}
diff --git a/utils/loc_nmea.h b/msm8998/utils/loc_nmea.h
similarity index 100%
copy from utils/loc_nmea.h
copy to msm8998/utils/loc_nmea.h
diff --git a/msm8998/utils/loc_target.cpp b/msm8998/utils/loc_target.cpp
new file mode 100644
index 0000000..3722192
--- /dev/null
+++ b/msm8998/utils/loc_target.cpp
@@ -0,0 +1,287 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include <platform_lib_includes.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_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
+/* When system server is started, it uses 20 seconds as ActivityManager
+ * timeout. After that it sends SIGSTOP signal to process.
+ */
+#define QCA1530_DETECT_TIMEOUT 15
+#define QCA1530_DETECT_PRESENT "yes"
+#define QCA1530_DETECT_PROGRESS "detect"
+
+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);
+ len = len < line_size - 1? len : line_size - 1;
+ line[len] = '\0';
+ LOC_LOGD("cat %s: %s", file_path, line);
+ fclose(fp);
+ }
+ return result;
+}
+
+/*!
+ * \brief Checks if QCA1530 is avalable.
+ *
+ * Function verifies if qca1530 SoC is configured on the device. The test is
+ * based on property value. For 1530 scenario, the value shall be one of the
+ * following: "yes", "no", "detect". All other values are treated equally to
+ * "no". When the value is "detect" the system waits for SoC detection to
+ * finish before returning result.
+ *
+ * \retval true - QCA1530 is available.
+ * \retval false - QCA1530 is not available.
+ */
+static bool is_qca1530(void)
+{
+ static const char qca1530_property_name[] = "sys.qca1530";
+ bool res = false;
+ int ret, i;
+ char buf[PROPERTY_VALUE_MAX];
+
+ memset(buf, 0, sizeof(buf));
+
+ for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
+ {
+ ret = platform_lib_abstraction_property_get(qca1530_property_name, buf, NULL);
+ if (ret < 0)
+ {
+ LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
+ qca1530_property_name,
+ ret);
+
+ break;
+ }
+
+ LOC_LOGV( "qca1530: property %s is set to %s",
+ qca1530_property_name,
+ buf);
+
+ if (!memcmp(buf, QCA1530_DETECT_PRESENT,
+ sizeof(QCA1530_DETECT_PRESENT)))
+ {
+ res = true;
+ break;
+ }
+ if (!memcmp(buf, QCA1530_DETECT_PROGRESS,
+ sizeof(QCA1530_DETECT_PROGRESS)))
+ {
+ LOC_LOGV("qca1530: SoC detection is in progress.");
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+
+ LOC_LOGD("qca1530: detected=%s", res ? "true" : "false");
+ return res;
+}
+
+/*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__);
+ }
+}
+
+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 id[] = "/sys/devices/soc0/soc_id";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
+ static const char mdm[] = "/dev/mdm"; // No such file or directory
+
+ 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];
+
+ if (is_qca1530()) {
+ gTarget = TARGET_QCA1530;
+ goto detected;
+ }
+
+ 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);
+ }
+ if (!access(id, F_OK)) {
+ read_a_line(id, rd_id, LINE_LEN);
+ } else {
+ read_a_line(id_dep, rd_id, LINE_LEN);
+ }
+
+ /*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)) ){
+
+ 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)]))) {
+
+ if (!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
+ gTarget = TARGET_UNKNOWN;
+ }
+
+detected:
+ LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
+ return gTarget;
+}
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target
+*/
+int loc_identify_lean_target()
+{
+ int ret = 0;
+ char lean_target[PROPERTY_VALUE_MAX];
+ property_get("ro.lean", lean_target, "");
+ LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
+ return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
+}
diff --git a/msm8998/utils/loc_target.h b/msm8998/utils/loc_target.h
new file mode 100644
index 0000000..69395db
--- /dev/null
+++ b/msm8998/utils/loc_target.h
@@ -0,0 +1,86 @@
+/* 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_QCA1530 TARGET_SET(GNSS_QCA1530, 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);
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target*/
+int loc_identify_lean_target();
+
+/* Please remember to update 'target_name' in loc_log.cpp,
+ if do any changes to this enum. */
+typedef enum {
+ GNSS_NONE = 0,
+ GNSS_MSM,
+ GNSS_GSS,
+ GNSS_MDM,
+ GNSS_QCA1530,
+ 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/msm8998/utils/loc_timer.h b/msm8998/utils/loc_timer.h
new file mode 100644
index 0000000..25fd179
--- /dev/null
+++ b/msm8998/utils/loc_timer.h
@@ -0,0 +1,73 @@
+/* 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 <platform_lib_includes.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/msm8998/utils/log_util.h b/msm8998/utils/log_util.h
new file mode 100644
index 0000000..7eb338a
--- /dev/null
+++ b/msm8998/utils/log_util.h
@@ -0,0 +1,173 @@
+/* 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__
+
+#ifndef USE_GLIB
+#include <utils/Log.h>
+#endif /* USE_GLIB */
+
+#ifdef USE_GLIB
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#endif /* USE_GLIB */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+extern const char EXIT_ERROR_TAG[];
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
+#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
+#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
+#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
+#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE(__VA_ARGS__)
+#define LOC_LOGW(...) ALOGW(__VA_ARGS__)
+#define LOC_LOGI(...) ALOGI(__VA_ARGS__)
+#define LOC_LOGD(...) ALOGD(__VA_ARGS__)
+#define LOC_LOGV(...) ALOGV(__VA_ARGS__)
+
+#endif /* DEBUG_DMN_LOC_API */
+
+/*=============================================================================
+ *
+ * LOGGING IMPROVEMENT MACROS
+ *
+ *============================================================================*/
+#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \
+ do { \
+ if (loc_logger.TIMESTAMP) { \
+ char ts[32]; \
+ LOC_LOG("[%s] %s %s line %d " #SPEC, \
+ get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \
+ } else { \
+ LOC_LOG("%s %s line %d " #SPEC, \
+ ID, WHAT, __LINE__, VAL); \
+ } \
+ } while(0)
+
+#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
+#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
+#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
+#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
+
+#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
+#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
+ if (VAL != 0) { \
+ LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \
+ } else { \
+ LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \
+ }
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow to Android Framework
+#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __LOG_UTIL_H__
diff --git a/msm8998/utils/msg_q.c b/msm8998/utils/msg_q.c
new file mode 100644
index 0000000..7e0ac2c
--- /dev/null
+++ b/msm8998/utils/msg_q.c
@@ -0,0 +1,335 @@
+/* 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.
+ */
+
+#include "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include <platform_lib_includes.h>
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+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 = 0x%08X\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 = 0x%08X\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;
+
+ //LOC_LOGV("%s: Waiting on message\n", __FUNCTION__);
+
+ 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 0x%08X 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/msm8998/utils/msg_q.h b/msm8998/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/msm8998/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/utils/platform_lib_abstractions/Android.mk b/msm8998/utils/platform_lib_abstractions/Android.mk
similarity index 100%
rename from utils/platform_lib_abstractions/Android.mk
rename to msm8998/utils/platform_lib_abstractions/Android.mk
diff --git a/msm8998/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/msm8998/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/utils/platform_lib_abstractions/loc_pla/Android.mk b/msm8998/utils/platform_lib_abstractions/loc_pla/Android.mk
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/Android.mk
copy to msm8998/utils/platform_lib_abstractions/loc_pla/Android.mk
diff --git a/utils/platform_lib_abstractions/loc_pla/Makefile.am b/msm8998/utils/platform_lib_abstractions/loc_pla/Makefile.am
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/Makefile.am
copy to msm8998/utils/platform_lib_abstractions/loc_pla/Makefile.am
diff --git a/utils/platform_lib_abstractions/loc_pla/configure.ac b/msm8998/utils/platform_lib_abstractions/loc_pla/configure.ac
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/configure.ac
copy to msm8998/utils/platform_lib_abstractions/loc_pla/configure.ac
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
rename to msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
rename to msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
new file mode 100644
index 0000000..26d3c29
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
@@ -0,0 +1,174 @@
+/* Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_LOG_UTIL_H__
+#define __PLATFORM_LIB_LOG_UTIL_H__
+
+#include "platform_lib_macros.h"
+
+#ifndef USE_GLIB
+#include <log_util.h>
+#else
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+#endif /* LOG_TAG */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*=============================================================================
+ *
+ * LOC LOGGER TYPE DECLARATION
+ *
+ *============================================================================*/
+/* LOC LOGGER */
+typedef struct loc_logger_s
+{
+ unsigned long DEBUG_LEVEL;
+ unsigned long TIMESTAMP;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+extern const char EXIT_ERROR_TAG[];
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+void loc_logger_init(unsigned long debug, unsigned long timestamp);
+char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
+#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
+#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
+#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
+#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE(__VA_ARGS__)
+#define LOC_LOGW(...) ALOGW(__VA_ARGS__)
+#define LOC_LOGI(...) ALOGI(__VA_ARGS__)
+#define LOC_LOGD(...) ALOGD(__VA_ARGS__)
+#define LOC_LOGV(...) ALOGV(__VA_ARGS__)
+
+#endif /* DEBUG_DMN_LOC_API */
+
+/*=============================================================================
+ *
+ * LOGGING IMPROVEMENT MACROS
+ *
+ *============================================================================*/
+#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \
+ do { \
+ if (loc_logger.TIMESTAMP) { \
+ char ts[32]; \
+ LOC_LOG("[%s] %s %s line %d " #SPEC, \
+ get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \
+ } else { \
+ LOC_LOG("%s %s line %d " #SPEC, \
+ ID, WHAT, __LINE__, VAL); \
+ } \
+ } while(0)
+
+#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
+#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
+#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
+#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
+
+#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
+#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
+ if (VAL != 0) { \
+ LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \
+ } else { \
+ LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \
+ }
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow to Android Framework
+#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* USE_GLIB */
+
+#endif /* __PLATFORM_LIB_LOG_UTIL_H__ */
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
new file mode 100644
index 0000000..d0795eb
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
@@ -0,0 +1,85 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef USE_GLIB
+#include <sys/time.h>
+#include <string.h>
+#include <stdlib.h>
+#ifndef OFF_TARGET
+#include <glib.h>
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+#else
+#define strlcat strncat
+#define strlcpy strncpy
+#endif
+
+#define TS_PRINTF(format, x...) \
+{ \
+ struct timeval tv; \
+ struct timezone tz; \
+ int hh, mm, ss; \
+ gettimeofday(&tv, &tz); \
+ hh = tv.tv_sec/3600%24; \
+ mm = (tv.tv_sec%3600)/60; \
+ ss = tv.tv_sec%60; \
+ fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \
+}
+
+#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x)
+#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x)
+#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x)
+#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x)
+#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x)
+
+#endif /* USE_GLIB */
+
+
+// Below are the location conf file paths
+extern const char LOC_PATH_GPS_CONF[];
+extern const char LOC_PATH_IZAT_CONF[];
+extern const char LOC_PATH_FLP_CONF[];
+extern const char LOC_PATH_LOWI_CONF[];
+extern const char LOC_PATH_SAP_CONF[];
+extern const char LOC_PATH_APDR_CONF[];
+extern const char LOC_PATH_XTWIFI_CONF[];
+extern const char LOC_PATH_QUIPC_CONF[];
+
+
+#ifdef __cplusplus
+}
+#endif /*__cplusplus */
+
+#endif /* __PLATFORM_LIB_MACROS_H__ */
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
rename to msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
rename to msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
rename to msm8998/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/msm8998/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
new file mode 100644
index 0000000..1aad2f4
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: loc-pla
+Description: QTI GPS Location Platform Library Abstractions
+Version: @VERSION@
+Libs: -L${libdir} -lloc_pla
+Cflags: -I${includedir}/loc-pla
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/src/Android.mk b/msm8998/utils/platform_lib_abstractions/loc_pla/src/Android.mk
new file mode 100644
index 0000000..0d2afe7
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/src/Android.mk
@@ -0,0 +1,53 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_stub
+
+LOCAL_SRC_FILES += \
+ platform_lib_gettid.cpp \
+ platform_lib_log_util.cpp \
+ platform_lib_property_service.cpp \
+ platform_lib_sched_policy.cpp \
+ platform_lib_time.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -std=c++11
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/../include \
+ $(TARGET_OUT_HEADERS)/gps.utils \
+ $(TARGET_OUT_HEADERS)/libloc_stub
+
+LOCAL_COPY_HEADERS_TO:= libloc_pla/
+LOCAL_COPY_HEADERS:= \
+ ../include/platform_lib_gettid.h \
+ ../include/platform_lib_includes.h \
+ ../include/platform_lib_log_util.h \
+ ../include/platform_lib_macros.h \
+ ../include/platform_lib_property_service.h \
+ ../include/platform_lib_sched_policy.h \
+ ../include/platform_lib_time.h
+
+LOCAL_MODULE := libloc_pla
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_OWNER := qti
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/src/Makefile.am b/msm8998/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
new file mode 100644
index 0000000..6ee0be7
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
@@ -0,0 +1,41 @@
+AM_CFLAGS = \
+ $(LOCSTUB_CFLAGS) \
+ -I../include \
+ -D__func__=__PRETTY_FUNCTION__ \
+ -fno-short-enums
+
+h_sources = \
+ ../include/platform_lib_android_runtime.h \
+ ../include/platform_lib_gettid.h \
+ ../include/platform_lib_includes.h \
+ ../include/platform_lib_log_util.h \
+ ../include/platform_lib_macros.h \
+ ../include/platform_lib_property_service.h \
+ ../include/platform_lib_sched_policy.h \
+ ../include/platform_lib_time.h
+
+library_includedir = $(pkgincludedir)
+library_include_HEADERS = $(h_sources)
+
+libloc_pla_la_SOURCES = \
+ platform_lib_android_runtime.cpp \
+ platform_lib_gettid.cpp \
+ platform_lib_log_util.cpp \
+ platform_lib_property_service.cpp \
+ platform_lib_sched_policy.cpp \
+ platform_lib_time.cpp
+
+if USE_GLIB
+libloc_pla_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_pla_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_pla_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_pla_la_CFLAGS = $(AM_CFLAGS)
+libloc_pla_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_pla_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_pla_la_LIBADD = -lstdc++ -ldl -llog $(LOCSTUB_LIBS)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_pla.la
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
rename to msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
new file mode 100644
index 0000000..90bf26d
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
@@ -0,0 +1,81 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <cstdio>
+#include <sys/time.h>
+
+#include "platform_lib_log_util.h"
+#include "platform_lib_macros.h"
+
+char * get_timestamp(char *str, unsigned long buf_size)
+{
+ struct timeval tv;
+ struct timezone tz;
+ int hh, mm, ss;
+ gettimeofday(&tv, &tz);
+ hh = tv.tv_sec/3600%24;
+ mm = (tv.tv_sec%3600)/60;
+ ss = tv.tv_sec%60;
+ snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec);
+ return str;
+}
+
+// Below are the location conf file paths
+#ifdef __ANDROID__
+
+#define LOC_PATH_GPS_CONF_STR "/vendor/etc/gps.conf"
+#define LOC_PATH_IZAT_CONF_STR "/vendor/etc/izat.conf"
+#define LOC_PATH_FLP_CONF_STR "/vendor/etc/flp.conf"
+#define LOC_PATH_LOWI_CONF_STR "/vendor/etc/lowi.conf"
+#define LOC_PATH_SAP_CONF_STR "/vendor/etc/sap.conf"
+#define LOC_PATH_APDR_CONF_STR "/vendor/etc/apdr.conf"
+#define LOC_PATH_XTWIFI_CONF_STR "/vendor/etc/xtwifi.conf"
+#define LOC_PATH_QUIPC_CONF_STR "/vendor/etc/quipc.conf"
+
+#else
+
+#define LOC_PATH_GPS_CONF_STR "/etc/gps.conf"
+#define LOC_PATH_IZAT_CONF_STR "/etc/izat.conf"
+#define LOC_PATH_FLP_CONF_STR "/etc/flp.conf"
+#define LOC_PATH_LOWI_CONF_STR "/etc/lowi.conf"
+#define LOC_PATH_SAP_CONF_STR "/etc/sap.conf"
+#define LOC_PATH_APDR_CONF_STR "/etc/apdr.conf"
+#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf"
+#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf"
+
+#endif // __ANDROID__
+
+// Reference below arrays wherever needed to avoid duplicating
+// same conf path string over and again in location code.
+const char LOC_PATH_GPS_CONF[] = LOC_PATH_GPS_CONF_STR;
+const char LOC_PATH_IZAT_CONF[] = LOC_PATH_IZAT_CONF_STR;
+const char LOC_PATH_FLP_CONF[] = LOC_PATH_FLP_CONF_STR;
+const char LOC_PATH_LOWI_CONF[] = LOC_PATH_LOWI_CONF_STR;
+const char LOC_PATH_SAP_CONF[] = LOC_PATH_SAP_CONF_STR;
+const char LOC_PATH_APDR_CONF[] = LOC_PATH_APDR_CONF_STR;
+const char LOC_PATH_XTWIFI_CONF[] = LOC_PATH_XTWIFI_CONF_STR;
+const char LOC_PATH_QUIPC_CONF[] = LOC_PATH_QUIPC_CONF_STR;
diff --git a/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
new file mode 100644
index 0000000..1cc63ab
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
@@ -0,0 +1,39 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "platform_lib_property_service.h"
+
+#ifdef USE_GLIB
+#include <loc_stub_property_service.h>
+#else
+#include <cutils/properties.h>
+#endif /* USE_GLIB */
+
+int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value)
+{
+ return property_get(key, value, default_value);
+}
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
rename to msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp b/msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
rename to msm8998/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
diff --git a/utils/platform_lib_abstractions/loc_stub/Android.mk b/msm8998/utils/platform_lib_abstractions/loc_stub/Android.mk
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/Android.mk
copy to msm8998/utils/platform_lib_abstractions/loc_stub/Android.mk
diff --git a/utils/platform_lib_abstractions/loc_stub/Makefile.am b/msm8998/utils/platform_lib_abstractions/loc_stub/Makefile.am
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/Makefile.am
copy to msm8998/utils/platform_lib_abstractions/loc_stub/Makefile.am
diff --git a/utils/platform_lib_abstractions/loc_stub/configure.ac b/msm8998/utils/platform_lib_abstractions/loc_stub/configure.ac
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/configure.ac
copy to msm8998/utils/platform_lib_abstractions/loc_stub/configure.ac
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h b/msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
rename to msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h b/msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
rename to msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h b/msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
rename to msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h b/msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
rename to msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h b/msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
rename to msm8998/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
diff --git a/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in b/msm8998/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
copy to msm8998/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
diff --git a/msm8998/utils/platform_lib_abstractions/loc_stub/src/Android.mk b/msm8998/utils/platform_lib_abstractions/loc_stub/src/Android.mk
new file mode 100644
index 0000000..0b1132c
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_stub/src/Android.mk
@@ -0,0 +1,52 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog
+
+LOCAL_SRC_FILES += \
+ loc_stub_android_runtime.cpp \
+ loc_stub_gettid.cpp \
+ loc_stub_property_service.cpp \
+ loc_stub_sched_policy.cpp \
+ loc_stub_time.cpp
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -D_ANDROID_ \
+ -std=c++11
+
+
+LOCAL_LDFLAGS += -Wl,--export-dynamic
+
+## Includes
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/../include \
+
+
+LOCAL_COPY_HEADERS_TO:= libloc_stub/
+LOCAL_COPY_HEADERS:= \
+ ../include/loc_stub_android_runtime.h \
+ ../include/loc_stub_gettid.h \
+ ../include/loc_stub_property_service.h \
+ ../include/loc_stub_sched_policy.h \
+ ../include/loc_stub_time.h
+
+LOCAL_MODULE := libloc_stub
+LOCAL_VENDOR_MODULE := true
+LOCAL_MODULE_OWNER := qti
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/msm8998/utils/platform_lib_abstractions/loc_stub/src/Makefile.am b/msm8998/utils/platform_lib_abstractions/loc_stub/src/Makefile.am
new file mode 100644
index 0000000..8bda711
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_stub/src/Makefile.am
@@ -0,0 +1,40 @@
+AM_CFLAGS = \
+ -I../include \
+ -D__func__=__PRETTY_FUNCTION__ \
+ -fno-short-enums
+
+libloc_stub_la_extra_h = \
+ ../include/utils/Log.h
+
+libloc_stub_la_c_sources = \
+ loc_stub_android_runtime.cpp \
+ loc_stub_gettid.cpp \
+ loc_stub_property_service.cpp \
+ loc_stub_sched_policy.cpp \
+ loc_stub_time.cpp
+
+libloc_stub_la_SOURCES = $(libloc_stub_la_c_sources) $(libloc_stub_la_extra_h)
+
+library_include_HEADERS = \
+ ../include/loc_stub_android_runtime.h \
+ ../include/loc_stub_gettid.h \
+ ../include/loc_stub_property_service.h \
+ ../include/loc_stub_sched_policy.h \
+ ../include/loc_stub_time.h
+
+library_includedir = $(pkgincludedir)
+
+if USE_GLIB
+libloc_stub_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libloc_stub_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libloc_stub_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libloc_stub_la_CFLAGS = $(AM_CFLAGS)
+libloc_stub_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
+libloc_stub_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libloc_stub_la_LIBADD = -lstdc++ -ldl -llog
+
+#Create and Install libraries
+lib_LTLIBRARIES = libloc_stub.la
diff --git a/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
new file mode 100644
index 0000000..1db69b2
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
@@ -0,0 +1,41 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "loc_stub_android_runtime.h"
+
+namespace android {
+
+pthread_t AndroidRuntime::createJavaThread(const char* name,
+ void (*start)(void *), void* arg)
+{
+ pthread_t threadId = 0;
+ pthread_create(&threadId, NULL, (void *(*)(void*))start, arg);
+ return threadId;
+}
+
+}
diff --git a/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
rename to msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
diff --git a/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
new file mode 100644
index 0000000..f9d9e3e
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
@@ -0,0 +1,42 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "loc_stub_property_service.h"
+#include <stdio.h>
+#include <string.h>
+
+int property_get(const char *key, char * value, const char *default_value)
+{
+ /* This will disable gps interface
+ value[0] = '1';
+ */
+ if (strcmp(key, "ro.baseband") == 0) {
+ memcpy(value, "msm", 4);
+ }
+ return 0;
+}
diff --git a/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
new file mode 100644
index 0000000..781be29
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
@@ -0,0 +1,50 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "loc_stub_sched_policy.h"
+
+/*===========================================================================
+FUNCTION set_sched_policy
+
+DESCRIPTION
+ Local copy of this function which bypasses android set_sched_policy
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int set_sched_policy(int tid, SchedPolicy policy)
+{
+ return 0;
+}
diff --git a/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
new file mode 100644
index 0000000..499cf00
--- /dev/null
+++ b/msm8998/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
@@ -0,0 +1,55 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "loc_stub_time.h"
+#include <stdlib.h>
+#include <sys/time.h>
+#include <time.h>
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+int64_t elapsedMicrosSinceBoot()
+{
+ struct timespec ts;
+ int64_t time_ms = 0;
+ clock_gettime(CLOCK_BOOTTIME, &ts);
+ time_ms += (ts.tv_sec * 1000000000LL); /* Seconds to nanoseconds */
+ time_ms += ts.tv_nsec; /* Add Nanoseconds */
+ return time_ms;
+}
+
+int64_t elapsedMillisSinceBoot()
+{
+ return (int64_t) (elapsedMicrosSinceBoot() /1000000LL);
+}
diff --git a/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/platform_lib_abstractions/elapsed_millis_since_boot.cpp
new file mode 100644
index 0000000..e8cb93a
--- /dev/null
+++ b/platform_lib_abstractions/elapsed_millis_since_boot.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include <sys/time.h>
+#include "platform_lib_time.h"
+
+int64_t systemTime(int clock)
+{
+ struct timeval t;
+ t.tv_sec = t.tv_usec = 0;
+ gettimeofday(&t, NULL);
+ return t.tv_sec*1000000LL + t.tv_usec;
+}
+
+
+int64_t elapsedMillisSinceBoot()
+{
+ int64_t t_us = systemTime(0);
+ return (int64_t) t_us / 1000LL;
+}
diff --git a/platform_lib_abstractions/platform_lib_includes.h b/platform_lib_abstractions/platform_lib_includes.h
new file mode 100644
index 0000000..5858674
--- /dev/null
+++ b/platform_lib_abstractions/platform_lib_includes.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_INCLUDES_H_
+#define _PLATFORM_LIB_INCLUDES_H_
+
+#include "platform_lib_time.h"
+#include "platform_lib_macros.h"
+
+#endif
diff --git a/platform_lib_abstractions/platform_lib_macros.h b/platform_lib_abstractions/platform_lib_macros.h
new file mode 100644
index 0000000..bc48dd9
--- /dev/null
+++ b/platform_lib_abstractions/platform_lib_macros.h
@@ -0,0 +1,81 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PLATFORM_LIB_MACROS_H__
+#define __PLATFORM_LIB_MACROS_H__
+
+#include <sys/time.h>
+
+#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); \
+}
+
+
+#ifdef USE_GLIB
+
+#define strlcat g_strlcat
+#define strlcpy g_strlcpy
+
+#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)
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid))
+
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot())
+
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+pid_t gettid(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid())
+#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread
+#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime())
+
+#endif
+
+#endif
diff --git a/platform_lib_abstractions/platform_lib_time.h b/platform_lib_abstractions/platform_lib_time.h
new file mode 100644
index 0000000..ce013af
--- /dev/null
+++ b/platform_lib_abstractions/platform_lib_time.h
@@ -0,0 +1,35 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _PLATFORM_LIB_TIME_H_
+#define _PLATFORM_LIB_TIME_H_
+
+int64_t systemTime(int clock);
+int64_t elapsedMillisSinceBoot();
+
+#endif
diff --git a/sdm845/Android.mk b/sdm845/Android.mk
new file mode 100644
index 0000000..e2c5a56
--- /dev/null
+++ b/sdm845/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/sdm845/CleanSpec.mk b/sdm845/CleanSpec.mk
new file mode 100644
index 0000000..dd1849d
--- /dev/null
+++ b/sdm845/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/sdm845/Makefile.am b/sdm845/Makefile.am
new file mode 100644
index 0000000..f64790e
--- /dev/null
+++ b/sdm845/Makefile.am
@@ -0,0 +1,10 @@
+# Makefile.am - Automake script for gps loc_api
+#
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = core location gnss
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = loc-hal.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/android/AGnss.cpp b/sdm845/android/AGnss.cpp
similarity index 100%
rename from android/AGnss.cpp
rename to sdm845/android/AGnss.cpp
diff --git a/android/AGnss.h b/sdm845/android/AGnss.h
similarity index 100%
rename from android/AGnss.h
rename to sdm845/android/AGnss.h
diff --git a/android/AGnssRil.cpp b/sdm845/android/AGnssRil.cpp
similarity index 100%
rename from android/AGnssRil.cpp
rename to sdm845/android/AGnssRil.cpp
diff --git a/android/AGnssRil.h b/sdm845/android/AGnssRil.h
similarity index 100%
rename from android/AGnssRil.h
rename to sdm845/android/AGnssRil.h
diff --git a/android/Android.mk b/sdm845/android/Android.mk
similarity index 100%
rename from android/Android.mk
rename to sdm845/android/Android.mk
diff --git a/android/Gnss.cpp b/sdm845/android/Gnss.cpp
similarity index 100%
rename from android/Gnss.cpp
rename to sdm845/android/Gnss.cpp
diff --git a/android/Gnss.h b/sdm845/android/Gnss.h
similarity index 100%
rename from android/Gnss.h
rename to sdm845/android/Gnss.h
diff --git a/android/GnssBatching.cpp b/sdm845/android/GnssBatching.cpp
similarity index 100%
rename from android/GnssBatching.cpp
rename to sdm845/android/GnssBatching.cpp
diff --git a/android/GnssBatching.h b/sdm845/android/GnssBatching.h
similarity index 100%
rename from android/GnssBatching.h
rename to sdm845/android/GnssBatching.h
diff --git a/android/GnssConfiguration.cpp b/sdm845/android/GnssConfiguration.cpp
similarity index 100%
rename from android/GnssConfiguration.cpp
rename to sdm845/android/GnssConfiguration.cpp
diff --git a/android/GnssConfiguration.h b/sdm845/android/GnssConfiguration.h
similarity index 100%
rename from android/GnssConfiguration.h
rename to sdm845/android/GnssConfiguration.h
diff --git a/android/GnssDebug.cpp b/sdm845/android/GnssDebug.cpp
similarity index 100%
rename from android/GnssDebug.cpp
rename to sdm845/android/GnssDebug.cpp
diff --git a/android/GnssDebug.h b/sdm845/android/GnssDebug.h
similarity index 100%
rename from android/GnssDebug.h
rename to sdm845/android/GnssDebug.h
diff --git a/android/GnssGeofencing.cpp b/sdm845/android/GnssGeofencing.cpp
similarity index 100%
rename from android/GnssGeofencing.cpp
rename to sdm845/android/GnssGeofencing.cpp
diff --git a/android/GnssGeofencing.h b/sdm845/android/GnssGeofencing.h
similarity index 100%
rename from android/GnssGeofencing.h
rename to sdm845/android/GnssGeofencing.h
diff --git a/android/GnssMeasurement.cpp b/sdm845/android/GnssMeasurement.cpp
similarity index 100%
rename from android/GnssMeasurement.cpp
rename to sdm845/android/GnssMeasurement.cpp
diff --git a/android/GnssMeasurement.h b/sdm845/android/GnssMeasurement.h
similarity index 100%
rename from android/GnssMeasurement.h
rename to sdm845/android/GnssMeasurement.h
diff --git a/android/GnssNi.cpp b/sdm845/android/GnssNi.cpp
similarity index 100%
rename from android/GnssNi.cpp
rename to sdm845/android/GnssNi.cpp
diff --git a/android/GnssNi.h b/sdm845/android/GnssNi.h
similarity index 100%
rename from android/GnssNi.h
rename to sdm845/android/GnssNi.h
diff --git a/android/android.hardware.gnss@1.0-service-qti.rc b/sdm845/android/android.hardware.gnss@1.0-service-qti.rc
similarity index 100%
rename from android/android.hardware.gnss@1.0-service-qti.rc
rename to sdm845/android/android.hardware.gnss@1.0-service-qti.rc
diff --git a/android/location_api/BatchingAPIClient.cpp b/sdm845/android/location_api/BatchingAPIClient.cpp
similarity index 100%
rename from android/location_api/BatchingAPIClient.cpp
rename to sdm845/android/location_api/BatchingAPIClient.cpp
diff --git a/android/location_api/BatchingAPIClient.h b/sdm845/android/location_api/BatchingAPIClient.h
similarity index 100%
rename from android/location_api/BatchingAPIClient.h
rename to sdm845/android/location_api/BatchingAPIClient.h
diff --git a/android/location_api/GeofenceAPIClient.cpp b/sdm845/android/location_api/GeofenceAPIClient.cpp
similarity index 100%
rename from android/location_api/GeofenceAPIClient.cpp
rename to sdm845/android/location_api/GeofenceAPIClient.cpp
diff --git a/android/location_api/GeofenceAPIClient.h b/sdm845/android/location_api/GeofenceAPIClient.h
similarity index 100%
copy from android/location_api/GeofenceAPIClient.h
copy to sdm845/android/location_api/GeofenceAPIClient.h
diff --git a/android/location_api/GnssAPIClient.cpp b/sdm845/android/location_api/GnssAPIClient.cpp
similarity index 100%
rename from android/location_api/GnssAPIClient.cpp
rename to sdm845/android/location_api/GnssAPIClient.cpp
diff --git a/android/location_api/GnssAPIClient.h b/sdm845/android/location_api/GnssAPIClient.h
similarity index 100%
rename from android/location_api/GnssAPIClient.h
rename to sdm845/android/location_api/GnssAPIClient.h
diff --git a/android/location_api/LocationUtil.cpp b/sdm845/android/location_api/LocationUtil.cpp
similarity index 100%
copy from android/location_api/LocationUtil.cpp
copy to sdm845/android/location_api/LocationUtil.cpp
diff --git a/android/location_api/LocationUtil.h b/sdm845/android/location_api/LocationUtil.h
similarity index 100%
copy from android/location_api/LocationUtil.h
copy to sdm845/android/location_api/LocationUtil.h
diff --git a/android/location_api/MeasurementAPIClient.cpp b/sdm845/android/location_api/MeasurementAPIClient.cpp
similarity index 100%
rename from android/location_api/MeasurementAPIClient.cpp
rename to sdm845/android/location_api/MeasurementAPIClient.cpp
diff --git a/android/location_api/MeasurementAPIClient.h b/sdm845/android/location_api/MeasurementAPIClient.h
similarity index 100%
rename from android/location_api/MeasurementAPIClient.h
rename to sdm845/android/location_api/MeasurementAPIClient.h
diff --git a/android/service.cpp b/sdm845/android/service.cpp
similarity index 100%
rename from android/service.cpp
rename to sdm845/android/service.cpp
diff --git a/sdm845/configure.ac b/sdm845/configure.ac
new file mode 100644
index 0000000..ec41c86
--- /dev/null
+++ b/sdm845/configure.ac
@@ -0,0 +1,91 @@
+# 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])
+# Disables auto rebuilding of configure, Makefile.ins
+AM_MAINTAINER_MODE
+# Verifies the --srcdir is correct by checking for the path
+AC_CONFIG_SRCDIR([utils/loc_cfg.cpp])
+# 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([QMI], [qmi])
+AC_SUBST([QMI_CFLAGS])
+AC_SUBST([QMI_LIBS])
+
+PKG_CHECK_MODULES([QMIF], [qmi-framework])
+AC_SUBST([QMIF_CFLAGS])
+AC_SUBST([QMIF_LIBS])
+
+PKG_CHECK_MODULES([DATA], [data])
+AC_SUBST([DATA_CFLAGS])
+AC_SUBST([DATA_LIBS])
+
+PKG_CHECK_MODULES([LOCPLA], [loc-pla])
+AC_SUBST([LOCPLA_CFLAGS])
+AC_SUBST([LOCPLA_LIBS])
+
+PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
+AC_SUBST([GPSUTILS_CFLAGS])
+AC_SUBST([GPSUTILS_LIBS])
+
+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_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 \
+ core/Makefile \
+ location/Makefile \
+ gnss/Makefile \
+ loc-hal.pc \
+ ])
+
+AC_OUTPUT
diff --git a/sdm845/core/Android.mk b/sdm845/core/Android.mk
new file mode 100644
index 0000000..dba0b0a
--- /dev/null
+++ b/sdm845/core/Android.mk
@@ -0,0 +1,69 @@
+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_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+LOCAL_MODULE_TAGS := optional
+
+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 := \
+ liblog \
+ libutils \
+ libcutils \
+ libgps.utils \
+ libdl \
+ liblog \
+ libloc_pla
+
+LOCAL_SRC_FILES += \
+ LocApiBase.cpp \
+ LocAdapterBase.cpp \
+ ContextBase.cpp \
+ LocDualContext.cpp \
+ loc_core_log.cpp \
+ data-items/DataItemsFactoryProxy.cpp \
+ data-items/common/ClientIndex.cpp \
+ data-items/common/DataItemIndex.cpp \
+ data-items/common/IndexFactory.cpp \
+ SystemStatusOsObserver.cpp \
+ SystemStatus.cpp
+
+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 := \
+ 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/sdm845/core/ContextBase.cpp b/sdm845/core/ContextBase.cpp
new file mode 100644
index 0000000..05a0ad3
--- /dev/null
+++ b/sdm845/core/ContextBase.cpp
@@ -0,0 +1,252 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_CtxBase"
+
+#include <dlfcn.h>
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <ContextBase.h>
+#include <msg_q.h>
+#include <loc_target.h>
+#include <platform_lib_includes.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+loc_gps_cfg_s_type ContextBase::mGps_conf {};
+loc_sap_cfg_s_type ContextBase::mSap_conf {};
+
+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'},
+};
+
+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_USAGE", &mSap_conf.SENSOR_USAGE, NULL, 'n'},
+ {"SENSOR_ALGORITHM_CONFIG_MASK", &mSap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
+ {"SENSOR_PROVIDER", &mSap_conf.SENSOR_PROVIDER, NULL, 'n'}
+};
+
+void ContextBase::readConfig()
+{
+ /*Defaults for gps.conf*/
+ mGps_conf.INTERMEDIATE_POS = 0;
+ mGps_conf.ACCURACY_THRES = 0;
+ mGps_conf.NMEA_PROVIDER = 0;
+ mGps_conf.GPS_LOCK = 0;
+ mGps_conf.SUPL_VER = 0x10000;
+ mGps_conf.SUPL_MODE = 0x1;
+ mGps_conf.SUPL_ES = 0;
+ mGps_conf.SUPL_HOST[0] = 0;
+ mGps_conf.SUPL_PORT = 0;
+ mGps_conf.CAPABILITIES = 0x7;
+ /* LTE Positioning Profile configuration is disable by default*/
+ mGps_conf.LPP_PROFILE = 0;
+ /*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;
+
+ /*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_USAGE = 0; /* Enabled */
+ 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;
+ /* default provider is SSC */
+ mSap_conf.SENSOR_PROVIDER = 1;
+
+ /* 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;
+
+ UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
+ UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
+}
+
+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;
+
+ // Check the target
+ if (TARGET_NO_GNSS != loc_get_target()){
+
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
+ void *handle = NULL;
+ //try to see if LocApiV02 is present
+ if ((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) {
+ LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__);
+ getLocApi_t* getter = (getLocApi_t*) dlsym(handle, "getLocApi");
+ if (getter != NULL) {
+ LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__,
+ __LINE__);
+ locApi = (*getter)(mMsgTask, 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)(mMsgTask, exMask, this);
+ }
+ }
+ }
+ }
+ }
+
+ // locApi could still be NULL at this time
+ // we would then create a dummy one
+ if (NULL == locApi) {
+ locApi = new LocApiBase(mMsgTask, 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())
+{
+}
+
+}
diff --git a/sdm845/core/ContextBase.h b/sdm845/core/ContextBase.h
new file mode 100644
index 0000000..dc64b6a
--- /dev/null
+++ b/sdm845/core/ContextBase.h
@@ -0,0 +1,151 @@
+/* Copyright (c) 2011-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_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>
+
+#define MAX_XTRA_SERVER_URL_LENGTH (256)
+#define MAX_SUPL_SERVER_URL_LENGTH (256)
+
+/* GPS.conf support */
+/* NOTE: the implementaiton of the parser casts number
+ 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[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH];
+ char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t 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[MAX_SUPL_SERVER_URL_LENGTH];
+ uint32_t SUPL_PORT;
+} 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_USAGE;
+ 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;
+ uint32_t SENSOR_PROVIDER;
+} 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() { delete mLocApi; delete mLBSProxy; }
+
+ inline const MsgTask* getMsgTask() { return mMsgTask; }
+ inline LocApiBase* getLocApi() { return mLocApi; }
+ inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
+ inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); }
+ inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); }
+ inline bool hasNativeXtraClient() { return mLBSProxy->hasNativeXtraClient(); }
+ inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); }
+ inline void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) {
+ mLBSProxy->requestUlp(adapter, capabilities);
+ }
+ 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;
+
+ void readConfig();
+ static uint32_t getCarrierCapabilities();
+
+};
+
+} // namespace loc_core
+
+#endif //__LOC_CONTEXT_BASE__
diff --git a/sdm845/core/LBSProxyBase.h b/sdm845/core/LBSProxyBase.h
new file mode 100644
index 0000000..94ddd0f
--- /dev/null
+++ b/sdm845/core/LBSProxyBase.h
@@ -0,0 +1,80 @@
+/* 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>
+#include <MsgTask.h>
+
+namespace loc_core {
+
+class LocApiBase;
+class LocAdapterBase;
+class ContextBase;
+
+class LBSProxyBase {
+ friend class ContextBase;
+ inline virtual LocApiBase*
+ getLocApi(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
+
+ (void)msgTask;
+ (void)exMask;
+ (void)context;
+ return NULL;
+ }
+protected:
+ inline LBSProxyBase() {}
+public:
+ inline virtual ~LBSProxyBase() {}
+ inline virtual void requestUlp(LocAdapterBase* adapter,
+ unsigned long capabilities) const {
+
+ (void)adapter;
+ (void)capabilities;
+ }
+ inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
+ inline virtual bool hasCPIExtendedCapabilities() 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/sdm845/core/LocAdapterBase.cpp b/sdm845/core/LocAdapterBase.cpp
new file mode 100644
index 0000000..3943819
--- /dev/null
+++ b/sdm845/core/LocAdapterBase.cpp
@@ -0,0 +1,164 @@
+/* Copyright (c) 2011-2014, 2016-2017The 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 <platform_lib_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, LocAdapterProxyBase *adapterProxyBase) :
+ mEvtMask(mask), mContext(context),
+ mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
+ mMsgTask(context->getMsgTask())
+{
+ mLocApi->addAdapter(this);
+}
+
+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,
+ bool /*fromUlp*/) {
+ if (mLocAdapterProxyBase != NULL) {
+ mLocAdapterProxyBase->reportPositionEvent((UlpLocation&)location,
+ (GpsLocationExtended&)locationExtended,
+ status,
+ loc_technology_mask);
+ } else {
+ DEFAULT_IMPL()
+ }
+}
+
+void LocAdapterBase::
+ reportSvEvent(const GnssSvNotification& /*svNotify*/, bool /*fromUlp*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvMeasurementEvent(GnssSvMeasurementSet &/*svMeasurementSet*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportSvPolynomialEvent(GnssSvPolynomial &/*svPolynomial*/)
+DEFAULT_IMPL()
+
+void LocAdapterBase::
+ reportStatus(LocGpsStatusValue /*status*/)
+DEFAULT_IMPL()
+
+
+void LocAdapterBase::
+ reportNmeaEvent(const char* /*nmea*/, size_t /*length*/, bool /*fromUlp*/)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportXtraServer(const char* /*url1*/, const char* /*url2*/,
+ const char* /*url3*/, const int /*maxlength*/)
+DEFAULT_IMPL(false)
+
+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*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ releaseATL(int /*connHandle*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestSuplES(int /*connHandle*/)
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallOpened()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ reportDataCallClosed()
+DEFAULT_IMPL(false)
+
+bool LocAdapterBase::
+ requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
+DEFAULT_IMPL(false)
+
+void LocAdapterBase::
+ reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& /*measurements*/,
+ int /*msInWeek*/)
+DEFAULT_IMPL()
+
+bool LocAdapterBase::
+ reportWwanZppFix(LocGpsLocation &/*zppLoc*/)
+DEFAULT_IMPL(false)
+
+} // namespace loc_core
diff --git a/sdm845/core/LocAdapterBase.h b/sdm845/core/LocAdapterBase.h
new file mode 100644
index 0000000..e7beca8
--- /dev/null
+++ b/sdm845/core/LocAdapterBase.h
@@ -0,0 +1,160 @@
+/* Copyright (c) 2011-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_API_ADAPTER_BASE_H
+#define LOC_API_ADAPTER_BASE_H
+
+#include <gps_extended.h>
+#include <UlpProxyBase.h>
+#include <ContextBase.h>
+#include <LocationAPI.h>
+#include <map>
+
+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 std::map<LocationSessionKey, LocationOptions> LocationSessionMap;
+
+namespace loc_core {
+
+class LocAdapterProxyBase;
+
+class LocAdapterBase {
+private:
+ static uint32_t mSessionIdCounter;
+protected:
+ LOC_API_ADAPTER_EVENT_MASK_T mEvtMask;
+ ContextBase* mContext;
+ LocApiBase* mLocApi;
+ LocAdapterProxyBase* mLocAdapterProxyBase;
+ const MsgTask* mMsgTask;
+ inline LocAdapterBase(const MsgTask* msgTask) :
+ mEvtMask(0), mContext(NULL), mLocApi(NULL),
+ mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {}
+public:
+ inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); }
+ LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
+ ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL);
+ 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 bool isFeatureSupported(uint8_t featureVal) {
+ return mLocApi->isFeatureSupported(featureVal);
+ }
+
+ uint32_t generateSessionId();
+
+ // This will be overridden by the individual adapters
+ // if necessary.
+ inline virtual void setUlpProxyCommand(UlpProxyBase* ulp) {
+
+ (void)ulp;
+ }
+ virtual void handleEngineUpEvent();
+ virtual void handleEngineDownEvent();
+ inline virtual void setPositionModeCommand(LocPosMode& posMode) {
+
+ (void)posMode;
+ }
+ virtual void startTrackingCommand() {}
+ virtual void stopTrackingCommand() {}
+ virtual void getZppCommand() {}
+ virtual void reportPositionEvent(const UlpLocation& location,
+ const GpsLocationExtended& locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask,
+ bool fromUlp=false);
+ virtual void reportSvEvent(const GnssSvNotification& svNotify, bool fromUlp=false);
+ virtual void reportNmeaEvent(const char* nmea, size_t length, bool fromUlp=false);
+ virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet);
+ virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial);
+ virtual void reportStatus(LocGpsStatusValue status);
+ virtual bool reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ virtual bool requestXtraData();
+ virtual bool requestTime();
+ virtual bool requestLocation();
+ virtual bool requestATL(int connHandle, LocAGpsType agps_type);
+ virtual bool releaseATL(int connHandle);
+ virtual bool requestSuplES(int connHandle);
+ virtual bool reportDataCallOpened();
+ virtual bool reportDataCallClosed();
+ virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
+ inline virtual bool isInSession() { return false; }
+ ContextBase* getContext() const { return mContext; }
+ virtual void reportGnssMeasurementDataEvent(const GnssMeasurementsNotification& measurements,
+ int msInWeek);
+ virtual bool reportWwanZppFix(LocGpsLocation &zppLoc);
+};
+
+} // namespace loc_core
+
+#endif //LOC_API_ADAPTER_BASE_H
diff --git a/sdm845/core/LocAdapterProxyBase.h b/sdm845/core/LocAdapterProxyBase.h
new file mode 100644
index 0000000..044f59b
--- /dev/null
+++ b/sdm845/core/LocAdapterProxyBase.h
@@ -0,0 +1,78 @@
+/* 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):
+ mLocAdapterBase(new LocAdapterBase(mask, context, 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/sdm845/core/LocApiBase.cpp b/sdm845/core/LocApiBase.cpp
new file mode 100644
index 0000000..4bc38e2
--- /dev/null
+++ b/sdm845/core/LocApiBase.cpp
@@ -0,0 +1,608 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDEBUG 0 //Define to enable LOGV
+#define LOG_TAG "LocSvc_LocApiBase"
+
+#include <dlfcn.h>
+#include <inttypes.h>
+#include <LocApiBase.h>
+#include <LocAdapterBase.h>
+#include <platform_lib_log_util.h>
+#include <LocDualContext.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();
+ mLocApi->open(mLocApi->getEvtMask());
+ }
+ inline void locallog() const {
+ LOC_LOGV("LocSsrMsg");
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+struct LocOpenMsg : public LocMsg {
+ LocApiBase* mLocApi;
+ LOC_API_ADAPTER_EVENT_MASK_T mMask;
+ inline LocOpenMsg(LocApiBase* locApi,
+ LOC_API_ADAPTER_EVENT_MASK_T mask) :
+ LocMsg(), mLocApi(locApi), mMask(mask)
+ {
+ locallog();
+ }
+ inline virtual void proc() const {
+ mLocApi->open(mMask);
+ }
+ inline void locallog() const {
+ LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
+ __func__, __LINE__, mMask);
+ }
+ inline virtual void log() const {
+ locallog();
+ }
+};
+
+LocApiBase::LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mMsgTask(msgTask), mContext(context), mSupportedMsg(0),
+ mMask(0), mExcludedMask(excludedMask)
+{
+ memset(mLocAdapters, 0, sizeof(mLocAdapters));
+ memset(mFeaturesSupported, 0, sizeof(mFeaturesSupported));
+}
+
+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::isInSession()
+{
+ bool inSession = false;
+
+ for (int i = 0;
+ !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
+ i++) {
+ inSession = mLocAdapters[i]->isInSession();
+ }
+
+ return inSession;
+}
+
+void LocApiBase::addAdapter(LocAdapterBase* adapter)
+{
+ for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
+ if (mLocAdapters[i] == NULL) {
+ mLocAdapters[i] = adapter;
+ mMsgTask->sendMsg(new LocOpenMsg(this,
+ mMask | adapter->getEvtMask()));
+ 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) {
+ close();
+ } else {
+ // else we need to remove the bit
+ mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
+ }
+ }
+ }
+}
+
+void LocApiBase::updateEvtMask()
+{
+ open(getEvtMask());
+}
+
+void LocApiBase::handleEngineUpEvent()
+{
+ // This will take care of renegotiating the loc handle
+ mMsgTask->sendMsg(new LocSsrMsg(this));
+
+ LocDualContext::injectFeatureConfig(mContext);
+
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
+}
+
+void LocApiBase::handleEngineDownEvent()
+{
+ // 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)
+{
+ // 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 rawDataSize: %d\n rawData: %p\n "
+ "Session status: %d\n Technology mask: %u\n "
+ "SV used in fix (gps/glo/bds/gal/qzss) : \
+ (%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" PRIx64 "/%" 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, location.rawDataSize,
+ location.rawData, 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)
+ );
+}
+
+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::reportSv(GnssSvNotification& svNotify)
+{
+ const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
+ "QZSS", "BEIDOU", "GALILEO" };
+
+ // print the SV info before delivering
+ LOC_LOGV("num sv: %zu\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;
+ }
+ LOC_LOGV(" %03zu: %*s %02d %f %f %f 0x%02X",
+ 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].gnssSvOptionsMask);
+ }
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvEvent(svNotify)
+ );
+}
+
+void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvMeasurementEvent(svMeasurementSet)
+ );
+}
+
+void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(
+ mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
+ );
+}
+
+void LocApiBase::reportStatus(LocGpsStatusValue status)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
+}
+
+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::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)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
+}
+
+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::requestSuplES(int connHandle)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
+}
+
+void LocApiBase::reportDataCallOpened()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
+}
+
+void LocApiBase::reportDataCallClosed()
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
+}
+
+void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data)
+{
+ // loop through adapters, and deliver to the first handling adapter.
+ TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
+}
+
+void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
+{
+ mSupportedMsg = supportedMsgList;
+}
+
+void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
+{
+ memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
+}
+
+void* LocApiBase :: getSibling()
+ DEFAULT_IMPL(NULL)
+
+LocApiProxyBase* LocApiBase :: getLocApiProxy()
+ DEFAULT_IMPL(NULL)
+
+void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurements,
+ int msInWeek)
+{
+ // loop through adapters, and deliver to all adapters.
+ TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurements, msInWeek));
+}
+
+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)
+
+enum loc_api_adapter_err LocApiBase::
+ startFix(const LocPosMode& /*posMode*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ stopFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ deleteAidingData(const GnssAidingData& /*data*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ enableData(int /*enable*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setAPN(char* /*apn*/, int /*len*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ injectPosition(double /*latitude*/, double /*longitude*/, float /*accuracy*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setTime(LocGpsUtcTime /*time*/, int64_t /*timeReference*/, int /*uncertainty*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setXtraData(char* /*data*/, int /*length*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ requestXtraServer()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/,
+ AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ atlCloseStatus(int /*handle*/, int /*is_succ*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setPositionMode(const LocPosMode& /*posMode*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ setServer(const char* /*url*/, int /*len*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setServer(unsigned int /*ip*/, int /*port*/, LocServerType /*type*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ informNiResponse(GnssNiResponse /*userResponse*/, const void* /*passThroughData*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setSUPLVersion(GnssConfigSuplVersion /*version*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setNMEATypes (uint32_t /*typesMask*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPConfig(GnssConfigLppProfile /*profile*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorControlConfig(int /*sensorUsage*/,
+ int /*sensorProvider*/)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ setSensorProperties(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::
+ setSensorPerfControlConfig(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::
+ setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask /*aGlonassProtocol*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPeProtocolCp(GnssConfigLppeControlPlaneMask /*lppeCP*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+LocationError LocApiBase::
+ setLPPeProtocolUp(GnssConfigLppeUserPlaneMask /*lppeUP*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getWwanZppFix()
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(LocGpsLocation& zppLoc)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(LocGpsLocation & zppLoc, GpsLocationExtended & locationExtended,
+ LocPosTechMask & tech_mask)
+{
+ memset(&zppLoc, 0, sizeof(zppLoc));
+ memset(&tech_mask, 0, sizeof(tech_mask));
+ memset(&locationExtended, 0, sizeof (locationExtended));
+ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+}
+
+int LocApiBase::
+ initDataServiceClient(bool /*isDueToSsr*/)
+DEFAULT_IMPL(-1)
+
+int LocApiBase::
+ openAndStartDataCall()
+DEFAULT_IMPL(-1)
+
+void LocApiBase::
+ stopDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ closeDataCall()
+DEFAULT_IMPL()
+
+void LocApiBase::
+ releaseDataServiceClient()
+DEFAULT_IMPL()
+
+LocationError LocApiBase::
+ setGpsLock(GnssConfigGpsLock /*lock*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+void LocApiBase::
+ installAGpsCert(const LocDerEncodedCertificate* /*pData*/,
+ size_t /*length*/,
+ uint32_t /*slotBitMask*/)
+DEFAULT_IMPL()
+
+int LocApiBase::
+ getGpsLock()
+DEFAULT_IMPL(-1)
+
+LocationError LocApiBase::
+ setXtraVersionCheck(uint32_t /*check*/)
+DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
+
+bool LocApiBase::
+ gnssConstellationConfig()
+DEFAULT_IMPL(false)
+
+bool LocApiBase::
+ isFeatureSupported(uint8_t featureVal)
+{
+ uint8_t arrayIndex = featureVal >> 3;
+ uint8_t bitPos = featureVal & 7;
+
+ if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
+ return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
+}
+
+} // namespace loc_core
diff --git a/sdm845/core/LocApiBase.h b/sdm845/core/LocApiBase.h
new file mode 100644
index 0000000..f66bfe1
--- /dev/null
+++ b/sdm845/core/LocApiBase.h
@@ -0,0 +1,266 @@
+/* Copyright (c) 2011-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_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 <platform_lib_log_util.h>
+
+namespace loc_core {
+class ContextBase;
+
+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;
+
+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 class ContextBase;
+ const MsgTask* mMsgTask;
+ ContextBase *mContext;
+ LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
+ uint64_t mSupportedMsg;
+ uint8_t mFeaturesSupported[MAX_FEATURE_LENGTH];
+
+protected:
+ 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;
+ LocApiBase(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
+ inline virtual ~LocApiBase() { close(); }
+ bool isInSession();
+ const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
+
+public:
+ inline void sendMsg(const LocMsg* msg) const {
+ mMsgTask->sendMsg(msg);
+ }
+ 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);
+ void reportSv(GnssSvNotification& svNotify);
+ void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet);
+ void reportSvPolynomial(GnssSvPolynomial &svPolynomial);
+ void reportStatus(LocGpsStatusValue status);
+ void reportNmea(const char* nmea, int length);
+ void reportXtraServer(const char* url1, const char* url2,
+ const char* url3, const int maxlength);
+ void requestXtraData();
+ void requestTime();
+ void requestLocation();
+ void requestATL(int connHandle, LocAGpsType agps_type);
+ void releaseATL(int connHandle);
+ void requestSuplES(int connHandle);
+ void reportDataCallOpened();
+ void reportDataCallClosed();
+ void requestNiNotify(GnssNiNotification ¬ify, const void* data);
+ void saveSupportedMsgList(uint64_t supportedMsgList);
+ void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
+ void saveSupportedFeatureList(uint8_t *featureList);
+ void reportWwanZppFix(LocGpsLocation &zppLoc);
+
+ // downward calls
+ // All below functions are to be defined by adapter specific modules:
+ // RPC, QMI, etc. The default implementation is empty.
+
+ virtual void* getSibling();
+ virtual LocApiProxyBase* getLocApiProxy();
+ virtual enum loc_api_adapter_err
+ startFix(const LocPosMode& posMode);
+ virtual enum loc_api_adapter_err
+ stopFix();
+ virtual LocationError
+ deleteAidingData(const GnssAidingData& data);
+ virtual enum loc_api_adapter_err
+ enableData(int enable);
+ virtual enum loc_api_adapter_err
+ setAPN(char* apn, int len);
+ virtual enum loc_api_adapter_err
+ injectPosition(double latitude, double longitude, float accuracy);
+ virtual enum loc_api_adapter_err
+ setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
+ virtual enum loc_api_adapter_err
+ setXtraData(char* data, int length);
+ virtual enum loc_api_adapter_err
+ requestXtraServer();
+ virtual enum loc_api_adapter_err
+ atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, LocAGpsType agpsType);
+ virtual enum loc_api_adapter_err
+ atlCloseStatus(int handle, int is_succ);
+ virtual enum loc_api_adapter_err
+ setPositionMode(const LocPosMode& posMode);
+ virtual LocationError
+ setServer(const char* url, int len);
+ virtual LocationError
+ setServer(unsigned int ip, int port,
+ LocServerType type);
+ virtual LocationError
+ informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
+ virtual LocationError setSUPLVersion(GnssConfigSuplVersion version);
+ virtual enum loc_api_adapter_err
+ setNMEATypes (uint32_t typesMask);
+ virtual LocationError setLPPConfig(GnssConfigLppProfile profile);
+ virtual enum loc_api_adapter_err
+ setSensorControlConfig(int sensorUsage, int sensorProvider);
+ virtual enum loc_api_adapter_err
+ setSensorProperties(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
+ setSensorPerfControlConfig(int controlMode,
+ int accelSamplesPerBatch,
+ int accelBatchesPerSec,
+ int gyroSamplesPerBatch,
+ int gyroBatchesPerSec,
+ int accelSamplesPerBatchHigh,
+ int accelBatchesPerSecHigh,
+ int gyroSamplesPerBatchHigh,
+ int gyroBatchesPerSecHigh,
+ int algorithmConfig);
+ virtual LocationError
+ setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
+ virtual LocationError setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP);
+ virtual LocationError setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP);
+ virtual enum loc_api_adapter_err
+ getWwanZppFix();
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(LocGpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(LocGpsLocation & zppLoc, GpsLocationExtended & locationExtended,
+ LocPosTechMask & tech_mask);
+ virtual int initDataServiceClient(bool isDueToSsr);
+ virtual int openAndStartDataCall();
+ virtual void stopDataCall();
+ virtual void closeDataCall();
+ virtual void releaseDataServiceClient();
+ virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
+ size_t length,
+ uint32_t slotBitMask);
+ inline virtual void setInSession(bool inSession) {
+
+ (void)inSession;
+ }
+ inline bool isMessageSupported (LocCheckingMessagesID msgID) const {
+
+ // confirm if msgID is not larger than the number of bits in
+ // mSupportedMsg
+ if ((uint64_t)msgID > (sizeof(mSupportedMsg) << 3)) {
+ return false;
+ } else {
+ uint32_t messageChecker = 1 << msgID;
+ return (messageChecker & mSupportedMsg) == messageChecker;
+ }
+ }
+
+ void updateEvtMask();
+
+ virtual LocationError setGpsLock(GnssConfigGpsLock lock);
+ /*
+ Returns
+ Current value of GPS Lock on success
+ -1 on failure
+ */
+ virtual int getGpsLock(void);
+
+ virtual LocationError setXtraVersionCheck(uint32_t check);
+ /*
+ Check if the modem support the service
+ */
+ virtual bool gnssConstellationConfig();
+
+ /*
+ Check if a feature is supported
+ */
+ bool isFeatureSupported(uint8_t featureVal);
+};
+
+typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
+
+} // namespace loc_core
+
+#endif //LOC_API_BASE_H
diff --git a/sdm845/core/LocDualContext.cpp b/sdm845/core/LocDualContext.cpp
new file mode 100644
index 0000000..fd3450d
--- /dev/null
+++ b/sdm845/core/LocDualContext.cpp
@@ -0,0 +1,150 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_DualCtx"
+
+#include <cutils/sched_policy.h>
+#include <unistd.h>
+#include <LocDualContext.h>
+#include <msg_q.h>
+#include <platform_lib_log_util.h>
+#include <loc_log.h>
+
+namespace loc_core {
+
+// nothing exclude for foreground
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mFgExclMask = 0;
+// excluded events for background clients
+const LOC_API_ADAPTER_EVENT_MASK_T
+LocDualContext::mBgExclMask =
+ (LOC_API_ADAPTER_BIT_SATELLITE_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT |
+ LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT |
+ LOC_API_ADAPTER_BIT_IOCTL_REPORT |
+ LOC_API_ADAPTER_BIT_STATUS_REPORT |
+ LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT |
+ LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT);
+
+const MsgTask* LocDualContext::mMsgTask = NULL;
+ContextBase* LocDualContext::mFgContext = NULL;
+ContextBase* LocDualContext::mBgContext = NULL;
+ContextBase* LocDualContext::mInjectContext = NULL;
+// the name must be shorter than 15 chars
+const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
+#ifndef USE_GLIB
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
+#else
+const char* LocDualContext::mLBSLibName = "liblbs_core.so.1";
+#endif
+
+pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER;
+
+const MsgTask* LocDualContext::getMsgTask(LocThread::tCreate tCreator,
+ const char* name, bool joinable)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tCreator, name, joinable);
+ }
+ return mMsgTask;
+}
+
+inline
+const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) {
+ return getMsgTask((LocThread::tCreate)NULL, name, joinable);
+}
+
+ContextBase* LocDualContext::getLocFgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mFgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mFgContext->sendMsg(firstMsg);
+ }
+
+ return mFgContext;
+}
+
+ContextBase* LocDualContext::getLocBgContext(LocThread::tCreate tCreator,
+ LocMsg* firstMsg, const char* name, bool joinable)
+{
+ pthread_mutex_lock(&LocDualContext::mGetLocContextMutex);
+ LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__);
+ if (NULL == mBgContext) {
+ LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__);
+ const MsgTask* msgTask = getMsgTask(tCreator, name, joinable);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
+ pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex);
+
+ if (firstMsg) {
+ mBgContext->sendMsg(firstMsg);
+ }
+
+ return mBgContext;
+}
+
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Enter", __func__, __LINE__);
+ if(curContext == mInjectContext) {
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+ }
+ LOC_LOGD("%s:%d]: Exit", __func__, __LINE__);
+}
+
+LocDualContext::LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask) :
+ ContextBase(msgTask, exMask, mLBSLibName)
+{
+}
+
+}
diff --git a/sdm845/core/LocDualContext.h b/sdm845/core/LocDualContext.h
new file mode 100644
index 0000000..3b3ce2c
--- /dev/null
+++ b/sdm845/core/LocDualContext.h
@@ -0,0 +1,76 @@
+/* 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.
+ *
+ */
+#ifndef __LOC_ENG_CONTEXT__
+#define __LOC_ENG_CONTEXT__
+
+#include <stdbool.h>
+#include <ctype.h>
+#include <dlfcn.h>
+#include <ContextBase.h>
+
+namespace loc_core {
+
+class LocDualContext : public ContextBase {
+ static const MsgTask* mMsgTask;
+ static ContextBase* mFgContext;
+ static ContextBase* mBgContext;
+ static ContextBase* mInjectContext;
+ 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:
+ LocDualContext(const MsgTask* msgTask,
+ LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ inline virtual ~LocDualContext() {}
+
+public:
+ static const char* mLBSLibName;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
+ static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
+ static const char* mLocationHalName;
+
+ static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) {
+ return getLocFgContext(NULL, NULL, name, joinable);
+ }
+ static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg,
+ const char* name, bool joinable = true);
+ inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) {
+ return getLocBgContext(NULL, NULL, name, joinable);
+ }
+
+ static void injectFeatureConfig(ContextBase *context);
+};
+
+}
+
+#endif //__LOC_ENG_CONTEXT__
diff --git a/core/Makefile.am b/sdm845/core/Makefile.am
similarity index 100%
rename from core/Makefile.am
rename to sdm845/core/Makefile.am
diff --git a/core/SystemStatus.cpp b/sdm845/core/SystemStatus.cpp
similarity index 100%
rename from core/SystemStatus.cpp
rename to sdm845/core/SystemStatus.cpp
diff --git a/core/SystemStatus.h b/sdm845/core/SystemStatus.h
similarity index 100%
rename from core/SystemStatus.h
rename to sdm845/core/SystemStatus.h
diff --git a/core/SystemStatusOsObserver.cpp b/sdm845/core/SystemStatusOsObserver.cpp
similarity index 100%
rename from core/SystemStatusOsObserver.cpp
rename to sdm845/core/SystemStatusOsObserver.cpp
diff --git a/core/SystemStatusOsObserver.h b/sdm845/core/SystemStatusOsObserver.h
similarity index 100%
rename from core/SystemStatusOsObserver.h
rename to sdm845/core/SystemStatusOsObserver.h
diff --git a/sdm845/core/UlpProxyBase.h b/sdm845/core/UlpProxyBase.h
new file mode 100644
index 0000000..8863b66
--- /dev/null
+++ b/sdm845/core/UlpProxyBase.h
@@ -0,0 +1,124 @@
+/* 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 ULP_PROXY_BASE_H
+#define ULP_PROXY_BASE_H
+
+#include <gps_extended.h>
+#include <LocationAPI.h>
+
+namespace loc_core {
+
+class LocAdapterBase;
+
+class UlpProxyBase {
+public:
+ LocPosMode mPosMode;
+ bool mFixSet;
+ inline UlpProxyBase() {
+ mPosMode.mode = LOC_POSITION_MODE_INVALID;
+ mFixSet = false;
+ }
+ inline virtual ~UlpProxyBase() {}
+ inline virtual bool sendStartFix() { mFixSet = true; return false; }
+ inline virtual bool sendStopFix() { mFixSet = false; return false; }
+ inline virtual bool sendFixMode(LocPosMode ¶ms) {
+ mPosMode = params;
+ return false;
+ }
+
+ inline virtual bool reportPosition(const UlpLocation &location,
+ const GpsLocationExtended &locationExtended,
+ enum loc_sess_status status,
+ LocPosTechMask loc_technology_mask) {
+ (void)location;
+ (void)locationExtended;
+ (void)status;
+ (void)loc_technology_mask;
+ return false;
+ }
+ inline virtual bool reportSv(const GnssSvNotification& svNotify) {
+ (void)svNotify;
+ return false;
+ }
+ inline virtual bool reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) {
+ (void)svMeasurementSet;
+ return false;
+ }
+
+ inline virtual bool reportSvPolynomial(GnssSvPolynomial &svPolynomial)
+ {
+ (void)svPolynomial;
+ return false;
+ }
+ inline virtual bool reportStatus(LocGpsStatusValue status) {
+
+ (void)status;
+ return false;
+ }
+ inline virtual void setAdapter(LocAdapterBase* adapter) {
+
+ (void)adapter;
+ }
+ inline virtual void setCapabilities(unsigned long capabilities) {
+
+ (void)capabilities;
+ }
+ inline virtual bool reportBatchingSession(const LocationOptions& options, bool active)
+ {
+ (void)options;
+ (void)active;
+ return false;
+ }
+ inline virtual bool reportPositions(const UlpLocation* ulpLocations,
+ const GpsLocationExtended* extendedLocations,
+ const uint32_t* techMasks,
+ const size_t count)
+ {
+ (void)ulpLocations;
+ (void)extendedLocations;
+ (void)techMasks;
+ (void)count;
+ return false;
+ }
+ inline virtual bool reportDeleteAidingData(LocGpsAidingData aidingData)
+ {
+ (void)aidingData;
+ return false;
+ }
+ inline virtual bool reportNmea(const char* nmea, int length)
+ {
+ (void)nmea;
+ (void)length;
+ return false;
+ }
+};
+
+} // namespace loc_core
+
+#endif // ULP_PROXY_BASE_H
diff --git a/core/data-items/DataItemConcreteTypesBase.h b/sdm845/core/data-items/DataItemConcreteTypesBase.h
similarity index 100%
rename from core/data-items/DataItemConcreteTypesBase.h
rename to sdm845/core/data-items/DataItemConcreteTypesBase.h
diff --git a/core/data-items/DataItemId.h b/sdm845/core/data-items/DataItemId.h
similarity index 100%
rename from core/data-items/DataItemId.h
rename to sdm845/core/data-items/DataItemId.h
diff --git a/core/data-items/DataItemsFactoryProxy.cpp b/sdm845/core/data-items/DataItemsFactoryProxy.cpp
similarity index 100%
rename from core/data-items/DataItemsFactoryProxy.cpp
rename to sdm845/core/data-items/DataItemsFactoryProxy.cpp
diff --git a/core/data-items/DataItemsFactoryProxy.h b/sdm845/core/data-items/DataItemsFactoryProxy.h
similarity index 100%
rename from core/data-items/DataItemsFactoryProxy.h
rename to sdm845/core/data-items/DataItemsFactoryProxy.h
diff --git a/core/data-items/IDataItemCore.h b/sdm845/core/data-items/IDataItemCore.h
similarity index 100%
rename from core/data-items/IDataItemCore.h
rename to sdm845/core/data-items/IDataItemCore.h
diff --git a/core/data-items/common/ClientIndex.cpp b/sdm845/core/data-items/common/ClientIndex.cpp
similarity index 100%
rename from core/data-items/common/ClientIndex.cpp
rename to sdm845/core/data-items/common/ClientIndex.cpp
diff --git a/core/data-items/common/ClientIndex.h b/sdm845/core/data-items/common/ClientIndex.h
similarity index 100%
rename from core/data-items/common/ClientIndex.h
rename to sdm845/core/data-items/common/ClientIndex.h
diff --git a/core/data-items/common/DataItemIndex.cpp b/sdm845/core/data-items/common/DataItemIndex.cpp
similarity index 100%
rename from core/data-items/common/DataItemIndex.cpp
rename to sdm845/core/data-items/common/DataItemIndex.cpp
diff --git a/core/data-items/common/DataItemIndex.h b/sdm845/core/data-items/common/DataItemIndex.h
similarity index 100%
rename from core/data-items/common/DataItemIndex.h
rename to sdm845/core/data-items/common/DataItemIndex.h
diff --git a/core/data-items/common/IClientIndex.h b/sdm845/core/data-items/common/IClientIndex.h
similarity index 100%
rename from core/data-items/common/IClientIndex.h
rename to sdm845/core/data-items/common/IClientIndex.h
diff --git a/core/data-items/common/IDataItemIndex.h b/sdm845/core/data-items/common/IDataItemIndex.h
similarity index 100%
rename from core/data-items/common/IDataItemIndex.h
rename to sdm845/core/data-items/common/IDataItemIndex.h
diff --git a/core/data-items/common/IndexFactory.cpp b/sdm845/core/data-items/common/IndexFactory.cpp
similarity index 100%
rename from core/data-items/common/IndexFactory.cpp
rename to sdm845/core/data-items/common/IndexFactory.cpp
diff --git a/core/data-items/common/IndexFactory.h b/sdm845/core/data-items/common/IndexFactory.h
similarity index 100%
rename from core/data-items/common/IndexFactory.h
rename to sdm845/core/data-items/common/IndexFactory.h
diff --git a/sdm845/core/loc_core_log.cpp b/sdm845/core/loc_core_log.cpp
new file mode 100644
index 0000000..5a627dd
--- /dev/null
+++ b/sdm845/core/loc_core_log.cpp
@@ -0,0 +1,243 @@
+/* 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 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 <loc_log.h>
+#include <loc_core_log.h>
+#include <platform_lib_includes.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",
+ loc_get_position_mode_name(mode),
+ loc_get_position_recurrence_name(recurrence),
+ min_interval,
+ preferred_accuracy,
+ preferred_time,
+ credentials,
+ provider);
+}
+
+/* GPS status names */
+static const loc_name_val_s_type 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 ),
+};
+static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(LocGpsStatusValue gps_status)
+{
+ return loc_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_mode_name(LocGpsPositionMode mode)
+{
+ return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_position_recurrences[] =
+{
+ NAME_VAL( LOC_GPS_POSITION_RECURRENCE_PERIODIC ),
+ NAME_VAL( LOC_GPS_POSITION_RECURRENCE_SINGLE )
+};
+static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
+{
+ return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
+}
+
+
+
+static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
+{
+ NAME_VAL( LOC_GPS_DELETE_EPHEMERIS ),
+ NAME_VAL( LOC_GPS_DELETE_ALMANAC ),
+ NAME_VAL( LOC_GPS_DELETE_POSITION ),
+ NAME_VAL( LOC_GPS_DELETE_TIME ),
+ NAME_VAL( LOC_GPS_DELETE_IONO ),
+ NAME_VAL( LOC_GPS_DELETE_UTC ),
+ NAME_VAL( LOC_GPS_DELETE_HEALTH ),
+ NAME_VAL( LOC_GPS_DELETE_SVDIR ),
+ NAME_VAL( LOC_GPS_DELETE_SVSTEER ),
+ NAME_VAL( LOC_GPS_DELETE_SADATA ),
+ NAME_VAL( LOC_GPS_DELETE_RTI ),
+ NAME_VAL( LOC_GPS_DELETE_CELLDB_INFO ),
+ NAME_VAL( LOC_GPS_DELETE_ALL)
+};
+static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
+{
+ return NULL;
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_type_name(LocAGpsType type)
+{
+ return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_type_name(LocGpsNiType type)
+{
+ return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_response_name(LocGpsUserResponseType response)
+{
+ return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
+}
+
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding)
+{
+ return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_bear_name(AGpsBearerType bearer)
+{
+ return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_server_type_name(LocServerType type)
+{
+ return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
+}
+
+static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
+{
+ NAME_VAL( LOC_SESS_SUCCESS ),
+ NAME_VAL( LOC_SESS_INTERMEDIATE ),
+ NAME_VAL( LOC_SESS_FAILURE )
+};
+static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+
+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, loc_eng_position_sess_status_num, (long) status);
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+
+const char* loc_get_agps_status_name(LocAGpsStatusValue status)
+{
+ return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
+}
diff --git a/sdm845/core/loc_core_log.h b/sdm845/core/loc_core_log.h
new file mode 100644
index 0000000..2beb687
--- /dev/null
+++ b/sdm845/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/core/observer/IDataItemObserver.h b/sdm845/core/observer/IDataItemObserver.h
similarity index 100%
rename from core/observer/IDataItemObserver.h
rename to sdm845/core/observer/IDataItemObserver.h
diff --git a/core/observer/IDataItemSubscription.h b/sdm845/core/observer/IDataItemSubscription.h
similarity index 100%
rename from core/observer/IDataItemSubscription.h
rename to sdm845/core/observer/IDataItemSubscription.h
diff --git a/core/observer/IFrameworkActionReq.h b/sdm845/core/observer/IFrameworkActionReq.h
similarity index 100%
rename from core/observer/IFrameworkActionReq.h
rename to sdm845/core/observer/IFrameworkActionReq.h
diff --git a/core/observer/IOsObserver.h b/sdm845/core/observer/IOsObserver.h
similarity index 100%
rename from core/observer/IOsObserver.h
rename to sdm845/core/observer/IOsObserver.h
diff --git a/sdm845/etc/Android.mk b/sdm845/etc/Android.mk
new file mode 100644
index 0000000..d9eb0e1
--- /dev/null
+++ b/sdm845/etc/Android.mk
@@ -0,0 +1,12 @@
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.conf
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/
+LOCAL_SRC_FILES := gps.conf
+
+include $(BUILD_PREBUILT)
+
diff --git a/sdm845/etc/gps.conf b/sdm845/etc/gps.conf
new file mode 100644
index 0000000..d30461e
--- /dev/null
+++ b/sdm845/etc/gps.conf
@@ -0,0 +1,221 @@
+#Uncommenting these urls would only enable
+#the power up auto injection and force injection(test case).
+#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
+#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
+#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
+
+#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=/system/etc/security/cacerts
+
+# 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
+
+# Below bit mask configures how GPS functionalities
+# should be locked when user turns off GPS on Settings
+# Set bit 0x1 if MO GPS functionalities are to be locked
+# Set bit 0x2 if NI GPS functionalities are to be locked
+# default - non is locked for backward compatibility
+#GPS_LOCK = 0
+
+# supl version 1.0
+SUPL_VER=0x10000
+
+# Emergency SUPL, 1=enable, 0=disable
+#SUPL_ES=0
+
+#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
+# GEOFENCE = 0x20
+# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
+CAPABILITIES=0x37
+
+# 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 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
+
+################################
+# EXTRA SETTINGS
+################################
+# NMEA provider (1=Modem Processor, 0=Application Processor)
+NMEA_PROVIDER=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
+# 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
+
+#####################################
+# 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
diff --git a/gnss/Agps.cpp b/sdm845/gnss/Agps.cpp
similarity index 100%
rename from gnss/Agps.cpp
rename to sdm845/gnss/Agps.cpp
diff --git a/gnss/Agps.h b/sdm845/gnss/Agps.h
similarity index 100%
rename from gnss/Agps.h
rename to sdm845/gnss/Agps.h
diff --git a/gnss/Android.mk b/sdm845/gnss/Android.mk
similarity index 100%
rename from gnss/Android.mk
rename to sdm845/gnss/Android.mk
diff --git a/gnss/GnssAdapter.cpp b/sdm845/gnss/GnssAdapter.cpp
similarity index 100%
rename from gnss/GnssAdapter.cpp
rename to sdm845/gnss/GnssAdapter.cpp
diff --git a/gnss/GnssAdapter.h b/sdm845/gnss/GnssAdapter.h
similarity index 100%
rename from gnss/GnssAdapter.h
rename to sdm845/gnss/GnssAdapter.h
diff --git a/gnss/Makefile.am b/sdm845/gnss/Makefile.am
similarity index 100%
rename from gnss/Makefile.am
rename to sdm845/gnss/Makefile.am
diff --git a/gnss/XtraSystemStatusObserver.cpp b/sdm845/gnss/XtraSystemStatusObserver.cpp
similarity index 100%
rename from gnss/XtraSystemStatusObserver.cpp
rename to sdm845/gnss/XtraSystemStatusObserver.cpp
diff --git a/gnss/XtraSystemStatusObserver.h b/sdm845/gnss/XtraSystemStatusObserver.h
similarity index 100%
rename from gnss/XtraSystemStatusObserver.h
rename to sdm845/gnss/XtraSystemStatusObserver.h
diff --git a/gnss/location_gnss.cpp b/sdm845/gnss/location_gnss.cpp
similarity index 100%
rename from gnss/location_gnss.cpp
rename to sdm845/gnss/location_gnss.cpp
diff --git a/loc-hal.pc.in b/sdm845/loc-hal.pc.in
similarity index 100%
rename from loc-hal.pc.in
rename to sdm845/loc-hal.pc.in
diff --git a/location/Android.mk b/sdm845/location/Android.mk
similarity index 100%
rename from location/Android.mk
rename to sdm845/location/Android.mk
diff --git a/location/LocationAPI.cpp b/sdm845/location/LocationAPI.cpp
similarity index 100%
rename from location/LocationAPI.cpp
rename to sdm845/location/LocationAPI.cpp
diff --git a/location/LocationAPI.h b/sdm845/location/LocationAPI.h
similarity index 100%
rename from location/LocationAPI.h
rename to sdm845/location/LocationAPI.h
diff --git a/location/LocationAPIClientBase.cpp b/sdm845/location/LocationAPIClientBase.cpp
similarity index 100%
rename from location/LocationAPIClientBase.cpp
rename to sdm845/location/LocationAPIClientBase.cpp
diff --git a/location/LocationAPIClientBase.h b/sdm845/location/LocationAPIClientBase.h
similarity index 100%
rename from location/LocationAPIClientBase.h
rename to sdm845/location/LocationAPIClientBase.h
diff --git a/location/Makefile.am b/sdm845/location/Makefile.am
similarity index 100%
rename from location/Makefile.am
rename to sdm845/location/Makefile.am
diff --git a/location/location_interface.h b/sdm845/location/location_interface.h
similarity index 100%
rename from location/location_interface.h
rename to sdm845/location/location_interface.h
diff --git a/sdm845/utils/Android.mk b/sdm845/utils/Android.mk
new file mode 100644
index 0000000..1352076
--- /dev/null
+++ b/sdm845/utils/Android.mk
@@ -0,0 +1,66 @@
+ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),)
+ifneq ($(BUILD_TINY_ANDROID),true)
+#Compile this library only for builds with the latest modem image
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+
+## Libs
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ libcutils \
+ liblog \
+ libloc_pla
+
+LOCAL_SRC_FILES += \
+ loc_log.cpp \
+ loc_cfg.cpp \
+ msg_q.c \
+ linked_list.c \
+ loc_target.cpp \
+ platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ LocHeap.cpp \
+ LocTimer.cpp \
+ LocThread.cpp \
+ MsgTask.cpp \
+ loc_misc_utils.cpp \
+ loc_nmea.cpp \
+ LocIpc.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 := \
+ libloc_pla_headers \
+ liblocation_api_headers
+
+LOCAL_MODULE := libgps.utils
+LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+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)
+
+include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, platform_lib_abstractions))
+endif # not BUILD_TINY_ANDROID
+endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/utils/LocHeap.cpp b/sdm845/utils/LocHeap.cpp
similarity index 100%
rename from utils/LocHeap.cpp
rename to sdm845/utils/LocHeap.cpp
diff --git a/utils/LocHeap.h b/sdm845/utils/LocHeap.h
similarity index 100%
rename from utils/LocHeap.h
rename to sdm845/utils/LocHeap.h
diff --git a/utils/LocIpc.cpp b/sdm845/utils/LocIpc.cpp
similarity index 100%
rename from utils/LocIpc.cpp
rename to sdm845/utils/LocIpc.cpp
diff --git a/utils/LocIpc.h b/sdm845/utils/LocIpc.h
similarity index 100%
rename from utils/LocIpc.h
rename to sdm845/utils/LocIpc.h
diff --git a/utils/LocSharedLock.h b/sdm845/utils/LocSharedLock.h
similarity index 100%
rename from utils/LocSharedLock.h
rename to sdm845/utils/LocSharedLock.h
diff --git a/utils/LocThread.cpp b/sdm845/utils/LocThread.cpp
similarity index 100%
rename from utils/LocThread.cpp
rename to sdm845/utils/LocThread.cpp
diff --git a/utils/LocThread.h b/sdm845/utils/LocThread.h
similarity index 100%
rename from utils/LocThread.h
rename to sdm845/utils/LocThread.h
diff --git a/utils/LocTimer.cpp b/sdm845/utils/LocTimer.cpp
similarity index 100%
rename from utils/LocTimer.cpp
rename to sdm845/utils/LocTimer.cpp
diff --git a/utils/LocTimer.h b/sdm845/utils/LocTimer.h
similarity index 100%
rename from utils/LocTimer.h
rename to sdm845/utils/LocTimer.h
diff --git a/sdm845/utils/Makefile.am b/sdm845/utils/Makefile.am
new file mode 100644
index 0000000..506309c
--- /dev/null
+++ b/sdm845/utils/Makefile.am
@@ -0,0 +1,68 @@
+AM_CFLAGS = -Wundef \
+ -I./ \
+ -I$(WORKSPACE)/system/core/include \
+ -std=c++11 \
+ $(LOCPLA_CFLAGS)
+
+AM_CPPFLAGS = -Wundef \
+ -I./ \
+ -std=c++11 \
+ $(LOCPLA_CFLAGS)
+
+libgps_utils_so_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 \
+ loc_misc_utils.h \
+ loc_nmea.h \
+ gps_extended_c.h \
+ gps_extended.h \
+ loc_gps.h \
+ log_util.h
+
+libgps_utils_so_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 \
+ MsgTask.cpp \
+ loc_misc_utils.cpp \
+ loc_nmea.cpp
+
+
+library_include_HEADERS = $(libgps_utils_so_la_h_sources)
+
+libgps_utils_so_la_SOURCES = $(libgps_utils_so_la_c_sources)
+
+if USE_GLIB
+libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
+libgps_utils_so_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
+else
+libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
+libgps_utils_so_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
+endif
+
+libgps_utils_so_la_LIBADD = -lcutils -lstdc++ -llog $(LOCPLA_LIBS)
+
+#Create and Install libraries
+lib_LTLIBRARIES = libgps_utils_so.la
+library_includedir = $(pkgincludedir)
+pkgconfigdir = $(libdir)/pkgconfig
+
+pkgconfig_DATA = gps-utils.pc
+EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/utils/MsgTask.cpp b/sdm845/utils/MsgTask.cpp
similarity index 100%
rename from utils/MsgTask.cpp
rename to sdm845/utils/MsgTask.cpp
diff --git a/utils/MsgTask.h b/sdm845/utils/MsgTask.h
similarity index 100%
rename from utils/MsgTask.h
rename to sdm845/utils/MsgTask.h
diff --git a/utils/configure.ac b/sdm845/utils/configure.ac
similarity index 100%
rename from utils/configure.ac
rename to sdm845/utils/configure.ac
diff --git a/utils/gps-utils.pc.in b/sdm845/utils/gps-utils.pc.in
similarity index 100%
rename from utils/gps-utils.pc.in
rename to sdm845/utils/gps-utils.pc.in
diff --git a/utils/gps_extended.h b/sdm845/utils/gps_extended.h
similarity index 100%
rename from utils/gps_extended.h
rename to sdm845/utils/gps_extended.h
diff --git a/utils/gps_extended_c.h b/sdm845/utils/gps_extended_c.h
similarity index 100%
rename from utils/gps_extended_c.h
rename to sdm845/utils/gps_extended_c.h
diff --git a/sdm845/utils/linked_list.c b/sdm845/utils/linked_list.c
new file mode 100644
index 0000000..33185d0
--- /dev/null
+++ b/sdm845/utils/linked_list.c
@@ -0,0 +1,324 @@
+/* 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.
+ */
+
+#include "linked_list.h"
+#include <stdio.h>
+#include <string.h>
+
+#define LOG_TAG "LocSvc_utils_ll"
+#include <platform_lib_includes.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+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/sdm845/utils/linked_list.h b/sdm845/utils/linked_list.h
new file mode 100644
index 0000000..a85f09a
--- /dev/null
+++ b/sdm845/utils/linked_list.h
@@ -0,0 +1,217 @@
+/* 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. */
+}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/sdm845/utils/loc_cfg.cpp b/sdm845/utils/loc_cfg.cpp
new file mode 100644
index 0000000..d2364f6
--- /dev/null
+++ b/sdm845/utils/loc_cfg.cpp
@@ -0,0 +1,400 @@
+/* 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 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 <loc_cfg.h>
+#include <platform_lib_includes.h>
+#include <loc_misc_utils.h>
+#ifdef USE_GLIB
+#include <glib.h>
+#endif
+#include "platform_lib_includes.h"
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+static uint32_t DEBUG_LEVEL = 0xff;
+static uint32_t TIMESTAMP = 0;
+
+/* Parameter spec table */
+static const loc_param_s_type loc_param_table[] =
+{
+ {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
+ {"TIMESTAMP", &TIMESTAMP, 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;
+
+/*===========================================================================
+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 + 1);
+ }
+ /* 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, "=", &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;
+ char *lasts;
+ loc_param_v_type config_value;
+ uint32_t i;
+
+ 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);
+}
diff --git a/sdm845/utils/loc_cfg.h b/sdm845/utils/loc_cfg.h
new file mode 100644
index 0000000..0a0f100
--- /dev/null
+++ b/sdm845/utils/loc_cfg.h
@@ -0,0 +1,91 @@
+/* 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 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>
+
+#define LOC_MAX_PARAM_NAME 80
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING)
+
+#define 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;
+ uint8_t *param_set; /* indicate value set by config file */
+ char param_type; /* 'n' for number,
+ 's' for string,
+ 'f' for double */
+} loc_param_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_CFG_H */
diff --git a/utils/loc_gps.h b/sdm845/utils/loc_gps.h
similarity index 100%
rename from utils/loc_gps.h
rename to sdm845/utils/loc_gps.h
diff --git a/sdm845/utils/loc_log.cpp b/sdm845/utils/loc_log.cpp
new file mode 100644
index 0000000..9fad9e6
--- /dev/null
+++ b/sdm845/utils/loc_log.cpp
@@ -0,0 +1,237 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#define LOG_NDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include "loc_log.h"
+#include "msg_q.h"
+#include <platform_lib_includes.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";
+
+/* Logging Mechanism */
+loc_logger_s_type loc_logger;
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value)
+{
+ size_t i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+static const loc_name_val_s_type 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 )
+};
+static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status);
+
+/* Find msg_q status name */
+const char* loc_get_msg_q_status(int status)
+{
+ return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+//Target names
+static const loc_name_val_s_type 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)
+};
+
+static const size_t target_name_num = LOC_TABLE_SIZE(target_name);
+
+/*===========================================================================
+
+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)
+{
+ int index = 0;
+ static char ret[BUFFER_SIZE];
+
+ index = getTargetGnssType(target);
+ if( index < 0 || (unsigned)index >= target_name_num )
+ index = target_name_num - 1;
+
+ if( (target & HAS_SSC) == HAS_SSC ) {
+ snprintf(ret, sizeof(ret), " %s with SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ else {
+ snprintf(ret, sizeof(ret), " %s without SSC",
+ loc_get_name_from_val(target_name, target_name_num, (long)index) );
+ }
+ 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 loc_logger_init
+
+DESCRIPTION
+ Initializes the state of DEBUG_LEVEL and TIMESTAMP
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+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;
+}
+
+
+/*===========================================================================
+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;
+}
+
diff --git a/sdm845/utils/loc_log.h b/sdm845/utils/loc_log.h
new file mode 100644
index 0000000..be492b1
--- /dev/null
+++ b/sdm845/utils/loc_log.h
@@ -0,0 +1,71 @@
+/* Copyright (c) 2011-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.
+ *
+ */
+
+#ifndef LOC_LOG_H
+#define LOC_LOG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <ctype.h>
+#include <stdlib.h>
+#include "loc_target.h"
+
+typedef struct
+{
+ const char *name;
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+#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]))
+
+/* Get names from value */
+const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask);
+const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value);
+const char* loc_get_msg_q_status(int status);
+const char* loc_get_target_name(unsigned int target);
+
+extern const char* log_succ_fail_string(int is_succ);
+
+extern char *loc_get_time(char *time_string, size_t buf_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_LOG_H */
diff --git a/sdm845/utils/loc_misc_utils.cpp b/sdm845/utils/loc_misc_utils.cpp
new file mode 100644
index 0000000..fd3ee6b
--- /dev/null
+++ b/sdm845/utils/loc_misc_utils.cpp
@@ -0,0 +1,114 @@
+/* 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.
+ *
+ */
+#define LOG_NDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
+#include <stdio.h>
+#include <string.h>
+#include <platform_lib_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;
+}
diff --git a/sdm845/utils/loc_misc_utils.h b/sdm845/utils/loc_misc_utils.h
new file mode 100644
index 0000000..7d66d84
--- /dev/null
+++ b/sdm845/utils/loc_misc_utils.h
@@ -0,0 +1,99 @@
+/* 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_MISC_UTILS_H_
+#define _LOC_MISC_UTILS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*===========================================================================
+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);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_LOC_MISC_UTILS_H_
diff --git a/utils/loc_nmea.cpp b/sdm845/utils/loc_nmea.cpp
similarity index 100%
rename from utils/loc_nmea.cpp
rename to sdm845/utils/loc_nmea.cpp
diff --git a/utils/loc_nmea.h b/sdm845/utils/loc_nmea.h
similarity index 100%
rename from utils/loc_nmea.h
rename to sdm845/utils/loc_nmea.h
diff --git a/sdm845/utils/loc_target.cpp b/sdm845/utils/loc_target.cpp
new file mode 100644
index 0000000..cf42932
--- /dev/null
+++ b/sdm845/utils/loc_target.cpp
@@ -0,0 +1,221 @@
+/* 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <cutils/properties.h>
+#include "loc_target.h"
+#include "loc_log.h"
+#include <platform_lib_includes.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_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);
+ 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__);
+ }
+}
+
+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 id[] = "/sys/devices/soc0/soc_id";
+ static const char hw_platform_dep[] =
+ "/sys/devices/system/soc/soc0/hw_platform";
+ static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
+ 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);
+ }
+ if (!access(id, F_OK)) {
+ read_a_line(id, rd_id, LINE_LEN);
+ } else {
+ read_a_line(id_dep, rd_id, LINE_LEN);
+ }
+
+ /*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)) ) {
+
+ 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;
+}
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target
+*/
+int loc_identify_lean_target()
+{
+ int ret = 0;
+ char lean_target[PROPERTY_VALUE_MAX];
+ property_get("ro.lean", lean_target, "");
+ LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
+ return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
+}
diff --git a/sdm845/utils/loc_target.h b/sdm845/utils/loc_target.h
new file mode 100644
index 0000000..47a67d9
--- /dev/null
+++ b/sdm845/utils/loc_target.h
@@ -0,0 +1,84 @@
+/* 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);
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target*/
+int loc_identify_lean_target();
+
+/* Please remember to update 'target_name' in loc_log.cpp,
+ if do any changes to this enum. */
+typedef enum {
+ 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/sdm845/utils/loc_timer.h b/sdm845/utils/loc_timer.h
new file mode 100644
index 0000000..25fd179
--- /dev/null
+++ b/sdm845/utils/loc_timer.h
@@ -0,0 +1,73 @@
+/* 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 <platform_lib_includes.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/sdm845/utils/log_util.h b/sdm845/utils/log_util.h
new file mode 100644
index 0000000..d5884b7
--- /dev/null
+++ b/sdm845/utils/log_util.h
@@ -0,0 +1,173 @@
+/* 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__
+
+#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
+// Android and LE targets with logcat support
+#include <utils/Log.h>
+
+#elif defined (USE_GLIB)
+// LE targets with no logcat support
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef LOG_TAG
+#define LOG_TAG "GPS_UTILS"
+
+#endif // LOG_TAG
+
+#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;
+} loc_logger_s_type;
+
+/*=============================================================================
+ *
+ * EXTERNAL DATA
+ *
+ *============================================================================*/
+extern loc_logger_s_type loc_logger;
+
+// Logging Improvements
+extern const char *loc_logger_boolStr[];
+
+extern const char *boolStr[];
+extern const char VOID_RET[];
+extern const char FROM_AFW[];
+extern const char TO_MODEM[];
+extern const char FROM_MODEM[];
+extern const char TO_AFW[];
+extern const char EXIT_TAG[];
+extern const char ENTRY_TAG[];
+extern const char EXIT_ERROR_TAG[];
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_logger_init(unsigned long debug, unsigned long timestamp);
+extern char* get_timestamp(char* str, unsigned long buf_size);
+
+#ifndef DEBUG_DMN_LOC_API
+
+/* LOGGING MACROS */
+/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp
+ if that value remains unchanged, it means gps.conf did not
+ provide a value and we default to the initial value to use
+ Android's logging levels*/
+#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5))
+#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5))
+
+#define LOC_LOGE(...) IF_LOC_LOGE { ALOGE(__VA_ARGS__); }
+#define LOC_LOGW(...) IF_LOC_LOGW { ALOGW(__VA_ARGS__); }
+#define LOC_LOGI(...) IF_LOC_LOGI { ALOGI(__VA_ARGS__); }
+#define LOC_LOGD(...) IF_LOC_LOGD { ALOGD(__VA_ARGS__); }
+#define LOC_LOGV(...) IF_LOC_LOGV { ALOGV(__VA_ARGS__); }
+
+#else /* DEBUG_DMN_LOC_API */
+
+#define LOC_LOGE(...) ALOGE(__VA_ARGS__)
+#define LOC_LOGW(...) ALOGW(__VA_ARGS__)
+#define LOC_LOGI(...) ALOGI(__VA_ARGS__)
+#define LOC_LOGD(...) ALOGD(__VA_ARGS__)
+#define LOC_LOGV(...) ALOGV(__VA_ARGS__)
+
+#endif /* DEBUG_DMN_LOC_API */
+
+/*=============================================================================
+ *
+ * LOGGING IMPROVEMENT MACROS
+ *
+ *============================================================================*/
+#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \
+ do { \
+ if (loc_logger.TIMESTAMP) { \
+ char ts[32]; \
+ LOC_LOG("[%s] %s %s line %d " #SPEC, \
+ get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \
+ } else { \
+ LOC_LOG("%s %s line %d " #SPEC, \
+ ID, WHAT, __LINE__, VAL); \
+ } \
+ } while(0)
+
+#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
+#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
+#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
+#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
+
+#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
+#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
+ if (VAL != 0) { \
+ LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \
+ } else { \
+ LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \
+ }
+
+
+// Used for logging callflow from Android Framework
+#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
+// Used for logging callflow to Modem
+#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow from Modem(TO_MODEM, __FUNCTION__, %s, "")
+#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __FUNCTION__, SPEC, VAL)
+// Used for logging callflow to Android Framework
+#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __LOG_UTIL_H__
diff --git a/sdm845/utils/msg_q.c b/sdm845/utils/msg_q.c
new file mode 100644
index 0000000..e8b4ffe
--- /dev/null
+++ b/sdm845/utils/msg_q.c
@@ -0,0 +1,333 @@
+/* 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.
+ */
+
+#include "msg_q.h"
+
+#define LOG_TAG "LocSvc_utils_q"
+#include <platform_lib_includes.h>
+#include "linked_list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+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_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/sdm845/utils/msg_q.h b/sdm845/utils/msg_q.h
new file mode 100644
index 0000000..453b8ce
--- /dev/null
+++ b/sdm845/utils/msg_q.h
@@ -0,0 +1,207 @@
+/* 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_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/utils/platform_lib_abstractions/Android.mk b/sdm845/utils/platform_lib_abstractions/Android.mk
similarity index 100%
copy from utils/platform_lib_abstractions/Android.mk
copy to sdm845/utils/platform_lib_abstractions/Android.mk
diff --git a/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/sdm845/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
rename to sdm845/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp
diff --git a/utils/platform_lib_abstractions/loc_pla/Android.mk b/sdm845/utils/platform_lib_abstractions/loc_pla/Android.mk
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/Android.mk
rename to sdm845/utils/platform_lib_abstractions/loc_pla/Android.mk
diff --git a/utils/platform_lib_abstractions/loc_pla/Makefile.am b/sdm845/utils/platform_lib_abstractions/loc_pla/Makefile.am
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/Makefile.am
rename to sdm845/utils/platform_lib_abstractions/loc_pla/Makefile.am
diff --git a/utils/platform_lib_abstractions/loc_pla/configure.ac b/sdm845/utils/platform_lib_abstractions/loc_pla/configure.ac
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/configure.ac
rename to sdm845/utils/platform_lib_abstractions/loc_pla/configure.ac
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
copy to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
copy to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
rename to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
rename to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
copy to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
copy to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h
diff --git a/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
copy to sdm845/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h
diff --git a/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/sdm845/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
rename to sdm845/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in
diff --git a/utils/platform_lib_abstractions/loc_pla/src/Android.mk b/sdm845/utils/platform_lib_abstractions/loc_pla/src/Android.mk
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/Android.mk
rename to sdm845/utils/platform_lib_abstractions/loc_pla/src/Android.mk
diff --git a/utils/platform_lib_abstractions/loc_pla/src/Makefile.am b/sdm845/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/Makefile.am
rename to sdm845/utils/platform_lib_abstractions/loc_pla/src/Makefile.am
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp b/sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
copy to sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp b/sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
rename to sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
rename to sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp b/sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
copy to sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp
diff --git a/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp b/sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
similarity index 100%
copy from utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
copy to sdm845/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp
diff --git a/utils/platform_lib_abstractions/loc_stub/Android.mk b/sdm845/utils/platform_lib_abstractions/loc_stub/Android.mk
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/Android.mk
rename to sdm845/utils/platform_lib_abstractions/loc_stub/Android.mk
diff --git a/utils/platform_lib_abstractions/loc_stub/Makefile.am b/sdm845/utils/platform_lib_abstractions/loc_stub/Makefile.am
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/Makefile.am
rename to sdm845/utils/platform_lib_abstractions/loc_stub/Makefile.am
diff --git a/utils/platform_lib_abstractions/loc_stub/configure.ac b/sdm845/utils/platform_lib_abstractions/loc_stub/configure.ac
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/configure.ac
rename to sdm845/utils/platform_lib_abstractions/loc_stub/configure.ac
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h b/sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
copy to sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h b/sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
copy to sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h b/sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
copy to sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h b/sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
copy to sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h
diff --git a/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h b/sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
copy to sdm845/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h
diff --git a/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in b/sdm845/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
rename to sdm845/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in
diff --git a/utils/platform_lib_abstractions/loc_stub/src/Android.mk b/sdm845/utils/platform_lib_abstractions/loc_stub/src/Android.mk
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/Android.mk
rename to sdm845/utils/platform_lib_abstractions/loc_stub/src/Android.mk
diff --git a/utils/platform_lib_abstractions/loc_stub/src/Makefile.am b/sdm845/utils/platform_lib_abstractions/loc_stub/src/Makefile.am
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/Makefile.am
rename to sdm845/utils/platform_lib_abstractions/loc_stub/src/Makefile.am
diff --git a/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp b/sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
rename to sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp
diff --git a/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp b/sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
similarity index 100%
copy from utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
copy to sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp
diff --git a/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp b/sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
rename to sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp
diff --git a/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp b/sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
rename to sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp
diff --git a/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp b/sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
similarity index 100%
rename from utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
rename to sdm845/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp
diff --git a/utils/Android.mk b/utils/Android.mk
index 1352076..f34e101 100644
--- a/utils/Android.mk
+++ b/utils/Android.mk
@@ -6,13 +6,11 @@
include $(CLEAR_VARS)
-
## Libs
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
- liblog \
- libloc_pla
+ liblog
LOCAL_SRC_FILES += \
loc_log.cpp \
@@ -20,16 +18,10 @@
msg_q.c \
linked_list.c \
loc_target.cpp \
- platform_lib_abstractions/elapsed_millis_since_boot.cpp \
- LocHeap.cpp \
- LocTimer.cpp \
- LocThread.cpp \
- MsgTask.cpp \
- loc_misc_utils.cpp \
- loc_nmea.cpp \
- LocIpc.cpp
+ loc_timer.c \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp \
+ loc_misc_utils.cpp
-# Flag -std=c++11 is not accepted by compiler when LOCAL_CLANG is set to true
LOCAL_CFLAGS += \
-fno-short-enums \
-D_ANDROID_
@@ -41,26 +33,29 @@
LOCAL_LDFLAGS += -Wl,--export-dynamic
## Includes
-LOCAL_HEADER_LIBRARIES := \
- libloc_pla_headers \
- liblocation_api_headers
+LOCAL_C_INCLUDES:= \
+ $(LOCAL_PATH)/../platform_lib_abstractions
+
+LOCAL_COPY_HEADERS_TO:= gps.utils/
+LOCAL_COPY_HEADERS:= \
+ loc_log.h \
+ loc_cfg.h \
+ log_util.h \
+ linked_list.h \
+ msg_q.h \
+ loc_target.h \
+ loc_timer.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h \
+ loc_misc_utils.h
LOCAL_MODULE := libgps.utils
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
+
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)
-
-include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, platform_lib_abstractions))
endif # not BUILD_TINY_ANDROID
endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 506309c..e5935f0 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,47 +1,28 @@
AM_CFLAGS = -Wundef \
- -I./ \
- -I$(WORKSPACE)/system/core/include \
- -std=c++11 \
- $(LOCPLA_CFLAGS)
+ -MD \
+ -Wno-trigraphs \
+ -g -O0 \
+ -fno-inline \
+ -fno-short-enums \
+ -fpic \
+ -I../platform_lib_abstractions
-AM_CPPFLAGS = -Wundef \
- -I./ \
- -std=c++11 \
- $(LOCPLA_CFLAGS)
+libgps_utils_so_la_h_sources = log_util.h \
+ msg_q.h \
+ linked_list.h \
+ loc_cfg.h \
+ loc_log.h \
+ ../platform_lib_abstractions/platform_lib_includes.h \
+ ../platform_lib_abstractions/platform_lib_time.h \
+ ../platform_lib_abstractions/platform_lib_macros.h
-libgps_utils_so_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 \
- loc_misc_utils.h \
- loc_nmea.h \
- gps_extended_c.h \
- gps_extended.h \
- loc_gps.h \
- log_util.h
+libgps_utils_so_la_c_sources = linked_list.c \
+ msg_q.c \
+ loc_cfg.cpp \
+ loc_log.cpp \
+ ../platform_lib_abstractions/elapsed_millis_since_boot.cpp
-libgps_utils_so_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 \
- MsgTask.cpp \
- loc_misc_utils.cpp \
- loc_nmea.cpp
-
+library_includedir = $(pkgincludedir)/utils
library_include_HEADERS = $(libgps_utils_so_la_h_sources)
@@ -49,20 +30,15 @@
if USE_GLIB
libgps_utils_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
-libgps_utils_so_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
+libgps_utils_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0
libgps_utils_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
libgps_utils_so_la_CFLAGS = $(AM_CFLAGS)
-libgps_utils_so_la_LDFLAGS = -Wl,-z,defs -lpthread -shared -version-info 1:0:0
+libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
-libgps_utils_so_la_LIBADD = -lcutils -lstdc++ -llog $(LOCPLA_LIBS)
+libgps_utils_so_la_LIBADD = -lstdc++ -lcutils
#Create and Install libraries
lib_LTLIBRARIES = libgps_utils_so.la
-library_includedir = $(pkgincludedir)
-pkgconfigdir = $(libdir)/pkgconfig
-
-pkgconfig_DATA = gps-utils.pc
-EXTRA_DIST = $(pkgconfig_DATA)
diff --git a/utils/linked_list.c b/utils/linked_list.c
index 33185d0..92617fe 100644
--- a/utils/linked_list.c
+++ b/utils/linked_list.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2014, 2017 The Linux Foundation. All rights reserved.
+/* 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
@@ -31,7 +31,8 @@
#include <string.h>
#define LOG_TAG "LocSvc_utils_ll"
-#include <platform_lib_includes.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
#include <stdlib.h>
#include <stdint.h>
@@ -108,6 +109,7 @@
===========================================================================*/
linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dealloc)(void*))
{
+ LOC_LOGD("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, data_obj);
if( list_data == NULL )
{
LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
@@ -159,6 +161,7 @@
===========================================================================*/
linked_list_err_type linked_list_remove(void* list_data, void **data_obj)
{
+ LOC_LOGD("%s: Removing from list\n", __FUNCTION__);
if( list_data == NULL )
{
LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__);
@@ -265,6 +268,7 @@
bool (*equal)(void* data_0, void* data),
void* data_0, bool rm_if_found)
{
+ LOC_LOGD("%s: Search the list\n", __FUNCTION__);
if( list_data == NULL || NULL == equal )
{
LOC_LOGE("%s: Invalid list parameter! list_data %p equal %p\n",
diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp
index d2364f6..5c33320 100644
--- a/utils/loc_cfg.cpp
+++ b/utils/loc_cfg.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* 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
@@ -27,7 +27,7 @@
*
*/
-#define LOG_NDEBUG 0
+#define LOG_NDDEBUG 0
#define LOG_TAG "LocSvc_utils_cfg"
#include <stdio.h>
@@ -38,7 +38,7 @@
#include <unistd.h>
#include <time.h>
#include <loc_cfg.h>
-#include <platform_lib_includes.h>
+#include <log_util.h>
#include <loc_misc_utils.h>
#ifdef USE_GLIB
#include <glib.h>
@@ -56,12 +56,12 @@
static uint32_t TIMESTAMP = 0;
/* Parameter spec table */
-static const loc_param_s_type loc_param_table[] =
+static loc_param_s_type loc_param_table[] =
{
{"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'},
{"TIMESTAMP", &TIMESTAMP, NULL, 'n'},
};
-static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type);
+int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type);
typedef struct loc_param_v_type
{
@@ -92,7 +92,7 @@
SIDE EFFECTS
N/A
===========================================================================*/
-int loc_set_config_entry(const loc_param_s_type* config_entry, loc_param_v_type* config_value)
+int loc_set_config_entry(loc_param_s_type* config_entry, loc_param_v_type* config_value)
{
int ret=-1;
if(NULL == config_entry || NULL == config_value)
@@ -181,7 +181,7 @@
N/A
===========================================================================*/
int loc_fill_conf_item(char* input_buf,
- const loc_param_s_type* config_table, uint32_t table_length)
+ loc_param_s_type* config_table, uint32_t table_length)
{
int ret = 0;
@@ -258,7 +258,7 @@
SIDE EFFECTS
N/A
===========================================================================*/
-int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, uint32_t table_length)
+int loc_read_conf_r(FILE *conf_fp, loc_param_s_type* config_table, uint32_t table_length)
{
int ret=0;
@@ -322,7 +322,7 @@
N/A
===========================================================================*/
int loc_update_conf(const char* conf_data, int32_t length,
- const loc_param_s_type* config_table, uint32_t table_length)
+ loc_param_s_type* config_table, uint32_t table_length)
{
int ret = -1;
@@ -377,7 +377,7 @@
SIDE EFFECTS
N/A
===========================================================================*/
-void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_table,
+void loc_read_conf(const char* conf_file_name, loc_param_s_type* config_table,
uint32_t table_length)
{
FILE *conf_fp = NULL;
diff --git a/utils/loc_cfg.h b/utils/loc_cfg.h
index 0a0f100..ea4865b 100644
--- a/utils/loc_cfg.h
+++ b/utils/loc_cfg.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* 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
@@ -54,12 +54,12 @@
*============================================================================*/
typedef struct
{
- const char *param_name;
+ char param_name[LOC_MAX_PARAM_NAME];
void *param_ptr;
- uint8_t *param_set; /* indicate value set by config file */
+ uint8_t *param_set; /* was this value set by config file? */
char param_type; /* 'n' for number,
's' for string,
- 'f' for double */
+ 'f' for float */
} loc_param_s_type;
/*=============================================================================
@@ -78,12 +78,12 @@
*
*============================================================================*/
void loc_read_conf(const char* conf_file_name,
- const loc_param_s_type* config_table,
+ 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,
+int loc_read_conf_r(FILE *conf_fp, 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);
+ loc_param_s_type* config_table, uint32_t table_length);
#ifdef __cplusplus
}
#endif
diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp
index 9fad9e6..e0f8478 100644
--- a/utils/loc_log.cpp
+++ b/utils/loc_log.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, 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
@@ -27,14 +27,19 @@
*
*/
-#define LOG_NDEBUG 0
+#define LOG_NDDEBUG 0
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
+#include <time.h>
#include "loc_log.h"
#include "msg_q.h"
-#include <platform_lib_includes.h>
+#ifdef USE_GLIB
+#include <time.h>
+#endif /* USE_GLIB */
+#include "log_util.h"
+#include "platform_lib_includes.h"
#define BUFFER_SIZE 120
@@ -47,15 +52,14 @@
const char TO_AFW[] = "<===";
const char EXIT_TAG[] = "Exiting";
const char ENTRY_TAG[] = "Entering";
-const char EXIT_ERROR_TAG[] = "Exiting with error";
/* Logging Mechanism */
loc_logger_s_type loc_logger;
/* Get names from value */
-const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask)
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask)
{
- size_t i;
+ int i;
for (i = 0; i < table_size; i++)
{
if (table[i].val & (long) mask)
@@ -67,9 +71,9 @@
}
/* Get names from value */
-const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value)
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value)
{
- size_t i;
+ int i;
for (i = 0; i < table_size; i++)
{
if (table[i].val == (long) value)
@@ -80,7 +84,7 @@
return UNKNOWN_STR;
}
-static const loc_name_val_s_type loc_msg_q_status[] =
+static loc_name_val_s_type loc_msg_q_status[] =
{
NAME_VAL( eMSG_Q_SUCCESS ),
NAME_VAL( eMSG_Q_FAILURE_GENERAL ),
@@ -89,7 +93,7 @@
NAME_VAL( eMSG_Q_UNAVAILABLE_RESOURCE ),
NAME_VAL( eMSG_Q_INSUFFICIENT_BUFFER )
};
-static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status);
+static int loc_msg_q_status_num = sizeof(loc_msg_q_status) / sizeof(loc_name_val_s_type);
/* Find msg_q status name */
const char* loc_get_msg_q_status(int status)
@@ -103,17 +107,18 @@
}
//Target names
-static const loc_name_val_s_type target_name[] =
+loc_name_val_s_type target_name[] =
{
NAME_VAL(GNSS_NONE),
NAME_VAL(GNSS_MSM),
NAME_VAL(GNSS_GSS),
NAME_VAL(GNSS_MDM),
+ NAME_VAL(GNSS_QCA1530),
NAME_VAL(GNSS_AUTO),
NAME_VAL(GNSS_UNKNOWN)
};
-static const size_t target_name_num = LOC_TABLE_SIZE(target_name);
+static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type);
/*===========================================================================
@@ -134,7 +139,7 @@
static char ret[BUFFER_SIZE];
index = getTargetGnssType(target);
- if( index < 0 || (unsigned)index >= target_name_num )
+ if( index >= target_name_num || index < 0)
index = target_name_num - 1;
if( (target & HAS_SSC) == HAS_SSC ) {
@@ -163,7 +168,7 @@
The time string
===========================================================================*/
-char *loc_get_time(char *time_string, size_t buf_size)
+char *loc_get_time(char *time_string, unsigned long buf_size)
{
struct timeval now; /* sec and usec */
struct tm now_tm; /* broken-down time */
diff --git a/utils/loc_log.h b/utils/loc_log.h
index be492b1..82dc636 100644
--- a/utils/loc_log.h
+++ b/utils/loc_log.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, 2015 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, 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
@@ -36,13 +36,12 @@
#endif
#include <ctype.h>
-#include <stdlib.h>
#include "loc_target.h"
typedef struct
{
- const char *name;
- long val;
+ char name[128];
+ long val;
} loc_name_val_s_type;
#define NAME_VAL(x) {"" #x "", x }
@@ -50,19 +49,17 @@
#define UNKNOWN_STR "UNKNOWN"
#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]))
+ ((mask_var & mask) ? (type) value : (type) (-1))
/* Get names from value */
-const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask);
-const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value);
+const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask);
+const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value);
const char* loc_get_msg_q_status(int status);
const char* loc_get_target_name(unsigned int target);
extern const char* log_succ_fail_string(int is_succ);
-extern char *loc_get_time(char *time_string, size_t buf_size);
+extern char *loc_get_time(char *time_string, unsigned long buf_size);
#ifdef __cplusplus
}
diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp
index fd3ee6b..7e96313 100644
--- a/utils/loc_misc_utils.cpp
+++ b/utils/loc_misc_utils.cpp
@@ -26,14 +26,14 @@
* 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 <platform_lib_log_util.h>
+#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
+#define LOG_NDDEBUG 0
+#define LOG_TAG "LocSvc_misc_utils"
int loc_util_split_string(char *raw_string, char **split_strings_ptr,
int max_num_substrings, char delimiter)
diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp
index cf42932..b14ec42 100644
--- a/utils/loc_target.cpp
+++ b/utils/loc_target.cpp
@@ -34,10 +34,11 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
+#include <hardware/gps.h>
#include <cutils/properties.h>
#include "loc_target.h"
#include "loc_log.h"
-#include <platform_lib_includes.h>
+#include "log_util.h"
#define APQ8064_ID_1 "109"
#define APQ8064_ID_2 "153"
@@ -48,19 +49,21 @@
#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_MSM "msm"
-#define STR_SDM "sdm" // alternative string for MSM targets
-#define STR_APQ_NO_WGR "baseband_apq_nowgr"
-#define STR_AUTO "auto"
+#define STR_LIQUID "Liquid"
+#define STR_SURF "Surf"
+#define STR_MTP "MTP"
+#define STR_APQ "apq"
+#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
+/* When system server is started, it uses 20 seconds as ActivityManager
+ * timeout. After that it sends SIGSTOP signal to process.
+ */
+#define QCA1530_DETECT_TIMEOUT 15
+#define QCA1530_DETECT_PRESENT "yes"
+#define QCA1530_DETECT_PROGRESS "detect"
static unsigned int gTarget = (unsigned int)-1;
@@ -86,6 +89,63 @@
return result;
}
+/*!
+ * \brief Checks if QCA1530 is avalable.
+ *
+ * Function verifies if qca1530 SoC is configured on the device. The test is
+ * based on property value. For 1530 scenario, the value shall be one of the
+ * following: "yes", "no", "detect". All other values are treated equally to
+ * "no". When the value is "detect" the system waits for SoC detection to
+ * finish before returning result.
+ *
+ * \retval true - QCA1530 is available.
+ * \retval false - QCA1530 is not available.
+ */
+static bool is_qca1530(void)
+{
+ static const char qca1530_property_name[] = "sys.qca1530";
+ bool res = false;
+ int ret, i;
+ char buf[PROPERTY_VALUE_MAX];
+
+ memset(buf, 0, sizeof(buf));
+
+ for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i)
+ {
+ ret = property_get(qca1530_property_name, buf, NULL);
+ if (ret < 0)
+ {
+ LOC_LOGV( "qca1530: property %s is not accessible, ret=%d",
+ qca1530_property_name,
+ ret);
+
+ break;
+ }
+
+ LOC_LOGV( "qca1530: property %s is set to %s",
+ qca1530_property_name,
+ buf);
+
+ if (!memcmp(buf, QCA1530_DETECT_PRESENT,
+ sizeof(QCA1530_DETECT_PRESENT)))
+ {
+ res = true;
+ break;
+ }
+ if (!memcmp(buf, QCA1530_DETECT_PROGRESS,
+ sizeof(QCA1530_DETECT_PROGRESS)))
+ {
+ LOC_LOGV("qca1530: SoC detection is in progress.");
+ sleep(1);
+ continue;
+ }
+ break;
+ }
+
+ LOC_LOGD("qca1530: detected=%s", res ? "true" : "false");
+ return res;
+}
+
/*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)
@@ -114,20 +174,6 @@
}
}
-/*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__);
- }
-}
-
unsigned int loc_get_target(void)
{
if (gTarget != (unsigned int)-1)
@@ -138,13 +184,17 @@
static const char hw_platform_dep[] =
"/sys/devices/system/soc/soc0/hw_platform";
static const char id_dep[] = "/sys/devices/system/soc/soc0/id";
- static const char mdm[] = "/target"; // mdm target we are using
+ static const char mdm[] = "/dev/mdm"; // No such file or directory
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];
+
+ if (is_qca1530()) {
+ gTarget = TARGET_QCA1530;
+ goto detected;
+ }
loc_get_target_baseband(baseband, sizeof(baseband));
@@ -158,64 +208,40 @@
} else {
read_a_line(id_dep, rd_id, LINE_LEN);
}
-
- /*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)) )
+ if( !memcmp(baseband, 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)) ) {
+ if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
&& IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
- gTarget = TARGET_NO_GNSS;
+ gTarget = TARGET_MPQ;
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;
+ }
+ 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)]))) {
+
+ if (!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
+ gTarget = TARGET_UNKNOWN;
}
detected:
- LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget);
+ LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
return gTarget;
}
-
-/*Reads the property ro.lean to identify if this is a lean target
- Returns:
- 0 if not a lean and mean target
- 1 if this is a lean and mean target
-*/
-int loc_identify_lean_target()
-{
- int ret = 0;
- char lean_target[PROPERTY_VALUE_MAX];
- property_get("ro.lean", lean_target, "");
- LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
- return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
-}
diff --git a/utils/loc_target.h b/utils/loc_target.h
index 47a67d9..873ddfc 100644
--- a/utils/loc_target.h
+++ b/utils/loc_target.h
@@ -32,8 +32,9 @@
#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_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
+#define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, 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)
@@ -51,15 +52,6 @@
/*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);
-
-/*Reads the property ro.lean to identify if this is a lean target
- Returns:
- 0 if not a lean and mean target
- 1 if this is a lean and mean target*/
-int loc_identify_lean_target();
/* Please remember to update 'target_name' in loc_log.cpp,
if do any changes to this enum. */
@@ -68,6 +60,7 @@
GNSS_MSM,
GNSS_GSS,
GNSS_MDM,
+ GNSS_QCA1530,
GNSS_AUTO,
GNSS_UNKNOWN
}GNSS_TARGET;
diff --git a/utils/loc_timer.c b/utils/loc_timer.c
new file mode 100644
index 0000000..2beca5f
--- /dev/null
+++ b/utils/loc_timer.c
@@ -0,0 +1,202 @@
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation, nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include<stdio.h>
+#include<stdlib.h>
+#include<sys/time.h>
+#include "loc_timer.h"
+#include<time.h>
+#include<errno.h>
+
+enum timer_state {
+ READY = 100,
+ WAITING,
+ DONE,
+ ABORT
+};
+
+typedef struct {
+ loc_timer_callback callback_func;
+ void *user_data;
+ unsigned int time_msec;
+ pthread_cond_t timer_cond;
+ pthread_mutex_t timer_mutex;
+ enum timer_state state;
+}timer_data;
+
+static void *timer_thread(void *thread_data)
+{
+ int ret = -ETIMEDOUT;
+ struct timespec ts;
+ struct timeval tv;
+ timer_data* t = (timer_data*)thread_data;
+
+ LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t->time_msec);
+
+ gettimeofday(&tv, NULL);
+ clock_gettime(CLOCK_REALTIME, &ts);
+ if(t->time_msec >= 1000) {
+ ts.tv_sec += t->time_msec/1000;
+ t->time_msec = t->time_msec % 1000;
+ }
+ if(t->time_msec)
+ ts.tv_nsec += t->time_msec * 1000000;
+ if(ts.tv_nsec > 999999999) {
+ LOC_LOGD("%s:%d]: Large nanosecs\n", __func__, __LINE__);
+ ts.tv_sec += 1;
+ ts.tv_nsec -= 1000000000;
+ }
+ LOC_LOGD("%s:%d]: ts.tv_sec:%d; ts.tv_nsec:%d\n"
+ "\t Current time: %d sec; %d nsec",
+ __func__, __LINE__, (int)ts.tv_sec, (int)ts.tv_nsec,
+ (int)tv.tv_sec, (int)tv.tv_usec*1000);
+
+ pthread_mutex_lock(&(t->timer_mutex));
+ if (READY == t->state) {
+ t->state = WAITING;
+ ret = pthread_cond_timedwait(&t->timer_cond, &t->timer_mutex, &ts);
+ t->state = DONE;
+ }
+ pthread_mutex_unlock(&(t->timer_mutex));
+
+ switch (ret) {
+ case ETIMEDOUT:
+ LOC_LOGV("%s:%d]: loc_timer timed out", __func__, __LINE__);
+ break;
+ case 0:
+ LOC_LOGV("%s:%d]: loc_timer stopped", __func__, __LINE__);
+ break;
+ case -ETIMEDOUT:
+ LOC_LOGV("%s:%d]: loc_timer cancelled", __func__, __LINE__);
+ break;
+ default:
+ LOC_LOGE("%s:%d]: Call to pthread timedwait failed; ret=%d\n",
+ __func__, __LINE__, ret);
+ break;
+ }
+
+ if(ETIMEDOUT == ret)
+ t->callback_func(t->user_data, ret);
+
+ // A (should be rare) race condition is that, when the loc_time_stop is called
+ // and acquired mutex, we reach here. pthread_mutex_destroy will fail with
+ // error code EBUSY. We give it 6 tries in 5 seconds. Should be eanough time
+ // for loc_timer_stop to complete. With the 7th try, we also perform unlock
+ // prior to destroy.
+ {
+ int i;
+ for (i = 0; EBUSY == pthread_mutex_destroy(&t->timer_mutex) && i <= 5; i++) {
+ if (i < 5) {
+ sleep(1);
+ } else {
+ // nah, forget it, something is seriously wrong. Mutex has been
+ // held too long. Unlock the mutext here.
+ pthread_mutex_unlock(&t->timer_mutex);
+ }
+ }
+ }
+ pthread_cond_destroy(&t->timer_cond);
+
+ free(t);
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return NULL;
+}
+
+void* loc_timer_start(unsigned int msec, loc_timer_callback cb_func,
+ void* caller_data)
+{
+ timer_data *t=NULL;
+ pthread_attr_t tattr;
+ pthread_t id;
+ LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__);
+ if(cb_func == NULL || msec == 0) {
+ LOC_LOGE("%s:%d]: Error: Wrong parameters\n", __func__, __LINE__);
+ goto _err;
+ }
+ t = (timer_data *)calloc(1, sizeof(timer_data));
+ if(t == NULL) {
+ LOC_LOGE("%s:%d]: Could not allocate memory. Failing.\n",
+ __func__, __LINE__);
+ goto _err;
+ }
+
+ if(pthread_cond_init(&(t->timer_cond), NULL)) {
+ LOC_LOGE("%s:%d]: Pthread cond init failed\n", __func__, __LINE__);
+ goto t_err;
+ }
+ if(pthread_mutex_init(&(t->timer_mutex), NULL)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ goto cond_err;
+ }
+
+ t->callback_func = cb_func;
+ t->user_data = caller_data;
+ t->time_msec = msec;
+ t->state = READY;
+
+ if (pthread_attr_init(&tattr)) {
+ LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__);
+ goto mutex_err;
+ }
+ pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
+
+ if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) {
+ LOC_LOGE("%s:%d]: Could not create thread\n", __func__, __LINE__);
+ goto attr_err;
+ }
+
+ LOC_LOGD("%s:%d]: Created thread with id: %d\n",
+ __func__, __LINE__, (int)id);
+ goto _err;
+
+attr_err:
+ pthread_attr_destroy(&tattr);
+mutex_err:
+ pthread_mutex_destroy(&t->timer_mutex);
+cond_err:
+ pthread_cond_destroy(&t->timer_cond);
+t_err:
+ free(t);
+_err:
+ LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__);
+ return t;
+}
+
+void loc_timer_stop(void* handle) {
+ timer_data* t = (timer_data*)handle;
+
+ if (NULL != t && (READY == t->state || WAITING == t->state) &&
+ pthread_mutex_lock(&(t->timer_mutex)) == 0) {
+ if (READY == t->state || WAITING == t->state) {
+ pthread_cond_signal(&t->timer_cond);
+ t->state = ABORT;
+ }
+ pthread_mutex_unlock(&(t->timer_mutex));
+ }
+}
diff --git a/utils/loc_timer.h b/utils/loc_timer.h
index 25fd179..0034d27 100644
--- a/utils/loc_timer.h
+++ b/utils/loc_timer.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013,2015 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,38 +33,28 @@
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-#include <stddef.h>
-#include <platform_lib_includes.h>
+#include<pthread.h>
+#include "log_util.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.
+ Return values:
+ Success = 0
+ Failure = Non zero
*/
-typedef void (*loc_timer_callback)(void *user_data, int32_t result);
+typedef void(*loc_timer_callback)(void *user_data, int 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).
+ Returns the handle, which can be used to stop the timer
*/
-void* loc_timer_start(uint64_t delay_msec,
- loc_timer_callback cb_func,
- void *user_data,
- bool wake_on_expire=false);
+void* loc_timer_start(unsigned int delay_msec,
+ loc_timer_callback,
+ void* user_data);
/*
- handle becomes invalid upon the return of the callback
+ handle becomes invalid upon the return of the callback
*/
-void loc_timer_stop(void*& handle);
+void loc_timer_stop(void* handle);
#ifdef __cplusplus
}
diff --git a/utils/log_util.h b/utils/log_util.h
index d5884b7..8657828 100644
--- a/utils/log_util.h
+++ b/utils/log_util.h
@@ -30,12 +30,12 @@
#ifndef __LOG_UTIL_H__
#define __LOG_UTIL_H__
-#if defined (USE_ANDROID_LOGGING) || defined (ANDROID)
-// Android and LE targets with logcat support
+#ifndef USE_GLIB
#include <utils/Log.h>
+#endif /* USE_GLIB */
-#elif defined (USE_GLIB)
-// LE targets with no logcat support
+#ifdef USE_GLIB
+
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
@@ -45,7 +45,7 @@
#endif // LOG_TAG
-#endif /* #if defined (USE_ANDROID_LOGGING) || defined (ANDROID) */
+#endif /* USE_GLIB */
#ifdef __cplusplus
extern "C"
@@ -81,8 +81,6 @@
extern const char TO_AFW[];
extern const char EXIT_TAG[];
extern const char ENTRY_TAG[];
-extern const char EXIT_ERROR_TAG[];
-
/*=============================================================================
*
* MODULE EXPORTED FUNCTIONS
@@ -137,25 +135,12 @@
} \
} while(0)
-#define LOC_LOG_HEAD(fmt) "%s:%d] " fmt
-#define LOC_LOGv(fmt,...) LOC_LOGV(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOC_LOGw(fmt,...) LOC_LOGW(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOC_LOGd(fmt,...) LOC_LOGD(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#define LOC_LOGe(fmt,...) LOC_LOGE(LOC_LOG_HEAD(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL)
#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL)
-#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL)
-#define ENTRY_LOG() LOG_V(ENTRY_TAG, __FUNCTION__, %s, "")
-#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL)
-#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \
- if (VAL != 0) { \
- LOG_E(EXIT_ERROR_TAG, __FUNCTION__, SPEC, VAL); \
- } else { \
- LOG_V(EXIT_TAG, __FUNCTION__, SPEC, VAL); \
- }
-
+#define ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "")
+#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL)
// Used for logging callflow from Android Framework
#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __FUNCTION__, %s, "")
diff --git a/utils/msg_q.c b/utils/msg_q.c
index e8b4ffe..f82d4c0 100644
--- a/utils/msg_q.c
+++ b/utils/msg_q.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, 2014, 2017 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2012, 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
@@ -29,7 +29,8 @@
#include "msg_q.h"
#define LOG_TAG "LocSvc_utils_q"
-#include <platform_lib_includes.h>
+#include "log_util.h"
+#include "platform_lib_includes.h"
#include "linked_list.h"
#include <stdio.h>
#include <stdlib.h>
@@ -198,7 +199,7 @@
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);
+ LOC_LOGD("%s: Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj);
if( p_msg_q->unblocked )
{
@@ -214,7 +215,7 @@
pthread_mutex_unlock(&p_msg_q->list_mutex);
- LOC_LOGV("%s: Finished Sending message with handle = %p\n", __FUNCTION__, msg_obj);
+ LOC_LOGD("%s: Finished Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj);
return rv;
}
@@ -241,6 +242,8 @@
msg_q* p_msg_q = (msg_q*)msg_q_data;
+ LOC_LOGD("%s: Waiting on message\n", __FUNCTION__);
+
pthread_mutex_lock(&p_msg_q->list_mutex);
if( p_msg_q->unblocked )
@@ -260,7 +263,7 @@
pthread_mutex_unlock(&p_msg_q->list_mutex);
- LOC_LOGV("%s: Received message %p rv = %d\n", __FUNCTION__, *msg_obj, rv);
+ LOC_LOGD("%s: Received message 0x%08X rv = %d\n", __FUNCTION__, *msg_obj, rv);
return rv;
}