diff options
Diffstat (limited to 'gps/core')
-rw-r--r-- | gps/core/Android.mk | 58 | ||||
-rw-r--r-- | gps/core/ContextBase.cpp | 138 | ||||
-rw-r--r-- | gps/core/ContextBase.h | 144 | ||||
-rw-r--r-- | gps/core/LBSProxyBase.h | 80 | ||||
-rw-r--r-- | gps/core/LocAdapterBase.cpp | 149 | ||||
-rw-r--r-- | gps/core/LocAdapterBase.h | 131 | ||||
-rw-r--r-- | gps/core/LocAdapterProxyBase.h | 75 | ||||
-rw-r--r-- | gps/core/LocApiBase.cpp | 593 | ||||
-rw-r--r-- | gps/core/LocApiBase.h | 274 | ||||
-rw-r--r-- | gps/core/LocDualContext.cpp | 151 | ||||
-rw-r--r-- | gps/core/LocDualContext.h | 76 | ||||
-rw-r--r-- | gps/core/Makefile.am | 46 | ||||
-rw-r--r-- | gps/core/UlpProxyBase.h | 122 | ||||
-rw-r--r-- | gps/core/gps_extended.h | 104 | ||||
-rw-r--r-- | gps/core/gps_extended_c.h | 1067 | ||||
-rw-r--r-- | gps/core/loc_core_log.cpp | 243 | ||||
-rw-r--r-- | gps/core/loc_core_log.h | 58 |
17 files changed, 0 insertions, 3509 deletions
diff --git a/gps/core/Android.mk b/gps/core/Android.mk deleted file mode 100644 index 9649f00..0000000 --- a/gps/core/Android.mk +++ /dev/null @@ -1,58 +0,0 @@ -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 \ - libloc_pla - -LOCAL_SRC_FILES += \ - LocApiBase.cpp \ - LocAdapterBase.cpp \ - ContextBase.cpp \ - LocDualContext.cpp \ - loc_core_log.cpp - -LOCAL_CFLAGS += \ - -fno-short-enums \ - -D_ANDROID_ - -LOCAL_C_INCLUDES:= \ - $(TARGET_OUT_HEADERS)/gps.utils \ - $(TARGET_OUT_HEADERS)/libflp \ - $(TARGET_OUT_HEADERS)/libloc_pla - -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 diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp deleted file mode 100644 index d2f9070..0000000 --- a/gps/core/ContextBase.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#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 {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)(); - } - } - 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; - - 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/gps/core/ContextBase.h b/gps/core/ContextBase.h deleted file mode 100644 index 87d2acf..0000000 --- a/gps/core/ContextBase.h +++ /dev/null @@ -1,144 +0,0 @@ -/* 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 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); -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; - - static uint32_t getCarrierCapabilities(); - -}; - -} // namespace loc_core - -#endif //__LOC_CONTEXT_BASE__ diff --git a/gps/core/LBSProxyBase.h b/gps/core/LBSProxyBase.h deleted file mode 100644 index 94ddd0f..0000000 --- a/gps/core/LBSProxyBase.h +++ /dev/null @@ -1,80 +0,0 @@ -/* 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/gps/core/LocAdapterBase.cpp b/gps/core/LocAdapterBase.cpp deleted file mode 100644 index 6a3f969..0000000 --- a/gps/core/LocAdapterBase.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#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); -} - -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:: - reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) -DEFAULT_IMPL() - -void LocAdapterBase:: - reportSvPolynomial(GnssSvPolynomial &svPolynomial) -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/gps/core/LocAdapterBase.h b/gps/core/LocAdapterBase.h deleted file mode 100644 index af25138..0000000 --- a/gps/core/LocAdapterBase.h +++ /dev/null @@ -1,131 +0,0 @@ -/* 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(); - } - - inline bool isFeatureSupported(uint8_t featureVal) { - return mLocApi->isFeatureSupported(featureVal); - } - - // This will be overridden by the individual adapters - // if necessary. - inline virtual void setUlpProxy(UlpProxyBase* ulp) { - - (void)ulp; - } - virtual void handleEngineUpEvent(); - virtual void handleEngineDownEvent(); - inline virtual void setPositionModeInt(LocPosMode& posMode) { - - (void)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 reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet); - virtual void reportSvPolynomial(GnssSvPolynomial &svPolynomial); - 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/gps/core/LocAdapterProxyBase.h b/gps/core/LocAdapterProxyBase.h deleted file mode 100644 index 82cba6b..0000000 --- a/gps/core/LocAdapterProxyBase.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) 2014 The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef LOC_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) { - - (void)location; - (void)locationExtended; - (void)status; - (void)loc_technology_mask; - return false; - } -}; - -} // namespace loc_core - -#endif //LOC_ADAPTER_PROXY_BASE_H diff --git a/gps/core/LocApiBase.cpp b/gps/core/LocApiBase.cpp deleted file mode 100644 index fdfc537..0000000 --- a/gps/core/LocApiBase.cpp +++ /dev/null @@ -1,593 +0,0 @@ -/* 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 <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, - 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) -{ - 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", - svStatus.num_svs); - for (int i = 0; i < svStatus.num_svs && i < GNSS_MAX_SVS; i++) { - if (svStatus.gnss_sv_list[i].constellation > - sizeof(constellationString) / sizeof(constellationString[0]) - 1) { - svStatus.gnss_sv_list[i].constellation = 0; - } - LOC_LOGV(" %03d: %*s %02d %f %f %f 0x%02X", - i, - 13, - constellationString[svStatus.gnss_sv_list[i].constellation], - svStatus.gnss_sv_list[i].svid, - 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::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) -{ - // loop through adapters, and deliver to all adapters. - TO_ALL_LOCADAPTERS( - mLocAdapters[i]->reportSvMeasurement(svMeasurementSet) - ); -} - -void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial) -{ - // loop through adapters, and deliver to all adapters. - TO_ALL_LOCADAPTERS( - mLocAdapters[i]->reportSvPolynomial(svPolynomial) - ); -} - -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::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(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:: - setNMEATypes (uint32_t typesMask) -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:: - setAGLONASSProtocol(unsigned long aGlonassProtocol) -DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) - -enum loc_api_adapter_err LocApiBase:: - setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP) - 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) - -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/gps/core/LocApiBase.h b/gps/core/LocApiBase.h deleted file mode 100644 index 066695c..0000000 --- a/gps/core/LocApiBase.h +++ /dev/null @@ -1,274 +0,0 @@ -/* 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 <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, - 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 reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet); - void reportSvPolynomial(GnssSvPolynomial &svPolynomial); - 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); - void saveSupportedFeatureList(uint8_t *featureList); - - // 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 - setNMEATypes (uint32_t typesMask); - 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 - setAGLONASSProtocol(unsigned long aGlonassProtocol); - virtual enum loc_api_adapter_err - setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP); - 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) { - - (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(); - - /*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); - - /* - 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/gps/core/LocDualContext.cpp b/gps/core/LocDualContext.cpp deleted file mode 100644 index 74b2903..0000000 --- a/gps/core/LocDualContext.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#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> - -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"; -#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/gps/core/LocDualContext.h b/gps/core/LocDualContext.h deleted file mode 100644 index ce77a1a..0000000 --- a/gps/core/LocDualContext.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef __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/gps/core/Makefile.am b/gps/core/Makefile.am deleted file mode 100644 index 341153a..0000000 --- a/gps/core/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -AM_CFLAGS = -I./ \ - -I../utils \ - $(LOCPLA_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 \ - gps_extended_c.h \ - gps_extended.h \ - loc_core_log.h \ - LocAdapterProxyBase.h - -libloc_core_la_c_sources = \ - LocApiBase.cpp \ - LocAdapterBase.cpp \ - ContextBase.cpp \ - LocDualContext.cpp \ - loc_core_log.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) ../utils/libgps_utils_so.la - -#Create and Install libraries -lib_LTLIBRARIES = libloc_core.la diff --git a/gps/core/UlpProxyBase.h b/gps/core/UlpProxyBase.h deleted file mode 100644 index 2e92bed..0000000 --- a/gps/core/UlpProxyBase.h +++ /dev/null @@ -1,122 +0,0 @@ -/* 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> - -struct FlpExtLocation_s; -struct FlpExtBatchOptions; - -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) { - (void)location; - (void)locationExtended; - (void)locationExt; - (void)status; - (void)loc_technology_mask; - return false; - } - inline virtual bool reportSv(GnssSvStatus &svStatus, - GpsLocationExtended &locationExtended, - void* svExt) { - (void)svStatus; - (void)locationExtended; - (void)svExt; - 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(GpsStatusValue 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(FlpExtBatchOptions &options, - bool active) { - - (void)options; - (void)active; - return false; - } - inline virtual bool reportPositions(const struct FlpExtLocation_s* locations, - int32_t number_of_locations) { - (void)locations; - (void)number_of_locations; - return false; - } - inline virtual bool reportDeleteAidingData(GpsAidingData aidingData) - { - (void)aidingData; - return false; - } -}; - -} // namespace loc_core - -#endif // ULP_PROXY_BASE_H diff --git a/gps/core/gps_extended.h b/gps/core/gps_extended.h deleted file mode 100644 index 9460d4e..0000000 --- a/gps/core/gps_extended.h +++ /dev/null @@ -1,104 +0,0 @@ -/* 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_H -#define GPS_EXTENDED_H - -#include <gps_extended_c.h> -/** - * @file - * @brief C++ declarations for GPS types - */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#if defined(USE_GLIB) || defined(OFF_TARGET) -#include <string.h> -#endif - -struct LocPosMode -{ - LocPositionMode mode; - GpsPositionRecurrence recurrence; - uint32_t min_interval; - uint32_t preferred_accuracy; - uint32_t preferred_time; - bool share_position; - char credentials[14]; - char provider[8]; - LocPosMode(LocPositionMode m, GpsPositionRecurrence recr, - uint32_t gap, uint32_t accu, uint32_t time, - bool sp, const char* cred, const char* prov) : - mode(m), recurrence(recr), - min_interval(gap < GPS_MIN_POSSIBLE_FIX_INTERVAL_MS ? - GPS_MIN_POSSIBLE_FIX_INTERVAL_MS : gap), - preferred_accuracy(accu), preferred_time(time), - share_position(sp) { - 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(GPS_DEFAULT_FIX_INTERVAL_MS), - preferred_accuracy(50), preferred_time(120000), - share_position(true) { - 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/gps/core/gps_extended_c.h b/gps/core/gps_extended_c.h deleted file mode 100644 index e16d758..0000000 --- a/gps/core/gps_extended_c.h +++ /dev/null @@ -1,1067 +0,0 @@ -/* Copyright (c) 2013-2015, 2016 The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GPS_EXTENDED_C_H -#define GPS_EXTENDED_C_H - -#include <ctype.h> -#include <stdbool.h> -#include <stdlib.h> -#include <string.h> -#include <hardware/gps.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 -/** 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 -/** Position is from external DR solution*/ -#define ULP_LOCATION_IS_FROM_EXT_DR 0X0080 - -#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 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; - 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; - - -typedef void (*loc_ni_notify_callback)(GpsNiNotification *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 - -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; - -/** 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; -} 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) - -// 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_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 ) - - - -typedef enum { - LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0, - LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM, - LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU, - LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, - LOC_ENG_IF_REQUEST_SENDER_ID_MODEM, - LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN -} loc_if_req_sender_id_e_type; - - -#define smaller_of(a, b) (((a) > (b)) ? (b) : (a)) -#define MAX_APN_LEN 100 - -// This will be overridden by the individual adapters -// if necessary. -#define DEFAULT_IMPL(rtv) \ -{ \ - LOC_LOGD("%s: default implementation invoked", __func__); \ - return rtv; \ -} - -enum loc_api_adapter_err { - LOC_API_ADAPTER_ERR_SUCCESS = 0, - LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1, - LOC_API_ADAPTER_ERR_UNSUPPORTED = 2, - LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4, - LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5, - LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6, - LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7, - LOC_API_ADAPTER_ERR_TIMEOUT = 8, - LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9, - LOC_API_ADAPTER_ERR_INTERNAL = 10, - - /* equating engine down to phone offline, as they are the same errror */ - LOC_API_ADAPTER_ERR_ENGINE_DOWN = LOC_API_ADAPTER_ERR_PHONE_OFFLINE, - LOC_API_ADAPTER_ERR_FAILURE = 101, - LOC_API_ADAPTER_ERR_UNKNOWN -}; - -enum loc_api_adapter_event_index { - LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type - LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report - LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate - LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate - LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request - LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request - LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server - LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl - LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state - LOC_API_ADAPTER_REQUEST_WIFI, // - LOC_API_ADAPTER_SENSOR_STATUS, // - LOC_API_ADAPTER_REQUEST_TIME_SYNC, // - LOC_API_ADAPTER_REPORT_SPI, // - LOC_API_ADAPTER_REPORT_NI_GEOFENCE, // - LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, // - LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, // - LOC_API_ADAPTER_PEDOMETER_CTRL, // - LOC_API_ADAPTER_MOTION_CTRL, // - LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data - LOC_API_ADAPTER_BATCH_FULL, // Batching on full - LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix - LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // - LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, //GNSS Measurement Report - LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, //GNSS SV Polynomial Report - LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request - LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request - LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report - LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request - LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report - LOC_API_ADAPTER_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) - -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; - uint8_t gnssSvId; - /* GPS: 1-32, GLO: 65-96, 0: Invalid - 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; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* GPS_EXTENDED_C_H */ diff --git a/gps/core/loc_core_log.cpp b/gps/core/loc_core_log.cpp deleted file mode 100644 index 4556fae..0000000 --- a/gps/core/loc_core_log.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* 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 <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( 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/gps/core/loc_core_log.h b/gps/core/loc_core_log.h deleted file mode 100644 index 8a1825a..0000000 --- a/gps/core/loc_core_log.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 */ |