From 73573ef752430b0d54772e9167bb90cf44691351 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Wed, 4 Sep 2013 17:51:18 -0700 Subject: [PATCH 01/41] Fix ATL handling Always register for ATL events reguardless of hw target or MSA/MSB capabilities. For APQ target, do not handle certain types of ATL events that it doen't support. For APQ target, use only position mode of Standalone. CRs-fixed: 533932 Change-Id: Icd626e3e7155d5c2ba871a343430e441924ce93c --- loc_api/libloc_api_50001/loc.cpp | 14 +-- loc_api/libloc_api_50001/loc_eng.cpp | 146 ++++++++++++++++----------- utils/loc_target.cpp | 14 +-- utils/loc_target.h | 1 + 4 files changed, 95 insertions(+), 80 deletions(-) diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 90b3b86e..6cca8544 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -571,19 +571,7 @@ const void* loc_get_extension(const char* name) } else if (strcmp(name, AGPS_INTERFACE) == 0) { - //Return an interface to AGPS only if MSA or MSB capabilities - //are present. If the target is an APQ, these masks are - //cleared in get_gps_interface() and the below logic will - //return NULL as the interface for AGPS - if((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || - (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) ) { - LOC_LOGD("%s:%d]: AGPS capabilities found\n", __func__, __LINE__); - ret_val = &sLocEngAGpsInterface; - } - else { - LOC_LOGD("%s:%d]: Returning NULL AgpsInterface\n", __func__, __LINE__); - ret_val = NULL; - } + ret_val = &sLocEngAGpsInterface; } else if (strcmp(name, GPS_NI_INTERFACE) == 0) { diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 3f3fffc9..ad6e54fa 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -978,8 +978,10 @@ LocEngSuplEsOpened::LocEngSuplEsOpened(void* locEng) : } void LocEngSuplEsOpened::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; - AgpsStateMachine* sm = locEng->ds_nif; - sm->onRsrcEvent(RSRC_GRANTED); + if (locEng->ds_nif) { + AgpsStateMachine* sm = locEng->ds_nif; + sm->onRsrcEvent(RSRC_GRANTED); + } } void LocEngSuplEsOpened::locallog() const { LOC_LOGV("LocEngSuplEsOpened"); @@ -995,8 +997,10 @@ LocEngSuplEsClosed::LocEngSuplEsClosed(void* locEng) : } void LocEngSuplEsClosed::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; - AgpsStateMachine* sm = locEng->ds_nif; - sm->onRsrcEvent(RSRC_RELEASED); + if (locEng->ds_nif) { + AgpsStateMachine* sm = locEng->ds_nif; + sm->onRsrcEvent(RSRC_RELEASED); + } } void LocEngSuplEsClosed::locallog() const { LOC_LOGV("LocEngSuplEsClosed"); @@ -1013,9 +1017,13 @@ LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) : } void LocEngRequestSuplEs::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; - AgpsStateMachine* sm = locEng->ds_nif; - DSSubscriber s(sm, mID); - sm->subscribeRsrc((Subscriber*)&s); + if (locEng->ds_nif) { + AgpsStateMachine* sm = locEng->ds_nif; + DSSubscriber s(sm, mID); + sm->subscribeRsrc((Subscriber*)&s); + } else { + locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1); + } } inline void LocEngRequestSuplEs::locallog() const { LOC_LOGV("LocEngRequestSuplEs"); @@ -1034,11 +1042,15 @@ void LocEngRequestATL::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; AgpsStateMachine* sm = (AgpsStateMachine*) getAgpsStateMachine(*locEng, mType); - ATLSubscriber s(mID, - sm, - locEng->adapter, - AGPS_TYPE_INVALID == mType); - sm->subscribeRsrc((Subscriber*)&s); + if (sm) { + ATLSubscriber s(mID, + sm, + locEng->adapter, + AGPS_TYPE_INVALID == mType); + sm->subscribeRsrc((Subscriber*)&s); + } else { + locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, mType); + } } inline void LocEngRequestATL::locallog() const { LOC_LOGV("LocEngRequestATL"); @@ -1054,28 +1066,38 @@ LocEngReleaseATL::LocEngReleaseATL(void* locEng, int id) : } void LocEngReleaseATL::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; - ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false); - if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) { - LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif", - __func__, __LINE__); - } else { + + if (locEng->agnss_nif) { + ATLSubscriber s1(mID, locEng->agnss_nif, locEng->adapter, false); + if (locEng->agnss_nif->unsubscribeRsrc((Subscriber*)&s1)) { + LOC_LOGD("%s:%d]: Unsubscribed from agnss_nif", + __func__, __LINE__); + return; + } + } + + if (locEng->internet_nif) { ATLSubscriber s2(mID, locEng->internet_nif, locEng->adapter, false); if (locEng->internet_nif->unsubscribeRsrc((Subscriber*)&s2)) { LOC_LOGD("%s:%d]: Unsubscribed from internet_nif", __func__, __LINE__); - } else { - DSSubscriber s3(locEng->ds_nif, mID); - if(locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) { - LOC_LOGD("%s:%d]: Unsubscribed from ds_nif", - __func__, __LINE__); - } else { - LOC_LOGW("%s:%d]: Could not release ATL. " - "No subscribers found\n", - __func__, __LINE__); - locEng->adapter->atlCloseStatus(mID, 0); - } + return; } } + + if (locEng->ds_nif) { + DSSubscriber s3(locEng->ds_nif, mID); + if (locEng->ds_nif->unsubscribeRsrc((Subscriber*)&s3)) { + LOC_LOGD("%s:%d]: Unsubscribed from ds_nif", + __func__, __LINE__); + return; + } + } + + LOC_LOGW("%s:%d]: Could not release ATL. " + "No subscribers found\n", + __func__, __LINE__); + locEng->adapter->atlCloseStatus(mID, 0); } inline void LocEngReleaseATL::locallog() const { LOC_LOGV("LocEngReleaseATL"); @@ -1109,11 +1131,15 @@ LocEngReqRelWifi::~LocEngReqRelWifi() { } void LocEngReqRelWifi::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; - WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId); - if (mIsReq) { - locEng->wifi_nif->subscribeRsrc((Subscriber*)&s); + if (locEng->wifi_nif) { + WIFISubscriber s(locEng->wifi_nif, mSSID, mPassword, mSenderId); + if (mIsReq) { + locEng->wifi_nif->subscribeRsrc((Subscriber*)&s); + } else { + locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s); + } } else { - locEng->wifi_nif->unsubscribeRsrc((Subscriber*)&s); + locEng->adapter->atlOpenStatus(mSenderId, 0, NULL, -1, mType); } } inline void LocEngReqRelWifi::locallog() const { @@ -1477,13 +1503,6 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.generateNmea = false; } - //Disable AGPS if capabilities are not present - if(!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) && - !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) { - event &= ~(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | - LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST); - } - loc_eng_data.adapter = new LocEngAdapter(event, &loc_eng_data, (MsgTask::tCreate)callbacks->create_thread_cb); @@ -1751,6 +1770,13 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); + // The position mode for APQ target can only be standalone + bool isAPQ = (getTargetGnssType(get_target()) == GNSS_GSS); + if (isAPQ && params.mode != LOC_POSITION_MODE_STANDALONE) { + params.mode = LOC_POSITION_MODE_STANDALONE; + LOC_LOGD("Position mode changed to standalone for APQ target."); + } + if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params)) { LocEngAdapter* adapter = loc_eng_data.adapter; @@ -1975,28 +2001,14 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call STATE_CHECK((NULL == loc_eng_data.agps_status_cb), "agps instance already initialized", return); - if(callbacks == NULL) { + if (callbacks == NULL) { LOC_LOGE("loc_eng_agps_init: bad parameters cb %p", callbacks); EXIT_LOG(%s, VOID_RET); return; } - - //Proceed to create AGPS framework only if MSA or MSB capabilities - //are present. If the target is an APQ, these masks are - //cleared in get_gps_interface() - if(!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) && - !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) ) { - LOC_LOGD("%s:%d]: No AGPS capabilities found. Returning\n", - __func__, __LINE__); - return; - } LocEngAdapter* adapter = loc_eng_data.adapter; loc_eng_data.agps_status_cb = callbacks->status_cb; - loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps, - (void *)loc_eng_data.agps_status_cb, - AGPS_TYPE_SUPL, - false); loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps, (void *)loc_eng_data.agps_status_cb, AGPS_TYPE_WWAN_ANY, @@ -2005,13 +2017,23 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call (void *)loc_eng_data.agps_status_cb, AGPS_TYPE_WIFI, true); - loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); - if (adapter->mAgpsEnabled) { - loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb, - NULL, NULL, &loc_eng_data); + bool isAPQ = (getTargetGnssType(get_target()) == GNSS_GSS); + if (!isAPQ) { + loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps, + (void *)loc_eng_data.agps_status_cb, + AGPS_TYPE_SUPL, + false); + + loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); + + if (adapter->mAgpsEnabled) { + loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb, + NULL, NULL, &loc_eng_data); + } + loc_eng_agps_reinit(loc_eng_data); } - loc_eng_agps_reinit(loc_eng_data); + EXIT_LOG(%s, VOID_RET); } @@ -2436,8 +2458,10 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) loc_eng_reinit(loc_eng_data); if (loc_eng_data.agps_status_cb != NULL) { - loc_eng_data.agnss_nif->dropAllSubscribers(); - loc_eng_data.internet_nif->dropAllSubscribers(); + if (loc_eng_data.agnss_nif) + loc_eng_data.agnss_nif->dropAllSubscribers(); + if (loc_eng_data.internet_nif) + loc_eng_data.internet_nif->dropAllSubscribers(); loc_eng_agps_reinit(loc_eng_data); } diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index d68d6c9f..cd781c05 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -58,6 +58,7 @@ #define GPS_CHECK_NO_GPS_HW 1 static int gss_fd = 0; +static unsigned int gTarget = TARGET_UNKNOWN; static int read_a_line(const char * file_path, char * line, int line_size) { @@ -83,7 +84,8 @@ static int read_a_line(const char * file_path, char * line, int line_size) unsigned int get_target(void) { - unsigned int target = TARGET_DEFAULT; + if (gTarget != TARGET_UNKNOWN) + return gTarget; char hw_platform[] = "/sys/devices/soc0/hw_platform"; char id[] = "/sys/devices/soc0/soc_id"; @@ -111,9 +113,9 @@ unsigned int get_target(void) if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) - target = TARGET_MPQ; + gTarget = TARGET_MPQ; else - target = TARGET_APQ_SA; + gTarget = TARGET_APQ_SA; } else { if( (!memcmp(rd_hw_platform, STR_LIQUID, LENGTH(STR_LIQUID)) @@ -124,13 +126,13 @@ unsigned int get_target(void) && IS_STR_END(rd_hw_platform[LENGTH(STR_MTP)]))) { if (!read_a_line( mdm, rd_mdm, LINE_LEN)) - target = TARGET_MDM; + gTarget = TARGET_MDM; } else if( (!memcmp(rd_id, MSM8930_ID_1, LENGTH(MSM8930_ID_1)) && IS_STR_END(rd_id[LENGTH(MSM8930_ID_1)])) || (!memcmp(rd_id, MSM8930_ID_2, LENGTH(MSM8930_ID_2)) && IS_STR_END(rd_id[LENGTH(MSM8930_ID_2)])) ) - target = TARGET_MSM_NO_SSC; + gTarget = TARGET_MSM_NO_SSC; } - return target; + return gTarget; } diff --git a/utils/loc_target.h b/utils/loc_target.h index 12cff1d2..be68f928 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -34,6 +34,7 @@ #define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC) #define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) +#define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) #define getTargetGnssType(target) (target>>1) #ifdef __cplusplus From 2daacc49050c81ec08d1383613ba81aa97908a99 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 17 Sep 2013 10:19:55 -0700 Subject: [PATCH 02/41] Add LocApi to get Zpp fix. Added get zpp fix API so that different other features can make use of this feature in the AP space. Change-Id: I32e750626704c5d0069723ee1ca949fda4a5505e --- core/LocApiBase.cpp | 4 ++++ core/LocApiBase.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 6ba72f9e..577d21bf 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -413,6 +413,10 @@ enum loc_api_adapter_err LocApiBase:: setAGLONASSProtocol(unsigned long aGlonassProtocol) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) +enum loc_api_adapter_err LocApiBase:: + getZppFix(GpsLocation & zppLoc) +DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) + int LocApiBase:: initDataServiceClient() DEFAULT_IMPL(-1) diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 861b36f5..2fcac845 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -174,6 +174,8 @@ public: setExtPowerConfig(int isBatteryCharging); virtual enum loc_api_adapter_err setAGLONASSProtocol(unsigned long aGlonassProtocol); + virtual enum loc_api_adapter_err + getZppFix(GpsLocation & zppLoc); virtual int initDataServiceClient(); virtual int openAndStartDataCall(); virtual void stopDataCall(); From c66c2fc5f6451e78b63c1eee3febcfe7b703e751 Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Mon, 23 Sep 2013 16:50:09 -0700 Subject: [PATCH 03/41] Add check for mAgpsEnabled requestSuplES did not have the check for mAgpsEnabled Change-Id: I314fe6bc933e5201e1ac6c6632ee3b53240955b1 CRs-fixed: 543639 --- loc_api/libloc_api_50001/LocEngAdapter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 9545681a..5224473f 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -234,8 +234,9 @@ bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data) inline bool LocEngAdapter::requestSuplES(int connHandle) { - sendMsg(new LocEngRequestSuplEs(mOwner, connHandle)); - return true; + if (mAgpsEnabled) + sendMsg(new LocEngRequestSuplEs(mOwner, connHandle)); + return mAgpsEnabled; } inline From 969604adfde63faffabb733efa92df458e58d0a9 Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Fri, 13 Sep 2013 18:38:26 -0700 Subject: [PATCH 04/41] Changes for liblbs_core Added new module liblbs_core to make LocApiV02 independent of pre-built binaries. This patch provies the necessary changes to support the new module CRs-fixed: 538124 Change-Id: I716cf169de9dae164a141651af971793099a927d --- core/Android.mk | 2 +- core/ContextBase.cpp | 15 ++++++++------- core/ContextBase.h | 12 ++++++------ core/{IzatProxyBase.h => LBSProxyBase.h} | 9 ++++----- core/LocApiBase.cpp | 5 +++++ core/LocApiBase.h | 7 ++++--- core/LocDualContext.cpp | 2 +- 7 files changed, 29 insertions(+), 23 deletions(-) rename core/{IzatProxyBase.h => LBSProxyBase.h} (94%) diff --git a/core/Android.mk b/core/Android.mk index 298c4131..11cecc65 100644 --- a/core/Android.mk +++ b/core/Android.mk @@ -38,7 +38,7 @@ LOCAL_COPY_HEADERS:= \ LocAdapterBase.h \ ContextBase.h \ LocDualContext.h \ - IzatProxyBase.h \ + LBSProxyBase.h \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index 1826ec79..7879015f 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -40,21 +40,22 @@ namespace loc_core { - -IzatProxyBase* ContextBase::getIzatProxy(const char* libName) +LBSProxyBase* ContextBase::getLBSProxy(const char* libName) { - IzatProxyBase* proxy = NULL; + LBSProxyBase* proxy = NULL; + LOC_LOGD("%s:%d]: getLBSProxy libname: %s\n", __func__, __LINE__, libName); void* lib = dlopen(libName, RTLD_NOW); if ((void*)NULL != lib) { - getIzatProxy_t* getter = (getIzatProxy_t*)dlsym(lib, "getIzatProxy"); + getLBSProxy_t* getter = (getLBSProxy_t*)dlsym(lib, "getLBSProxy"); if (NULL != getter) { proxy = (*getter)(); } } if (NULL == proxy) { - proxy = new IzatProxyBase(); + proxy = new LBSProxyBase(); } + LOC_LOGD("%s:%d]: Exiting\n", __func__, __LINE__); return proxy; } @@ -64,7 +65,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) // first if can not be MPQ if (TARGET_MPQ != get_target()) { - if (NULL == (locApi = mIzatProxy->getLocApi(mMsgTask, exMask))) { + if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask))) { // only RPC is the option now void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); if (NULL != handle) { @@ -88,7 +89,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) ContextBase::ContextBase(const MsgTask* msgTask, LOC_API_ADAPTER_EVENT_MASK_T exMask, const char* libName) : - mIzatProxy(getIzatProxy(libName)), + mLBSProxy(getLBSProxy(libName)), mMsgTask(msgTask), mLocApi(createLocApi(exMask)) { diff --git a/core/ContextBase.h b/core/ContextBase.h index fc60db42..93cb31ff 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -33,17 +33,17 @@ #include #include #include -#include +#include namespace loc_core { class LocAdapterBase; class ContextBase { - static IzatProxyBase* getIzatProxy(const char* libName); + static LBSProxyBase* getLBSProxy(const char* libName); LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask); protected: - const IzatProxyBase* mIzatProxy; + const LBSProxyBase* mLBSProxy; const MsgTask* mMsgTask; LocApiBase* mLocApi; @@ -51,14 +51,14 @@ public: ContextBase(const MsgTask* msgTask, LOC_API_ADAPTER_EVENT_MASK_T exMask, const char* libName); - inline virtual ~ContextBase() { delete mLocApi; delete mIzatProxy; } + inline virtual ~ContextBase() { delete mLocApi; delete mLBSProxy; } inline const MsgTask* getMsgTask() { return mMsgTask; } inline LocApiBase* getLocApi() { return mLocApi; } - inline bool hasAgpsExt() { return mIzatProxy->hasAgpsExt(); } + inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); } inline void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) { - mIzatProxy->requestUlp(adapter, capabilities); + mLBSProxy->requestUlp(adapter, capabilities); } }; diff --git a/core/IzatProxyBase.h b/core/LBSProxyBase.h similarity index 94% rename from core/IzatProxyBase.h rename to core/LBSProxyBase.h index e7e3d3fa..e643d126 100644 --- a/core/IzatProxyBase.h +++ b/core/LBSProxyBase.h @@ -28,7 +28,6 @@ */ #ifndef IZAT_PROXY_BASE_H #define IZAT_PROXY_BASE_H - #include #include @@ -37,7 +36,7 @@ namespace loc_core { class LocApiBase; class LocAdapterBase; -class IzatProxyBase { +class LBSProxyBase { friend class ContextBase; inline virtual LocApiBase* getLocApi(const MsgTask* msgTask, @@ -45,15 +44,15 @@ class IzatProxyBase { return NULL; } protected: - inline IzatProxyBase() {} + inline LBSProxyBase() {} public: - inline virtual ~IzatProxyBase() {} + inline virtual ~LBSProxyBase() {} inline virtual void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) const {} inline virtual bool hasAgpsExt() const { return false; } }; -typedef IzatProxyBase* (getIzatProxy_t)(); +typedef LBSProxyBase* (getLBSProxy_t)(); } // namespace loc_core diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 6ba72f9e..025bce02 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -296,6 +296,11 @@ void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data) TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data)); } +void* LocApiBase :: getSibling() + DEFAULT_IMPL(NULL) +void* LocApiBase :: getSibling2() + DEFAULT_IMPL(NULL) + enum loc_api_adapter_err LocApiBase:: open(LOC_API_ADAPTER_EVENT_MASK_T mask) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 861b36f5..5542d4c3 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -33,7 +33,7 @@ #include #include #include - +#include namespace loc_core { int hexcode(char *hexstring, int string_size, @@ -77,8 +77,6 @@ protected: bool isInSession(); public: - inline virtual void* getSibling() { return NULL; } - void addAdapter(LocAdapterBase* adapter); void removeAdapter(LocAdapterBase* adapter); @@ -111,6 +109,9 @@ public: // 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 void* getSibling2(); virtual enum loc_api_adapter_err startFix(const LocPosMode& posMode); virtual enum loc_api_adapter_err diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index 5c0c9a72..86c3613a 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -58,7 +58,7 @@ ContextBase* LocDualContext::mBgContext = NULL; // the name must be shorter than 15 chars const char* LocDualContext::mLocationHalName = "Loc_hal_worker"; -const char* LocDualContext::mIzatLibName = "libizat_core.so"; +const char* LocDualContext::mIzatLibName = "liblbs_core.so"; const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator, const char* name) From dc020ef75130b82be37f9c22cd0d159acb625d11 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Fri, 4 Oct 2013 18:59:00 -0700 Subject: [PATCH 05/41] Correct print for xtra server urls. The offset calculation on the 2nd and 3rd server urls were wrong. The are off by 1 and 2 bytes respectively. Change-Id: Iab9da5dbd2b0c779e18a6fe4615ad7e705800654 --- loc_api/libloc_api_50001/loc_eng.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 90df5290..098d403b 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -895,7 +895,7 @@ void LocEngReportXtraServer::proc() const { inline void LocEngReportXtraServer::locallog() const { LOC_LOGV("LocEngReportXtraServers: server1: %s\n server2: %s\n" " server3: %s\n", - mServers, &mServers[mMaxLen], &mServers[mMaxLen<<1]); + mServers, &mServers[mMaxLen+1], &mServers[(mMaxLen+1)<<1]); } inline void LocEngReportXtraServer::log() const { locallog(); From 351cb70668c3e3fac04bd942c187f8becde0b2b3 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Wed, 9 Oct 2013 18:35:04 -0700 Subject: [PATCH 06/41] enhance ulp handshake send ULP the position mode if it is valid when ULP handle is first received. This helps handling a race condition where ULP handshake happens when a GPS session is about to happen or already happening. Change-Id: I029e5c3bbb9d8e89b220ca44e9704b5a1d1451ff CRs-Fixed: 554340 --- core/gps_extended_c.h | 4 +++- loc_api/libloc_api_50001/LocEngAdapter.cpp | 16 ++++++++++++++++ loc_api/libloc_api_50001/LocEngAdapter.h | 3 +-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index d11016ec..e7aa0b98 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -161,7 +161,8 @@ typedef enum loc_server_type { } LocServerType; typedef enum loc_position_mode_type { - LOC_POSITION_MODE_STANDALONE, + 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, @@ -169,6 +170,7 @@ typedef enum loc_position_mode_type { LOC_POSITION_MODE_RESERVED_3, LOC_POSITION_MODE_RESERVED_4, LOC_POSITION_MODE_RESERVED_5 + } LocPositionMode; #define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */ diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 5224473f..9e337f12 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -78,6 +78,7 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, mAgpsEnabled(false) { memset(&mFixCriteria, 0, sizeof(mFixCriteria)); + mFixCriteria.mode = LOC_POSITION_MODE_INVALID; LOC_LOGD("LocEngAdapter created"); } @@ -101,6 +102,12 @@ void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp) ulp = new UlpProxyBase(); } mUlp = ulp; + + if (LOC_POSITION_MODE_INVALID != mFixCriteria.mode) { + // need to send this mode and start msg to ULP + mUlp->sendFixMode(mFixCriteria); + mUlp->sendStartFix(); + } } void LocInternalAdapter::reportPosition(UlpLocation &location, @@ -157,6 +164,15 @@ void LocEngAdapter::reportSv(GpsSvStatus &svStatus, } } +void LocEngAdapter::setInSession(bool inSession) +{ + mNavigating = inSession; + mLocApi->setInSession(inSession); + if (!mNavigating) { + mFixCriteria.mode = LOC_POSITION_MODE_INVALID; + } +} + inline void LocEngAdapter::reportStatus(GpsStatusValue status) { diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 53a5aca0..e0fd2ee5 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -264,8 +264,7 @@ public: {return mFixCriteria;} inline virtual bool isInSession() { return mNavigating; } - inline void setInSession(bool inSession) - { mNavigating = inSession; mLocApi->setInSession(inSession); } + void setInSession(bool inSession); /*Values for lock 1 = Do not lock any position sessions From 412275d48c53175c509eadf59b26f0b26b5431a1 Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Wed, 23 Oct 2013 10:58:06 -0700 Subject: [PATCH 07/41] Check mAgpsEnabled for data call Check AGPS flag to ensure the request is handled by the right adapter Change-Id: I6fb7271ec0be5aec14e9d667c07e5b01b1736c1d CRs-fixed: 551808 --- loc_api/libloc_api_50001/LocEngAdapter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 5224473f..3ff3ac7a 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -242,15 +242,17 @@ bool LocEngAdapter::requestSuplES(int connHandle) inline bool LocEngAdapter::reportDataCallOpened() { - sendMsg(new LocEngSuplEsOpened(mOwner)); - return true; + if(mAgpsEnabled) + sendMsg(new LocEngSuplEsOpened(mOwner)); + return mAgpsEnabled; } inline bool LocEngAdapter::reportDataCallClosed() { - sendMsg(new LocEngSuplEsClosed(mOwner)); - return true; + if(mAgpsEnabled) + sendMsg(new LocEngSuplEsClosed(mOwner)); + return mAgpsEnabled; } inline From 41d3c44644b843c82688292ad41d31ea6f121cd4 Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Wed, 25 Sep 2013 11:01:43 -0700 Subject: [PATCH 08/41] Send status report msg through ULP In order to preserve the ordering of position reports and status reports from the GPS engine, status reports are sent through the ULP too CRS-Fixed: 538143 Change-Id: I41be2121493c6a0b35a5726fd546eb0fa5e9b20c --- core/UlpProxyBase.h | 3 +++ loc_api/libloc_api_50001/LocEngAdapter.cpp | 10 ++++++++-- loc_api/libloc_api_50001/LocEngAdapter.h | 1 + loc_api/libloc_api_50001/loc_eng.cpp | 7 ++++--- loc_api/libloc_api_50001/loc_eng_msg.h | 4 ++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 02ba1678..0873748b 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -54,6 +54,9 @@ public: void* svExt) { return false; } + inline virtual bool reportStatus(GpsStatusValue status) { + return false; + } inline virtual void setAdapter(LocAdapterBase* adapter) {} inline virtual void setCapabilities(unsigned long capabilities) {} }; diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 5224473f..468fe973 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -157,10 +157,16 @@ void LocEngAdapter::reportSv(GpsSvStatus &svStatus, } } -inline +void LocInternalAdapter::reportStatus(GpsStatusValue status) +{ + sendMsg(new LocEngReportStatus(mLocEngAdapter, status)); +} + void LocEngAdapter::reportStatus(GpsStatusValue status) { - sendMsg(new LocEngReportStatus(mOwner, status)); + if (!mUlp->reportStatus(status)) { + mInternalAdapter->reportStatus(status); + } } inline diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 53a5aca0..a31cebbb 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -58,6 +58,7 @@ public: virtual void reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); + virtual void reportStatus(GpsStatusValue status); virtual void setPositionModeInt(LocPosMode& posMode); virtual void startFixInt(); virtual void stopFixInt(); diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 90df5290..f6fd54d2 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -821,15 +821,16 @@ void LocEngReportSv::send() const { } // case LOC_ENG_MSG_REPORT_STATUS: -LocEngReportStatus::LocEngReportStatus(void* locEng, +LocEngReportStatus::LocEngReportStatus(LocAdapterBase* adapter, GpsStatusValue engineStatus) : - LocMsg(), mLocEng(locEng), mStatus(engineStatus) + LocMsg(), mAdapter(adapter), mStatus(engineStatus) { locallog(); } inline void LocEngReportStatus::proc() const { - loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng; + LocEngAdapter* adapter = (LocEngAdapter*)mAdapter; + loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)adapter->getOwner(); loc_eng_report_status(*locEng, mStatus); update_aiding_data_for_deletion(*locEng); diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index 1a318946..4790bbee 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -119,9 +119,9 @@ struct LocEngReportSv : public LocMsg { }; struct LocEngReportStatus : public LocMsg { - void* mLocEng; + LocAdapterBase* mAdapter; const GpsStatusValue mStatus; - LocEngReportStatus(void* locEng, + LocEngReportStatus(LocAdapterBase* adapter, GpsStatusValue engineStatus); virtual void proc() const; void locallog() const; From a8dff296173f88015cf7c627ad7329c9544090ca Mon Sep 17 00:00:00 2001 From: Jiafei Wen Date: Wed, 23 Oct 2013 11:28:51 -0700 Subject: [PATCH 09/41] Add LocApiProxyBase to context This is so that the izat adapters can get access to LocApiProxy through the context. Change-Id: I15a477d159375740047cd7386f8c8c5163fdaf87 --- core/ContextBase.cpp | 3 ++- core/ContextBase.h | 3 ++- core/LocAdapterBase.cpp | 22 +--------------------- core/LocAdapterBase.h | 6 ++---- core/LocApiBase.cpp | 29 ++++++++++++++++++++++++++--- core/LocApiBase.h | 18 ++++++++++++++---- 6 files changed, 47 insertions(+), 34 deletions(-) diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index 7879015f..dc47ffbd 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -91,7 +91,8 @@ ContextBase::ContextBase(const MsgTask* msgTask, const char* libName) : mLBSProxy(getLBSProxy(libName)), mMsgTask(msgTask), - mLocApi(createLocApi(exMask)) + mLocApi(createLocApi(exMask)), + mLocApiProxy(mLocApi->getLocApiProxy()) { } diff --git a/core/ContextBase.h b/core/ContextBase.h index 93cb31ff..b41dd780 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -46,7 +46,7 @@ protected: const LBSProxyBase* mLBSProxy; const MsgTask* mMsgTask; LocApiBase* mLocApi; - + LocApiProxyBase *mLocApiProxy; public: ContextBase(const MsgTask* msgTask, LOC_API_ADAPTER_EVENT_MASK_T exMask, @@ -55,6 +55,7 @@ public: inline const MsgTask* getMsgTask() { return mMsgTask; } inline LocApiBase* getLocApi() { return mLocApi; } + inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; } inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); } inline void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) { diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 48d179f5..8bbe873f 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -36,26 +36,6 @@ namespace loc_core { -struct LocOpenMsg : public LocMsg { - LocAdapterBase* mLocAdapter; - LocApiBase* mLocApi; - inline LocOpenMsg(LocAdapterBase* locAdapter, - LocApiBase* locApi) : - LocMsg(), mLocAdapter(locAdapter), mLocApi(locApi) - { - locallog(); - } - inline virtual void proc() const { - mLocApi->addAdapter(mLocAdapter); - } - inline void locallog() { - LOC_LOGV("LocOpen"); - } - inline virtual void log() { - locallog(); - } -}; - // This is the top level class, so the constructor will // always gets called. Here we prepare for the default. // But if getLocApi(targetEnumType target) is overriden, @@ -65,7 +45,7 @@ LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, mEvtMask(mask), mContext(context), mLocApi(context->getLocApi()), mMsgTask(context->getMsgTask()) { - sendMsg(new LocOpenMsg(this, mLocApi)); + mLocApi->addAdapter(this); } void LocAdapterBase:: diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index f279f9fd..be31de6e 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -44,12 +44,10 @@ protected: inline LocAdapterBase(const MsgTask* msgTask) : mEvtMask(0), mContext(NULL), mLocApi(NULL), mMsgTask(msgTask) {} - +public: + inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); } LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, ContextBase* context); - inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); } - -public: inline LOC_API_ADAPTER_EVENT_MASK_T checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const { return mEvtMask & mask; diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 7a6456c1..2978fb3f 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -103,6 +103,27 @@ struct LocSsrMsg : public LocMsg { } }; +struct LocOpenMsg : public LocMsg { + LocApiBase* mLocApi; + LOC_API_ADAPTER_EVENT_MASK_T mMask; + inline LocOpenMsg(LocApiBase* locApi, + LOC_API_ADAPTER_EVENT_MASK_T mask) : + LocMsg(), mLocApi(locApi), mMask(mask) + { + 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) : mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0) @@ -137,7 +158,8 @@ void LocApiBase::addAdapter(LocAdapterBase* adapter) for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) { if (mLocAdapters[i] == NULL) { mLocAdapters[i] = adapter; - open(mMask | (adapter->getEvtMask() & ~mExcludedMask)); + mMsgTask->sendMsg(new LocOpenMsg(this, + (adapter->getEvtMask()))); break; } } @@ -173,7 +195,7 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter) close(); } else { // else we need to remove the bit - open(getEvtMask() & ~mExcludedMask); + mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask())); } } } @@ -298,7 +320,8 @@ void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data) void* LocApiBase :: getSibling() DEFAULT_IMPL(NULL) -void* LocApiBase :: getSibling2() + +LocApiProxyBase* LocApiBase :: getLocApiProxy() DEFAULT_IMPL(NULL) enum loc_api_adapter_err LocApiBase:: diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 4ddc57f1..04afa53a 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -34,6 +34,7 @@ #include #include #include + namespace loc_core { int hexcode(char *hexstring, int string_size, @@ -51,14 +52,23 @@ int decodeAddress(char *addr_string, int string_size, #define TO_1ST_HANDLING_ADAPTER(adapters, call) \ for (int i = 0; i Date: Tue, 12 Nov 2013 15:49:32 -0800 Subject: [PATCH 10/41] Memset the xtra url to assure null termination Fixes a potential crash in jni layer caused by invalid characters in the string. CRs-fixed: 555829 Change-Id: I03ae100c4b7e65c95bac5841fcf00b27e2940741 --- loc_api/libloc_api_50001/loc_eng.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index f6fd54d2..d6e69cfc 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -875,6 +875,7 @@ LocEngReportXtraServer::LocEngReportXtraServer(void* locEng, LocMsg(), mLocEng(locEng), mMaxLen(maxlength), mServers(new char[3*(mMaxLen+1)]) { + memset(mServers, 0, 3*(mMaxLen+1)); strlcpy(mServers, url1, mMaxLen); strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen); strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen); From 04ece63ab2f14a92931b730e0e5637cab25d9571 Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Wed, 15 Jan 2014 11:08:16 -0800 Subject: [PATCH 11/41] Fix for dsi_init failure Init DS only when the agps stack is available Change-Id: I106e50462ad810ca5baf452d7effc6459c135f6f CRs-fixed: 599478 --- loc_api/libloc_api_50001/loc_eng.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 6d6d701a..f54066b2 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -2086,9 +2086,9 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call AGPS_TYPE_SUPL, false); - loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); - if (adapter->mAgpsEnabled) { + loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); + loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb, NULL, NULL, &loc_eng_data); } From 82e314e2c42dc978d13da0d6f993b763b9944a19 Mon Sep 17 00:00:00 2001 From: Jiafei Wen Date: Wed, 8 Jan 2014 11:07:25 -0800 Subject: [PATCH 12/41] Add SGLTE target field in gps.conf This field is to indicate if the current device is SGLTE target or not. CRs-Fixed: 595803 Change-Id: Iba5bbd00d535e7616c3a5de86641087a28e8ebfd --- etc/gps.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/gps.conf b/etc/gps.conf index 5c9b4d3b..15dda2a4 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -68,6 +68,8 @@ LPP_PROFILE = 0 ################################ # NMEA provider (1=Modem Processor, 0=Application Processor) NMEA_PROVIDER=0 +# Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE) +SGLTE_TARGET=0 ################################################## # Select Positioning Protocol on A-GLONASS system From 48c29f5a8fc3007e623bb2de18eea0a505b86f5b Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Tue, 28 Jan 2014 11:41:14 -0800 Subject: [PATCH 13/41] Copy position mode to dummy ULP proxy To avoid the race condition between when the fix criteria is set and checked, the position mode is copied to the dummy ULP proxy and it is used to inform ULP when a true proxy is registered Change-Id: I72285c7926814ec85dae64e6634f0c79ea5e6c51 CRs-fixed: 604905 --- core/UlpProxyBase.h | 18 +++++--- loc_api/libloc_api_50001/LocEngAdapter.cpp | 52 ++++++++++++---------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 0873748b..90097571 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -37,11 +37,19 @@ class LocAdapterBase; class UlpProxyBase { public: - inline UlpProxyBase() {} + LocPosMode mPosMode; + bool mFixSet; + inline UlpProxyBase() { + mPosMode.mode = LOC_POSITION_MODE_INVALID; + mFixSet = false; + } inline virtual ~UlpProxyBase() {} - inline virtual bool sendStartFix() { return false;} - inline virtual bool sendStopFix() { return false;} - inline virtual bool sendFixMode(LocPosMode ¶ms) { return false;} + inline virtual bool 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, diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index c8d08853..0b17b2c3 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -52,22 +52,6 @@ void LocInternalAdapter::stopFixInt() { void LocInternalAdapter::getZppInt() { sendMsg(new LocEngGetZpp(mLocEngAdapter)); } -void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) { - struct LocSetUlpProxy : public LocMsg { - LocAdapterBase* mAdapter; - UlpProxyBase* mUlp; - inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) : - LocMsg(), mAdapter(adapter), mUlp(ulp) { - } - virtual void proc() const { - LOC_LOGV("%s] ulp %p adapter %p", __func__, - mUlp, mAdapter); - mAdapter->setUlpProxy(mUlp); - } - }; - - sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp)); -} LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner, ContextBase* context, @@ -95,6 +79,23 @@ LocEngAdapter::~LocEngAdapter() LOC_LOGV("LocEngAdapter deleted"); } +void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) { + struct LocSetUlpProxy : public LocMsg { + LocAdapterBase* mAdapter; + UlpProxyBase* mUlp; + inline LocSetUlpProxy(LocAdapterBase* adapter, UlpProxyBase* ulp) : + LocMsg(), mAdapter(adapter), mUlp(ulp) { + } + virtual void proc() const { + LOC_LOGV("%s] ulp %p adapter %p", __func__, + mUlp, mAdapter); + mAdapter->setUlpProxy(mUlp); + } + }; + + sendMsg(new LocSetUlpProxy(mLocEngAdapter, ulp)); +} + void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp) { if (ulp == mUlp) { @@ -102,18 +103,24 @@ void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp) //and we get the same object back for UlpProxyBase . Do nothing return; } - delete mUlp; + LOC_LOGV("%s] %p", __func__, ulp); if (NULL == ulp) { + LOC_LOGE("%s:%d]: ulp pointer is NULL", __func__, __LINE__); ulp = new UlpProxyBase(); } - mUlp = ulp; - if (LOC_POSITION_MODE_INVALID != mFixCriteria.mode) { + if (LOC_POSITION_MODE_INVALID != mUlp->mPosMode.mode) { // need to send this mode and start msg to ULP - mUlp->sendFixMode(mFixCriteria); - mUlp->sendStartFix(); + ulp->sendFixMode(mUlp->mPosMode); } + + if(mUlp->mFixSet) { + ulp->sendStartFix(); + } + + delete mUlp; + mUlp = ulp; } void LocInternalAdapter::reportPosition(UlpLocation &location, @@ -294,4 +301,3 @@ void LocEngAdapter::handleEngineUpEvent() { sendMsg(new LocEngUp(mOwner)); } - From 7e546e6afefba214ba9dc14359c1fc018654e8f4 Mon Sep 17 00:00:00 2001 From: Jiafei Wen Date: Wed, 20 Nov 2013 17:04:39 -0800 Subject: [PATCH 14/41] Emergency SUPL This change is for the new added emergency SUPL session. Adding a new field in gps.conf named SUPL_ES, which is for emergency supl NI. CRs-fixed: 600375 Change-Id: I7c21c5589259df4f1cb7ec2f850e708b2c4faa1a --- core/gps_extended_c.h | 4 +++- core/loc_core_log.cpp | 5 +++-- etc/gps.conf | 3 +++ loc_api/libloc_api_50001/loc_eng_ni.cpp | 16 ++++++++++++---- loc_api/libloc_api_50001/loc_eng_ni.h | 3 ++- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index f970b644..55c158e3 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -61,6 +61,8 @@ extern "C" { #define ULP_MIN_INTERVAL_INVALID 0xffffffff +/*Emergency SUPL*/ +#define GPS_NI_TYPE_EMERGENCY_SUPL 4 typedef struct { /** set to sizeof(UlpLocation) */ diff --git a/core/loc_core_log.cpp b/core/loc_core_log.cpp index 461273ff..af2cced7 100644 --- a/core/loc_core_log.cpp +++ b/core/loc_core_log.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -161,7 +161,8 @@ static loc_name_val_s_type loc_eng_ni_types[] = { NAME_VAL( GPS_NI_TYPE_VOICE ), NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ), - NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ) + NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ), + NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL ) }; static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type); diff --git a/etc/gps.conf b/etc/gps.conf index 15dda2a4..b79b3801 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -29,6 +29,9 @@ INTERMEDIATE_POS=0 # supl version 1.0 SUPL_VER=0x10000 +# Emergency SUPL, 1=enable, 0=disable +SUPL_ES=1 + # GPS Capabilities bit mask # SCHEDULING = 0x01 # MSB = 0x02 diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index f017cab6..74abfd42 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -218,6 +218,8 @@ static void* ni_thread_proc(void *args) "pthread_cond_timedwait = %d\n",rc ); loc_eng_ni_data_p->respRecvd = FALSE; /* Reset the user response flag for the next session*/ + LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); + // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() @@ -225,9 +227,14 @@ static void* ni_thread_proc(void *args) LocEngInformNiResponse *msg = NULL; if (NULL != loc_eng_ni_data_p->rawRequest) { - msg = new LocEngInformNiResponse(adapter, - loc_eng_ni_data_p->resp, - loc_eng_ni_data_p->rawRequest); + if (loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE) { + LOC_LOGD("loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE \n"); + msg = new LocEngInformNiResponse(adapter, + loc_eng_ni_data_p->resp, + loc_eng_ni_data_p->rawRequest); + } else { + LOC_LOGD("this is the ignore reply for SUPL ES\n"); + } loc_eng_ni_data_p->rawRequest = NULL; } pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); @@ -236,6 +243,7 @@ static void* ni_thread_proc(void *args) loc_eng_ni_data_p->reqID++; if (NULL != msg) { + LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n"); adapter->sendMsg(msg); } diff --git a/loc_api/libloc_api_50001/loc_eng_ni.h b/loc_api/libloc_api_50001/loc_eng_ni.h index 9cbc57dc..8c076041 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.h +++ b/loc_api/libloc_api_50001/loc_eng_ni.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009,2011 The Linux Foundation. All rights reserved. +/* Copyright (c) 2009,2011,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +34,7 @@ #define LOC_NI_NO_RESPONSE_TIME 20 /* secs */ #define LOC_NI_NOTIF_KEY_ADDRESS "Address" +#define GPS_NI_RESPONSE_IGNORE 4 typedef struct { pthread_t thread; /* NI thread */ From b83679bfc95d7b7f5d1ea427d02915efebc4ecbd Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Tue, 14 May 2013 12:23:58 -0700 Subject: [PATCH 15/41] loc_api_v02: Updating to loc api v02 idl Major:0x02, Minor:0x14 Renames elapsed_millis_since_boot.cpp to platform_lib_time.cpp. Fixed Klockwork null pointer dereference errors. CRs-fixed: 476773 Change-Id: I8c05bb3ab6fdd3ec80d7fe3427160b2e29d7a0d0 --- loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c | 6 ++++-- ...{elapsed_millis_since_boot.cpp => platform_lib_time.cpp} | 2 ++ platform_lib_abstractions/platform_lib_time.h | 1 + utils/Makefile.am | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) rename platform_lib_abstractions/{elapsed_millis_since_boot.cpp => platform_lib_time.cpp} (99%) diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c index dffcad06..5d9a449e 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c @@ -110,8 +110,10 @@ SIDE EFFECTS int loc_eng_dmn_conn_glue_piperemove(const char * pipe_name, int fd) { close(fd); - if (pipe_name) unlink(pipe_name); - LOC_LOGD("fd = %d, %s\n", fd, pipe_name); + if (pipe_name != NULL) { + unlink(pipe_name); + LOC_LOGD("fd = %d, %s\n", fd, pipe_name); + } return 0; } diff --git a/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/platform_lib_abstractions/platform_lib_time.cpp similarity index 99% rename from platform_lib_abstractions/elapsed_millis_since_boot.cpp rename to platform_lib_abstractions/platform_lib_time.cpp index e8cb93a9..45bb8e6b 100644 --- a/platform_lib_abstractions/elapsed_millis_since_boot.cpp +++ b/platform_lib_abstractions/platform_lib_time.cpp @@ -44,3 +44,5 @@ int64_t elapsedMillisSinceBoot() int64_t t_us = systemTime(0); return (int64_t) t_us / 1000LL; } + + diff --git a/platform_lib_abstractions/platform_lib_time.h b/platform_lib_abstractions/platform_lib_time.h index ce013afc..d2f9264a 100644 --- a/platform_lib_abstractions/platform_lib_time.h +++ b/platform_lib_abstractions/platform_lib_time.h @@ -28,6 +28,7 @@ #ifndef _PLATFORM_LIB_TIME_H_ #define _PLATFORM_LIB_TIME_H_ +#include int64_t systemTime(int clock); int64_t elapsedMillisSinceBoot(); diff --git a/utils/Makefile.am b/utils/Makefile.am index e5935f05..13be4bb3 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -20,7 +20,7 @@ libgps_utils_so_la_c_sources = linked_list.c \ msg_q.c \ loc_cfg.cpp \ loc_log.cpp \ - ../platform_lib_abstractions/elapsed_millis_since_boot.cpp + ../platform_lib_abstractions/platform_lib_time.cpp library_includedir = $(pkgincludedir)/utils From fba6dcd31f5eb6af147fc0c7160b29834533f432 Mon Sep 17 00:00:00 2001 From: Ekta Shah Date: Wed, 24 Jul 2013 15:04:43 -0700 Subject: [PATCH 16/41] gps: Remove dependency on libcutils.so Change-Id: Id3d6e2c81eb6d5ee549236c591cc75ac32aa948b --- loc_api/fake_property_service.c | 16 ++++++++++++++++ loc_api/fake_property_service.h | 19 +++++++++++++++++++ loc_api/libloc_api_50001/Makefile.am | 16 ++++++++++------ loc_api/libloc_api_50001/loc.cpp | 6 ++++++ loc_api/libloc_api_50001/loc.h | 1 - loc_api/libloc_api_50001/loc_eng.cpp | 16 ++++++++++++++++ utils/Makefile.am | 2 +- 7 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 loc_api/fake_property_service.c create mode 100644 loc_api/fake_property_service.h diff --git a/loc_api/fake_property_service.c b/loc_api/fake_property_service.c new file mode 100644 index 00000000..82e9cb03 --- /dev/null +++ b/loc_api/fake_property_service.c @@ -0,0 +1,16 @@ +/* Copyright (c) 2011,2012 Qualcomm Technologies, Inc. All Rights Reserved. + * Qualcomm Technologies Proprietary and Confidential. + */ +#include + +int property_get(const char *key, char * value, const char *default_value) +{ + /* This will disable gps interface + value[0] = '1'; + */ + if (strcmp(key, "ro.baseband") == 0) { + memcpy(value, "msm", 4); + } + return 0; +} + diff --git a/loc_api/fake_property_service.h b/loc_api/fake_property_service.h new file mode 100644 index 00000000..33fc6b11 --- /dev/null +++ b/loc_api/fake_property_service.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2013, Qualcomm Technologies, Inc. All Rights Reserved. + * Qualcomm Technologies Proprietary and Confidential. + */ +#ifndef _FAKE_PROPERTY_SERVICE_H_ +#define _FAKE_PROPERTY_SERVICE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define PROPERTY_VALUE_MAX 92 +int property_get(const char *key, char *value, const char *default_value); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am index 23743570..d07d224b 100644 --- a/loc_api/libloc_api_50001/Makefile.am +++ b/loc_api/libloc_api_50001/Makefile.am @@ -1,10 +1,11 @@ AM_CFLAGS = \ -I../../utils \ -I../../platform_lib_abstractions \ + -I../ \ -fno-short-enums \ -DFEATURE_GNSS_BIT_API -libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp +libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp ../fake_property_service.c if USE_GLIB libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ @@ -15,7 +16,7 @@ libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la +libloc_adapter_so_la_LIBADD = -lstdc++ ../../utils/libgps_utils_so.la libloc_eng_so_la_SOURCES = \ @@ -28,7 +29,8 @@ libloc_eng_so_la_SOURCES = \ loc_eng_dmn_conn_handler.cpp \ loc_eng_dmn_conn_thread_helper.c \ loc_eng_dmn_conn_glue_msg.c \ - loc_eng_dmn_conn_glue_pipe.c + loc_eng_dmn_conn_glue_pipe.c \ + ../fake_property_service.c if USE_GLIB @@ -41,12 +43,13 @@ libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la +libloc_eng_so_la_LIBADD = -lstdc++ -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la libgps_default_so_la_SOURCES = \ loc.cpp \ - gps.c + gps.c \ + ../fake_property_service.c if USE_GLIB libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ @@ -58,7 +61,7 @@ libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la +libgps_default_so_la_LIBADD = -lstdc++ ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la library_include_HEADERS = \ LocEngAdapter.h \ @@ -69,6 +72,7 @@ library_include_HEADERS = \ loc_eng_agps.h \ loc_eng_msg.h \ loc_eng_log.h + ../fake_property_service.h library_includedir = $(pkgincludedir)/libloc_api_50001 diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 0b032f0b..a1db5046 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -43,7 +43,12 @@ #include #include #include +#ifdef _ANDROID #include +#else +#include "fake_property_service.h" +#endif +#include using namespace loc_core; @@ -165,6 +170,7 @@ const GpsInterface* gps_get_hardware_interface () const GpsInterface* ret_val; char propBuf[PROPERTY_VALUE_MAX]; + memset(propBuf, 0, sizeof(propBuf)); loc_eng_read_config(); diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h index c9593235..55456193 100644 --- a/loc_api/libloc_api_50001/loc.h +++ b/loc_api/libloc_api_50001/loc.h @@ -35,7 +35,6 @@ extern "C" { #endif /* __cplusplus */ #include -#include #include #include diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index f54066b2..9a05dd7a 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -47,12 +47,22 @@ #include +#ifdef _ANDROID #include +#endif + #ifndef USE_GLIB #include #include #endif /* USE_GLIB */ +#ifndef _ANDROID +typedef enum { + SP_BACKGROUND = 0, + SP_FOREGROUND = 1, +} SchedPolicy; +#endif + #ifdef USE_GLIB #include #include @@ -73,6 +83,12 @@ #include "loc_core_log.h" #include "loc_eng_log.h" +#ifdef _ANDROID +#include +#else +#include "fake_property_service.h" +#endif + #define SUCCESS TRUE #define FAILURE FALSE diff --git a/utils/Makefile.am b/utils/Makefile.am index 13be4bb3..d245439d 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -38,7 +38,7 @@ libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libgps_utils_so_la_LIBADD = -lstdc++ -lcutils +libgps_utils_so_la_LIBADD = -lstdc++ #Create and Install libraries lib_LTLIBRARIES = libgps_utils_so.la From 5c8ebe897948f047954e016d6375403a21cc777d Mon Sep 17 00:00:00 2001 From: Yogesh Lal Date: Wed, 31 Jul 2013 16:36:12 +0530 Subject: [PATCH 17/41] gps: Updating copyright. Change-Id: I94124bbbeb6d932a21fd6b1f5536d834f7185cd8 --- loc_api/fake_property_service.c | 30 ++++++++++++++++++++++++++++-- loc_api/fake_property_service.h | 30 ++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 4 deletions(-) diff --git a/loc_api/fake_property_service.c b/loc_api/fake_property_service.c index 82e9cb03..4df7860b 100644 --- a/loc_api/fake_property_service.c +++ b/loc_api/fake_property_service.c @@ -1,6 +1,32 @@ -/* Copyright (c) 2011,2012 Qualcomm Technologies, Inc. All Rights Reserved. - * Qualcomm Technologies Proprietary and Confidential. +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ + #include int property_get(const char *key, char * value, const char *default_value) diff --git a/loc_api/fake_property_service.h b/loc_api/fake_property_service.h index 33fc6b11..1c15a4ee 100644 --- a/loc_api/fake_property_service.h +++ b/loc_api/fake_property_service.h @@ -1,6 +1,32 @@ -/* Copyright (c) 2013, Qualcomm Technologies, Inc. All Rights Reserved. - * Qualcomm Technologies Proprietary and Confidential. +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ + #ifndef _FAKE_PROPERTY_SERVICE_H_ #define _FAKE_PROPERTY_SERVICE_H From 78767a18f679b8a92a89cf97adc05e7acc8c1033 Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Fri, 30 Aug 2013 16:04:25 -0700 Subject: [PATCH 18/41] loc-api: Making off-target garden-app build and run again After removing libcutils dependency, the off-target garden-app was not building. This change enables it to build and run again Change-Id: Ifb0473f5d05c156f761c72e29f6592b443ee9cb3 --- loc_api/fake_sched_policy.c | 26 ++++++++++++++++++ loc_api/fake_sched_policy.h | 40 ++++++++++++++++++++++++++++ loc_api/libloc_api_50001/Makefile.am | 2 +- loc_api/libloc_api_50001/gps.c | 1 + loc_api/libloc_api_50001/loc_eng.cpp | 39 +++------------------------ 5 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 loc_api/fake_sched_policy.c create mode 100644 loc_api/fake_sched_policy.h diff --git a/loc_api/fake_sched_policy.c b/loc_api/fake_sched_policy.c new file mode 100644 index 00000000..4d6a4e8d --- /dev/null +++ b/loc_api/fake_sched_policy.c @@ -0,0 +1,26 @@ +/* Copyright (c) 2011, Qualcomm Technologies, Inc. All Rights Reserved. + * Qualcomm Technologies Proprietary and Confidential. + */ + +#include "fake_sched_policy.h" + +/*=========================================================================== +FUNCTION set_sched_policy + +DESCRIPTION + Local copy of this function which bypasses android set_sched_policy + +DEPENDENCIES + None + +RETURN VALUE + 0 + +SIDE EFFECTS + N/A + +===========================================================================*/ +int set_sched_policy(int tid, SchedPolicy policy) +{ + return 0; +} diff --git a/loc_api/fake_sched_policy.h b/loc_api/fake_sched_policy.h new file mode 100644 index 00000000..1fea48a7 --- /dev/null +++ b/loc_api/fake_sched_policy.h @@ -0,0 +1,40 @@ +/* Copyright (c) 2013, Qualcomm Technologies, Inc. All Rights Reserved. + * Qualcomm Technologies Proprietary and Confidential. + */ + +#ifndef _FAKE_SCHED_POLICY_H +#define _FAKE_SCHED_POLICY_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SP_BACKGROUND = 0, + SP_FOREGROUND = 1, +} SchedPolicy; + +/*=========================================================================== +FUNCTION set_sched_policy + +DESCRIPTION + Local copy of this function which bypasses android set_sched_policy + +DEPENDENCIES + None + +RETURN VALUE + 0 + +SIDE EFFECTS + N/A + +===========================================================================*/ +int set_sched_policy(int tid, SchedPolicy policy); + +#ifdef __cplusplus +} +#endif + +#endif // _FAKE_SCHED_POLICY_H + diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am index d07d224b..64d4c13f 100644 --- a/loc_api/libloc_api_50001/Makefile.am +++ b/loc_api/libloc_api_50001/Makefile.am @@ -5,7 +5,7 @@ AM_CFLAGS = \ -fno-short-enums \ -DFEATURE_GNSS_BIT_API -libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp ../fake_property_service.c +libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp ../fake_property_service.c ../fake_sched_policy.c if USE_GLIB libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ diff --git a/loc_api/libloc_api_50001/gps.c b/loc_api/libloc_api_50001/gps.c index b0669af2..46596aa4 100644 --- a/loc_api/libloc_api_50001/gps.c +++ b/loc_api/libloc_api_50001/gps.c @@ -30,6 +30,7 @@ #include #include +#include extern const GpsInterface* get_gps_interface(); diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 9a05dd7a..a31fb7b1 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -49,6 +49,10 @@ #ifdef _ANDROID #include +#include +#else +#include "fake_sched_policy.h" +#include "fake_property_service.h" #endif #ifndef USE_GLIB @@ -56,12 +60,6 @@ #include #endif /* USE_GLIB */ -#ifndef _ANDROID -typedef enum { - SP_BACKGROUND = 0, - SP_FOREGROUND = 1, -} SchedPolicy; -#endif #ifdef USE_GLIB #include @@ -83,12 +81,6 @@ typedef enum { #include "loc_core_log.h" #include "loc_eng_log.h" -#ifdef _ANDROID -#include -#else -#include "fake_property_service.h" -#endif - #define SUCCESS TRUE #define FAILURE FALSE @@ -2555,29 +2547,6 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) EXIT_LOG(%s, VOID_RET); } -#ifdef USE_GLIB -/*=========================================================================== -FUNCTION set_sched_policy - -DESCRIPTION - Local copy of this function which bypasses android set_sched_policy - -DEPENDENCIES - None - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -static int set_sched_policy(int tid, SchedPolicy policy) -{ - return 0; -} -#endif /* USE_GLIB */ - /*=========================================================================== FUNCTION loc_eng_read_config From 508ad95a84a6f01e88e2cbd7504ef6a56ee310f8 Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Mon, 2 Sep 2013 13:37:48 -0700 Subject: [PATCH 19/41] loc-api: Fixing copyright Change-Id: Id54e7b212b895c7a521e0252b7c99be8e295b0d9 --- loc_api/fake_sched_policy.c | 29 +++++++++++++++++++++++++++-- loc_api/fake_sched_policy.h | 29 +++++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/loc_api/fake_sched_policy.c b/loc_api/fake_sched_policy.c index 4d6a4e8d..96bdc0dd 100644 --- a/loc_api/fake_sched_policy.c +++ b/loc_api/fake_sched_policy.c @@ -1,5 +1,30 @@ -/* Copyright (c) 2011, Qualcomm Technologies, Inc. All Rights Reserved. - * Qualcomm Technologies Proprietary and Confidential. +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #include "fake_sched_policy.h" diff --git a/loc_api/fake_sched_policy.h b/loc_api/fake_sched_policy.h index 1fea48a7..343035d6 100644 --- a/loc_api/fake_sched_policy.h +++ b/loc_api/fake_sched_policy.h @@ -1,5 +1,30 @@ -/* Copyright (c) 2013, Qualcomm Technologies, Inc. All Rights Reserved. - * Qualcomm Technologies Proprietary and Confidential. +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * */ #ifndef _FAKE_SCHED_POLICY_H From e2bcdc300ee3ac09897c7b99fab350d7b0bca492 Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Wed, 28 Aug 2013 16:11:44 -0700 Subject: [PATCH 20/41] loc-api: Exposing gps_get_hardware_interface to C code Change-Id: Ieffd21d0cb84d88d1304bb82bb5a54137cf967fd --- loc_api/libloc_api_50001/loc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index a1db5046..1ffc42a5 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -164,7 +164,7 @@ SIDE EFFECTS N/A ===========================================================================*/ -const GpsInterface* gps_get_hardware_interface () +extern "C" const GpsInterface* gps_get_hardware_interface () { ENTRY_LOG_CALLFLOW(); const GpsInterface* ret_val; From 70b94ae2c182efb680199b17c3efa5208e67d08f Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Tue, 24 Sep 2013 20:10:04 -0700 Subject: [PATCH 21/41] loc-api: Merging Makefiles of libloc_api_50001 and loc_api_v02 Created a new Makefile.am that builds both libloc_api_50001 and loc_api_v02 Change-Id: I20960f1c087c9a6bf721ea3e25369590f5b2ce85 --- Makefile.am | 2 +- configure.ac | 3 +- loc-api.pc.in | 4 +- loc_api/Makefile.am | 121 +++++++++++++++++++++++++++ loc_api/libloc_api_50001/Makefile.am | 80 ------------------ 5 files changed, 125 insertions(+), 85 deletions(-) create mode 100644 loc_api/Makefile.am delete mode 100644 loc_api/libloc_api_50001/Makefile.am diff --git a/Makefile.am b/Makefile.am index f374a5c5..509ed279 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = utils loc_api/libloc_api_50001 loc_api/loc_api_v02 +SUBDIRS = utils loc_api pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = loc-api.pc diff --git a/configure.ac b/configure.ac index dca18a19..5aac06e5 100644 --- a/configure.ac +++ b/configure.ac @@ -77,8 +77,7 @@ AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") AC_CONFIG_FILES([ \ Makefile \ utils/Makefile \ - loc_api/libloc_api_50001/Makefile \ - loc_api/loc_api_v02/Makefile \ + loc_api/Makefile \ loc-api.pc \ ]) diff --git a/loc-api.pc.in b/loc-api.pc.in index 3b4f81bf..cf4936f5 100644 --- a/loc-api.pc.in +++ b/loc-api.pc.in @@ -6,5 +6,5 @@ includedir=@includedir@ Name: loc-api Description: Qualcomm GPS Location API Version: @VERSION@ -Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_eng_so -lgps_default_so -lloc_api -Cflags: -I${includedir}/loc-api/libloc_api_50001 -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api +Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_api -lloc_eng_so -lgps_default_so +Cflags: -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am new file mode 100644 index 00000000..a479a81b --- /dev/null +++ b/loc_api/Makefile.am @@ -0,0 +1,121 @@ +AM_CFLAGS = \ + $(QMIF_CFLAGS) \ + -I../utils \ + -I../platform_lib_abstractions \ + -I./ulp/inc \ + -I./libloc_api_50001 \ + -I./loc_api_v02 \ + -I./ \ + -fno-short-enums \ + -DFEATURE_GNSS_BIT_API + +libloc_adapter_so_la_SOURCES = \ + libloc_api_50001/loc_eng_log.cpp \ + libloc_api_50001/LocApiAdapter.cpp \ + fake_property_service.c \ + fake_sched_policy.c + +if USE_GLIB +libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) +libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif +libloc_adapter_so_la_LIBADD = -lstdc++ ../utils/libgps_utils_so.la + + +libloc_api_la_SOURCES = \ + loc_api_v02/LocApiV02Adapter.cpp \ + loc_api_v02/loc_api_v02_log.c \ + loc_api_v02/loc_api_v02_client.c \ + loc_api_v02/loc_api_sync_req.c \ + loc_api_v02/location_service_v02.c \ + loc_api_v02/LocApiV02Adapter.h \ + loc_api_v02/loc_util_log.h \ + loc_api_v02/location_service_v02.h \ + loc_api_v02/loc_api_sync_req.h \ + loc_api_v02/loc_api_v02_client.h \ + loc_api_v02/loc_api_v02_log.h + +if USE_GLIB +libloc_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_api_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_api_la_CFLAGS = $(AM_CFLAGS) +libloc_api_la_LDFLAGS = -shared -version-info 1:0:0 +libloc_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) ../utils/libgps_utils_so.la libloc_adapter_so.la + +libloc_eng_so_la_SOURCES = \ + libloc_api_50001/loc_eng.cpp \ + libloc_api_50001/loc_eng_agps.cpp \ + libloc_api_50001/loc_eng_xtra.cpp \ + libloc_api_50001/loc_eng_ni.cpp \ + libloc_api_50001/loc_eng_log.cpp \ + libloc_api_50001/loc_eng_dmn_conn.cpp \ + libloc_api_50001/loc_eng_dmn_conn_handler.cpp \ + libloc_api_50001/loc_eng_dmn_conn_thread_helper.c \ + libloc_api_50001/loc_eng_dmn_conn_glue_msg.c \ + libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c \ + fake_property_service.c + + +if USE_GLIB +libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) +libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_eng_so_la_LIBADD = -lstdc++ -ldl ../utils/libgps_utils_so.la libloc_adapter_so.la libloc_api.la + + +libgps_default_so_la_SOURCES = \ + libloc_api_50001/loc.cpp \ + libloc_api_50001/gps.c \ + fake_property_service.c + +if USE_GLIB +libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libgps_default_so_la_CFLAGS = $(AM_CFLAGS) +libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libgps_default_so_la_LIBADD = -lstdc++ ../utils/libgps_utils_so.la -ldl libloc_eng_so.la + +library_include_HEADERS = \ + libloc_api_50001/LocApiAdapter.h \ + libloc_api_50001/loc.h \ + libloc_api_50001/loc_eng.h \ + libloc_api_50001/loc_eng_xtra.h \ + libloc_api_50001/loc_eng_ni.h \ + libloc_api_50001/loc_eng_agps.h \ + libloc_api_50001/loc_eng_msg.h \ + libloc_api_50001/loc_eng_msg_id.h \ + libloc_api_50001/loc_eng_log.h \ + loc_api_v02/LocApiV02Adapter.h \ + loc_api_v02/loc_util_log.h \ + loc_api_v02/location_service_v02.h \ + loc_api_v02/loc_api_sync_req.h \ + loc_api_v02/loc_api_v02_client.h \ + loc_api_v02/loc_api_v02_log.h \ + ulp/inc/ulp.h \ + fake_property_service.h + +library_includedir = $(pkgincludedir) + +#Create and Install libraries +lib_LTLIBRARIES = libloc_adapter_so.la libloc_api.la libloc_eng_so.la libgps_default_so.la diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am deleted file mode 100644 index 64d4c13f..00000000 --- a/loc_api/libloc_api_50001/Makefile.am +++ /dev/null @@ -1,80 +0,0 @@ -AM_CFLAGS = \ - -I../../utils \ - -I../../platform_lib_abstractions \ - -I../ \ - -fno-short-enums \ - -DFEATURE_GNSS_BIT_API - -libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp ../fake_property_service.c ../fake_sched_policy.c - -if USE_GLIB -libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) -libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif -libloc_adapter_so_la_LIBADD = -lstdc++ ../../utils/libgps_utils_so.la - - -libloc_eng_so_la_SOURCES = \ - loc_eng.cpp \ - loc_eng_agps.cpp \ - loc_eng_xtra.cpp \ - loc_eng_ni.cpp \ - loc_eng_log.cpp \ - loc_eng_dmn_conn.cpp \ - loc_eng_dmn_conn_handler.cpp \ - loc_eng_dmn_conn_thread_helper.c \ - loc_eng_dmn_conn_glue_msg.c \ - loc_eng_dmn_conn_glue_pipe.c \ - ../fake_property_service.c - - -if USE_GLIB -libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) -libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libloc_eng_so_la_LIBADD = -lstdc++ -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la - - -libgps_default_so_la_SOURCES = \ - loc.cpp \ - gps.c \ - ../fake_property_service.c - -if USE_GLIB -libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libgps_default_so_la_CFLAGS = $(AM_CFLAGS) -libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libgps_default_so_la_LIBADD = -lstdc++ ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la - -library_include_HEADERS = \ - LocEngAdapter.h \ - loc.h \ - loc_eng.h \ - loc_eng_xtra.h \ - loc_eng_ni.h \ - loc_eng_agps.h \ - loc_eng_msg.h \ - loc_eng_log.h - ../fake_property_service.h - -library_includedir = $(pkgincludedir)/libloc_api_50001 - -#Create and Install libraries -lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la From 91ece00117a01e54e26a863f9a57be2120b55506 Mon Sep 17 00:00:00 2001 From: Dongmei Wang Date: Fri, 27 Jun 2014 14:21:50 -0700 Subject: [PATCH 22/41] loc-hal:porting from ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.040 It contains the following changes: - porting from AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.02.048.040 - updated package loc-api files according to the merge - rename loc-api to loc-hal - dynamically load liblbs_core.so.1 file for LE platforms - print a warning message when loading the lbs_core library fails CRs-fixed: 605821 Change-Id: I54e1a9c742d1734ffa29e6864901119e0ee600c8 --- Makefile.am | 4 +- configure.ac | 17 ++- core/ContextBase.cpp | 7 +- core/LocAdapterBase.cpp | 3 +- core/LocApiBase.cpp | 3 +- core/LocDualContext.cpp | 6 +- core/Makefile.am | 47 ++++++ core/MsgTask.cpp | 11 +- {loc_api => core}/fake_sched_policy.c | 2 +- {loc_api => core}/fake_sched_policy.h | 2 +- core/gps_extended.h | 5 +- core/loc_core_log.cpp | 1 + loc-api.pc.in | 10 -- loc-hal.pc.in | 10 ++ loc_api/Makefile.am | 137 ++++++++++-------- loc_api/fake_property_service.c | 5 +- loc_api/libloc_api_50001/loc.cpp | 3 +- loc_api/libloc_api_50001/loc_eng_agps.h | 6 +- .../platform_lib_macros.h | 19 ++- platform_lib_abstractions/platform_lib_time.h | 11 +- utils/Makefile.am | 35 +++-- utils/loc_target.cpp | 4 +- utils/loc_timer.c | 3 +- 23 files changed, 234 insertions(+), 117 deletions(-) create mode 100644 core/Makefile.am rename {loc_api => core}/fake_sched_policy.c (96%) rename {loc_api => core}/fake_sched_policy.h (96%) delete mode 100644 loc-api.pc.in create mode 100644 loc-hal.pc.in diff --git a/Makefile.am b/Makefile.am index 509ed279..3b4b595b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,8 +3,8 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = utils loc_api +SUBDIRS = utils core loc_api pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = loc-api.pc +pkgconfig_DATA = loc-hal.pc EXTRA_DIST = $(pkgconfig_DATA) diff --git a/configure.ac b/configure.ac index 5aac06e5..9b0f6ce0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -# configure.ac -- Autoconf script for gps loc_api +# configure.ac -- Autoconf script for gps loc_hal # # Process this file with autoconf to produce a configure script # Requires autoconf tool later than 2.61 AC_PREREQ(2.61) -# Initialize the gps loc_api package version 1.0.0 -AC_INIT([loc-api],1.0.0) +# Initialize the gps loc-hal package version 1.0.0 +AC_INIT([loc-hal],1.0.0) # Does not strictly follow GNU Coding standards AM_INIT_AUTOMAKE([foreign]) # Disables auto rebuilding of configure, Makefile.ins @@ -29,10 +29,18 @@ AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG # Checks for libraries. +PKG_CHECK_MODULES([QMI], [qmi]) +AC_SUBST([QMI_CFLAGS]) +AC_SUBST([QMI_LIBS]) + PKG_CHECK_MODULES([QMIF], [qmi-framework]) AC_SUBST([QMIF_CFLAGS]) AC_SUBST([QMIF_LIBS]) +PKG_CHECK_MODULES([DATA], [data]) +AC_SUBST([DATA_CFLAGS]) +AC_SUBST([DATA_LIBS]) + AC_ARG_WITH([libhardware_includes], AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@], [Specify the location of the libhardware headers]), @@ -77,8 +85,9 @@ AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") AC_CONFIG_FILES([ \ Makefile \ utils/Makefile \ + core/Makefile \ loc_api/Makefile \ - loc-api.pc \ + loc-hal.pc \ ]) AC_OUTPUT diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index 1bd138ea..db84509c 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,6 +36,7 @@ #include #include #include +#include #include namespace loc_core { @@ -52,6 +53,10 @@ LBSProxyBase* ContextBase::getLBSProxy(const char* libName) proxy = (*getter)(); } } + else + { + LOC_LOGW("%s:%d]: FAILED TO LOAD libname: %s\n", __func__, __LINE__, libName); + } if (NULL == proxy) { proxy = new LBSProxyBase(); } diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 8bbe873f..c6199da9 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,6 +33,7 @@ #include #include #include +#include namespace loc_core { diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 80e23755..64bc2492 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,6 +33,7 @@ #include #include #include +#include namespace loc_core { diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index 86c3613a..d9420ada 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -58,7 +58,11 @@ ContextBase* LocDualContext::mBgContext = NULL; // the name must be shorter than 15 chars const char* LocDualContext::mLocationHalName = "Loc_hal_worker"; +#ifndef USE_GLIB const char* LocDualContext::mIzatLibName = "liblbs_core.so"; +#else +const char* LocDualContext::mIzatLibName = "liblbs_core.so.1"; +#endif const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator, const char* name) diff --git a/core/Makefile.am b/core/Makefile.am new file mode 100644 index 00000000..8a3c2a17 --- /dev/null +++ b/core/Makefile.am @@ -0,0 +1,47 @@ +AM_CFLAGS = -I./ \ + -I../utils \ + -I../platform_lib_abstractions \ + -fno-short-enums + +libloc_core_la_h_sources = \ + MsgTask.h \ + LocApiBase.h \ + LocAdapterBase.h \ + ContextBase.h \ + LocDualContext.h \ + LBSProxyBase.h \ + UlpProxyBase.h \ + gps_extended_c.h \ + gps_extended.h \ + loc_core_log.h \ + fake_sched_policy.h + +libloc_core_la_c_sources = \ + MsgTask.cpp \ + LocApiBase.cpp \ + LocAdapterBase.cpp \ + ContextBase.cpp \ + LocDualContext.cpp \ + loc_core_log.cpp \ + fake_sched_policy.c + +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 ../utils/libgps_utils_so.la + +#Create and Install libraries +lib_LTLIBRARIES = libloc_core.la diff --git a/core/MsgTask.cpp b/core/MsgTask.cpp index 37813394..7d70a9d7 100644 --- a/core/MsgTask.cpp +++ b/core/MsgTask.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,13 +29,18 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_MsgTask" +#ifdef _ANDROID #include +#include +#else +#include "fake_sched_policy.h" +#endif #include #include #include #include #include -#include +#include namespace loc_core { @@ -95,7 +100,7 @@ void* MsgTask::loopMain(void* arg) { MsgTask* copy = (MsgTask*)arg; // make sure we do not run in background scheduling group - set_sched_policy(gettid(), SP_FOREGROUND); + set_sched_policy(GETTID_PLATFORM_LIB_ABSTRACTION, SP_FOREGROUND); if (NULL != copy->mAssociator) { copy->mAssociator(); diff --git a/loc_api/fake_sched_policy.c b/core/fake_sched_policy.c similarity index 96% rename from loc_api/fake_sched_policy.c rename to core/fake_sched_policy.c index 96bdc0dd..ce99b938 100644 --- a/loc_api/fake_sched_policy.c +++ b/core/fake_sched_policy.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/loc_api/fake_sched_policy.h b/core/fake_sched_policy.h similarity index 96% rename from loc_api/fake_sched_policy.h rename to core/fake_sched_policy.h index 343035d6..5b7c7de5 100644 --- a/loc_api/fake_sched_policy.h +++ b/core/fake_sched_policy.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/core/gps_extended.h b/core/gps_extended.h index 88b0415b..e0be6f3e 100644 --- a/core/gps_extended.h +++ b/core/gps_extended.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +34,9 @@ extern "C" { #endif /* __cplusplus */ #include +#ifdef USE_GLIB +#include +#endif struct LocPosMode { diff --git a/core/loc_core_log.cpp b/core/loc_core_log.cpp index af2cced7..43cd60bc 100644 --- a/core/loc_core_log.cpp +++ b/core/loc_core_log.cpp @@ -33,6 +33,7 @@ #include #include #include +#include void LocPosMode::logv() const { diff --git a/loc-api.pc.in b/loc-api.pc.in deleted file mode 100644 index cf4936f5..00000000 --- a/loc-api.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: loc-api -Description: Qualcomm GPS Location API -Version: @VERSION@ -Libs: -L${libdir} -lgps_utils_so -lloc_adapter_so -lloc_api -lloc_eng_so -lgps_default_so -Cflags: -I${includedir}/loc-api/utils -I${includedir}/ -I${includedir}/loc-api diff --git a/loc-hal.pc.in b/loc-hal.pc.in new file mode 100644 index 00000000..36cd4e7d --- /dev/null +++ b/loc-hal.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: loc-hal +Description: QTI GPS Loc HAL +Version: @VERSION +Libs: -L${libdir} -lgps_utils_so -lloc_core -lloc_eng_so -lgps_default_so -lloc_ds_api -lloc_api_v02 +Cflags: -I${includedir} -I${includedir}/loc-hal/utils -I${includedir}/loc-hal/core -I${includedir}/loc-hal diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am index a479a81b..e18d3a74 100644 --- a/loc_api/Makefile.am +++ b/loc_api/Makefile.am @@ -1,56 +1,18 @@ AM_CFLAGS = \ - $(QMIF_CFLAGS) \ - -I../utils \ - -I../platform_lib_abstractions \ - -I./ulp/inc \ - -I./libloc_api_50001 \ - -I./loc_api_v02 \ -I./ \ + -I../core \ + -I./libloc_api_50001 \ + -I../platform_lib_abstractions \ + -I../utils \ -fno-short-enums \ - -DFEATURE_GNSS_BIT_API + -DTARGET_USES_QCOM_BSP -libloc_adapter_so_la_SOURCES = \ - libloc_api_50001/loc_eng_log.cpp \ - libloc_api_50001/LocApiAdapter.cpp \ - fake_property_service.c \ - fake_sched_policy.c - -if USE_GLIB -libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) -libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif -libloc_adapter_so_la_LIBADD = -lstdc++ ../utils/libgps_utils_so.la - - -libloc_api_la_SOURCES = \ - loc_api_v02/LocApiV02Adapter.cpp \ - loc_api_v02/loc_api_v02_log.c \ - loc_api_v02/loc_api_v02_client.c \ - loc_api_v02/loc_api_sync_req.c \ - loc_api_v02/location_service_v02.c \ - loc_api_v02/LocApiV02Adapter.h \ - loc_api_v02/loc_util_log.h \ - loc_api_v02/location_service_v02.h \ - loc_api_v02/loc_api_sync_req.h \ - loc_api_v02/loc_api_v02_client.h \ - loc_api_v02/loc_api_v02_log.h - -if USE_GLIB -libloc_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_api_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_api_la_CFLAGS = $(AM_CFLAGS) -libloc_api_la_LDFLAGS = -shared -version-info 1:0:0 -libloc_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libloc_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) ../utils/libgps_utils_so.la libloc_adapter_so.la +libloc_eng_so_la_h_sources = \ + loc_eng_dmn_conn_glue_msg.h \ + loc_eng_dmn_conn_glue_pipe.h \ + loc_eng_dmn_conn.h \ + loc_eng_dmn_conn_handler.h \ + loc_eng_dmn_conn_thread_helper.h libloc_eng_so_la_SOURCES = \ libloc_api_50001/loc_eng.cpp \ @@ -58,6 +20,8 @@ libloc_eng_so_la_SOURCES = \ libloc_api_50001/loc_eng_xtra.cpp \ libloc_api_50001/loc_eng_ni.cpp \ libloc_api_50001/loc_eng_log.cpp \ + libloc_api_50001/loc_eng_nmea.cpp \ + libloc_api_50001/LocEngAdapter.cpp \ libloc_api_50001/loc_eng_dmn_conn.cpp \ libloc_api_50001/loc_eng_dmn_conn_handler.cpp \ libloc_api_50001/loc_eng_dmn_conn_thread_helper.c \ @@ -65,6 +29,7 @@ libloc_eng_so_la_SOURCES = \ libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c \ fake_property_service.c +libloc_eng_so_la_SOURCES += libloc_eng_so_la_h_sources if USE_GLIB libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ @@ -76,7 +41,7 @@ libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libloc_eng_so_la_LIBADD = -lstdc++ -ldl ../utils/libgps_utils_so.la libloc_adapter_so.la libloc_api.la +libloc_eng_so_la_LIBADD = -lstdc++ -ldl -llog ../utils/libgps_utils_so.la ../core/libloc_core.la libgps_default_so_la_SOURCES = \ @@ -94,28 +59,76 @@ libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libgps_default_so_la_LIBADD = -lstdc++ ../utils/libgps_utils_so.la -ldl libloc_eng_so.la +libgps_default_so_la_LIBADD = -lstdc++ -llog ../utils/libgps_utils_so.la ../core/libloc_core.la -ldl libloc_eng_so.la + + +libloc_ds_api_CFLAGS = \ + $(QMIF_CFLAGS) \ + $(QMI_CFLAGS) \ + $(DATA_CFLAGS) \ + -I$(WORKSPACE)/qcom-opensource/location/loc_api/ds_api + +libloc_ds_api_la_SOURCES = \ + $(WORKSPACE)/qcom-opensource/location/loc_api/ds_api/ds_client.c + +if USE_GLIB +libloc_ds_api_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_ds_api_CFLAGS) @GLIB_CFLAGS@ +libloc_ds_api_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic +libloc_ds_api_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_ds_api_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_ds_api_la_CFLAGS = $(AM_CFLAGS) $(libloc_ds_api_CFLAGS) +libloc_ds_api_la_LDFLAGS = -lstdc++ -lpthread -Wl,--export-dynamic -shared -version-info 1:0:0 +libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic +libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS) +endif + +libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl ../utils/libgps_utils_so.la + +libloc_api_v02_CFLAGS = \ + $(QMIF_CFLAGS) \ + -I$(WORKSPACE)/qcom-opensource/location/loc_api/ds_api \ + -I$(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02 + +libloc_api_v02_la_SOURCES = \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/LocApiV02.cpp \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_log.c \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_client.c \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_sync_req.c \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/location_service_v02.c + +if USE_GLIB +libloc_api_v02_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_api_v02_CFLAGS) @GLIB_CFLAGS@ +libloc_api_v02_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_api_v02_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(libloc_api_v02_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_api_v02_la_CFLAGS = $(AM_CFLAGS) $(libloc_api_v02_CFLAGS) +libloc_api_v02_la_LDFLAGS = -lstdc++ -lpthread -shared -version-info 1:0:0 +libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_api_v02_CFLAGS) +endif + +libloc_api_v02_la_CXXFLAGS = -std=c++0x +libloc_api_v02_la_LIBADD = -lstdc++ -lqmi_cci -lqmi_common_so ../core/libloc_core.la ../utils/libgps_utils_so.la libloc_ds_api.la library_include_HEADERS = \ - libloc_api_50001/LocApiAdapter.h \ + libloc_api_50001/LocEngAdapter.h \ libloc_api_50001/loc.h \ libloc_api_50001/loc_eng.h \ libloc_api_50001/loc_eng_xtra.h \ libloc_api_50001/loc_eng_ni.h \ libloc_api_50001/loc_eng_agps.h \ libloc_api_50001/loc_eng_msg.h \ - libloc_api_50001/loc_eng_msg_id.h \ libloc_api_50001/loc_eng_log.h \ - loc_api_v02/LocApiV02Adapter.h \ - loc_api_v02/loc_util_log.h \ - loc_api_v02/location_service_v02.h \ - loc_api_v02/loc_api_sync_req.h \ - loc_api_v02/loc_api_v02_client.h \ - loc_api_v02/loc_api_v02_log.h \ - ulp/inc/ulp.h \ - fake_property_service.h + fake_property_service.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/ds_api/ds_client.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/location_service_v02.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_log.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_client.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_sync_req.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/LocApiV02.h \ + $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_util_log.h library_includedir = $(pkgincludedir) #Create and Install libraries -lib_LTLIBRARIES = libloc_adapter_so.la libloc_api.la libloc_eng_so.la libgps_default_so.la +lib_LTLIBRARIES = libloc_eng_so.la libgps_default_so.la libloc_ds_api.la libloc_api_v02.la diff --git a/loc_api/fake_property_service.c b/loc_api/fake_property_service.c index 4df7860b..9d660fac 100644 --- a/loc_api/fake_property_service.c +++ b/loc_api/fake_property_service.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,6 +28,9 @@ */ #include +#ifdef USE_GLIB +#include +#endif int property_get(const char *key, char * value, const char *default_value) { diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 1ffc42a5..7031605c 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -48,7 +48,6 @@ #else #include "fake_property_service.h" #endif -#include using namespace loc_core; diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h index 055d955b..8bab3cd5 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/loc_api/libloc_api_50001/loc_eng_agps.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -41,6 +41,10 @@ #include #include +#ifdef USE_GLIB +#include +#endif /* USE_GLIB */ + // forward declaration class AgpsStateMachine; class Subscriber; diff --git a/platform_lib_abstractions/platform_lib_macros.h b/platform_lib_abstractions/platform_lib_macros.h index bc48dd99..a09a4a23 100644 --- a/platform_lib_abstractions/platform_lib_macros.h +++ b/platform_lib_abstractions/platform_lib_macros.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,6 +30,12 @@ #define __PLATFORM_LIB_MACROS_H__ #include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif #define TS_PRINTF(format, x...) \ { \ @@ -63,19 +69,16 @@ #else -#ifdef __cplusplus -extern "C" { -#endif pid_t gettid(void); -#ifdef __cplusplus -} -#endif - #define GETTID_PLATFORM_LIB_ABSTRACTION (gettid()) #define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread #define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime()) #endif +#ifdef __cplusplus +} +#endif /*__cplusplus */ + #endif diff --git a/platform_lib_abstractions/platform_lib_time.h b/platform_lib_abstractions/platform_lib_time.h index d2f9264a..8bdffa97 100644 --- a/platform_lib_abstractions/platform_lib_time.h +++ b/platform_lib_abstractions/platform_lib_time.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,9 +28,18 @@ #ifndef _PLATFORM_LIB_TIME_H_ #define _PLATFORM_LIB_TIME_H_ + #include +#ifdef __cplusplus +extern "C" { +#endif + int64_t systemTime(int clock); int64_t elapsedMillisSinceBoot(); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif diff --git a/utils/Makefile.am b/utils/Makefile.am index d245439d..0e7083eb 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -5,22 +5,29 @@ AM_CFLAGS = -Wundef \ -fno-inline \ -fno-short-enums \ -fpic \ + -I./ \ -I../platform_lib_abstractions -libgps_utils_so_la_h_sources = log_util.h \ - msg_q.h \ - linked_list.h \ - loc_cfg.h \ - loc_log.h \ - ../platform_lib_abstractions/platform_lib_includes.h \ - ../platform_lib_abstractions/platform_lib_time.h \ - ../platform_lib_abstractions/platform_lib_macros.h +libgps_utils_so_la_h_sources = \ + log_util.h \ + msg_q.h \ + linked_list.h \ + loc_cfg.h \ + loc_log.h \ + loc_target.h \ + loc_timer.h \ + ../platform_lib_abstractions/platform_lib_includes.h \ + ../platform_lib_abstractions/platform_lib_time.h \ + ../platform_lib_abstractions/platform_lib_macros.h -libgps_utils_so_la_c_sources = linked_list.c \ - msg_q.c \ - loc_cfg.cpp \ - loc_log.cpp \ - ../platform_lib_abstractions/platform_lib_time.cpp +libgps_utils_so_la_c_sources = \ + linked_list.c \ + msg_q.c \ + loc_cfg.cpp \ + loc_log.cpp \ + loc_timer.c \ + loc_target.cpp \ + ../platform_lib_abstractions/platform_lib_time.cpp library_includedir = $(pkgincludedir)/utils @@ -38,7 +45,7 @@ libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libgps_utils_so_la_LIBADD = -lstdc++ +libgps_utils_so_la_LIBADD = -lstdc++ -llog #Create and Install libraries lib_LTLIBRARIES = libgps_utils_so.la diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index a3ef6b3c..5eff1714 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012,2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -38,6 +39,7 @@ #include "loc_target.h" #include "loc_log.h" #include "log_util.h" +#include #define APQ8064_ID_1 "109" #define APQ8064_ID_2 "153" diff --git a/utils/loc_timer.c b/utils/loc_timer.c index 1e4008eb..0e9f6bde 100644 --- a/utils/loc_timer.c +++ b/utils/loc_timer.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,6 +33,7 @@ #include "loc_timer.h" #include #include +#include"platform_lib_includes.h" enum timer_state { READY = 100, From 3e16bc32b5ac1e55e5325012bb3b761110b4a4f2 Mon Sep 17 00:00:00 2001 From: Dongmei Wang Date: Thu, 14 Aug 2014 17:27:52 -0700 Subject: [PATCH 23/41] Make off-target loc hal libraries built CRs-fixed: 605821 Change-Id: I334ccf21f6e5d045d32c718cb060c67e167be733 --- core/gps_extended.h | 2 +- loc_api/libloc_api_50001/loc_eng.cpp | 4 +++- loc_api/libloc_api_50001/loc_eng_agps.h | 2 +- loc_api/libloc_api_50001/loc_eng_msg.h | 2 +- platform_lib_abstractions/platform_lib_macros.h | 8 +++++--- utils/loc_cfg.cpp | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/core/gps_extended.h b/core/gps_extended.h index e0be6f3e..9eec3f92 100644 --- a/core/gps_extended.h +++ b/core/gps_extended.h @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ #include -#ifdef USE_GLIB +#if defined(USE_GLIB) || defined(OFF_TARGET) #include #endif diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index a31fb7b1..eb307719 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -61,8 +61,10 @@ #endif /* USE_GLIB */ -#ifdef USE_GLIB +#if defined(USE_GLIB) && !defined(OFF_TARGET) #include +#endif +#ifdef USE_GLIB #include #endif /* USE_GLIB */ diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h index 8bab3cd5..81a4133e 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/loc_api/libloc_api_50001/loc_eng_agps.h @@ -41,7 +41,7 @@ #include #include -#ifdef USE_GLIB +#if defined(USE_GLIB) && !defined(OFF_TARGET) #include #endif /* USE_GLIB */ diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index ae962f55..f4ba2dc5 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -43,7 +43,7 @@ #ifndef SSID_BUF_SIZE #define SSID_BUF_SIZE (32+1) #endif -#ifdef USE_GLIB +#if defined(USE_GLIB) && !defined(OFF_TARGET) #include diff --git a/platform_lib_abstractions/platform_lib_macros.h b/platform_lib_abstractions/platform_lib_macros.h index a09a4a23..a1db21a9 100644 --- a/platform_lib_abstractions/platform_lib_macros.h +++ b/platform_lib_abstractions/platform_lib_macros.h @@ -51,10 +51,13 @@ extern "C" { #ifdef USE_GLIB - +#ifndef OFF_TARGET #define strlcat g_strlcat #define strlcpy g_strlcpy - +#else +#define strlcat strncat +#define strlcpy strncpy +#endif #define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) @@ -66,7 +69,6 @@ extern "C" { #define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread #define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot()) - #else pid_t gettid(void); diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 73d1ca41..037ffaf8 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -39,7 +39,7 @@ #include #include #include -#ifdef USE_GLIB +#if defined(USE_GLIB) && !defined(OFF_TARGET) #include #endif #include "platform_lib_includes.h" From 4e9741f5278a7f0f8a6315746c23a9cfa7793e5e Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Tue, 19 Aug 2014 18:44:33 -0700 Subject: [PATCH 24/41] Migrating XTRA from gpsonextra.net to cloud based izatcloud.net *Added logic to remove xtra1.gpsonextra.net from URLs received from modem. *Added logic to override modem URLs with those configured in gps.conf *Replaced all instances of xtra{1,2,3}.gpsonextra.net domain URLs in gps.conf with xtrapath{1,2,3}.izatcloud.net URLs. *Replaced all commented instances of xtra.bin in gps.conf with xtra2.bin. CRs-fixed: 643816 Change-Id: I803b26bce22f06910dcaa1ee057902b9381667bf --- etc/gps.conf | 6 ++--- loc_api/libloc_api_50001/loc_eng.cpp | 35 ++++++++++++++++++++++++---- loc_api/libloc_api_50001/loc_eng.h | 7 +++++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/etc/gps.conf b/etc/gps.conf index b79b3801..a172a8ab 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -1,8 +1,8 @@ #Uncommenting these urls would only enable #the power up auto injection and force injection(test case). -#XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin -#XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin -#XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin +#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin +#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin +#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin # Error Estimate # _SET = 1 diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index eb307719..c3e82f85 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -44,7 +44,7 @@ #include #include #include - +#include #include #ifdef _ANDROID @@ -94,6 +94,8 @@ #define SAP_CONF_FILE "/etc/sap.conf" #endif +#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net" + using namespace loc_core; boolean configAlreadyRead = false; @@ -128,6 +130,9 @@ static loc_param_s_type loc_parameter_table[] = {"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'}, {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, + {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'}, + {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'}, + {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'} }; static void loc_default_parameters(void) @@ -910,12 +915,34 @@ LocEngReportXtraServer::LocEngReportXtraServer(void* locEng, LocMsg(), mLocEng(locEng), mMaxLen(maxlength), mServers(new char[3*(mMaxLen+1)]) { + char * cptr = mServers; memset(mServers, 0, 3*(mMaxLen+1)); - strlcpy(mServers, url1, mMaxLen); - strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen); - strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen); + + // Override modem URLs with uncommented gps.conf urls + if( gps_conf.XTRA_SERVER_1[0] != '\0' ) { + url1 = &gps_conf.XTRA_SERVER_1[0]; + } + if( gps_conf.XTRA_SERVER_2[0] != '\0' ) { + url2 = &gps_conf.XTRA_SERVER_2[0]; + } + if( gps_conf.XTRA_SERVER_3[0] != '\0' ) { + url3 = &gps_conf.XTRA_SERVER_3[0]; + } + // copy non xtra1.gpsonextra.net URLs into the forwarding buffer. + if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) { + strlcpy(cptr, url1, mMaxLen + 1); + cptr += mMaxLen + 1; + } + if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) { + strlcpy(cptr, url2, mMaxLen + 1); + cptr += mMaxLen + 1; + } + if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) { + strlcpy(cptr, url3, mMaxLen + 1); + } locallog(); } + void LocEngReportXtraServer::proc() const { loc_eng_xtra_data_s_type* locEngXtra = &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data); diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 2dfd50f7..59351311 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -67,6 +67,8 @@ typedef unsigned char boolean; #define FAILURE FALSE #define INVALID_ATL_CONNECTION_HANDLE -1 +#define MAX_XTRA_SERVER_URL_LENGTH 256 + enum loc_nmea_provider_e_type { NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA NMEA_PROVIDER_MP // Modem Processor Provider of NMEA @@ -146,6 +148,9 @@ typedef struct loc_gps_cfg_s unsigned long LPP_PROFILE; uint8_t NMEA_PROVIDER; unsigned long A_GLONASS_POS_PROTOCOL_SELECT; + char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH]; } loc_gps_cfg_s_type; typedef struct From 42c543919b189a758445dc1fd59030e735ad30ec Mon Sep 17 00:00:00 2001 From: Dongmei Wang Date: Thu, 31 Jul 2014 15:04:33 -0700 Subject: [PATCH 25/41] loc-stub: Create a loc_stub library for stub func Consolidate fake functions and create the loc_stub library out of the fake functions CRs-fixed: 605814 Change-Id: I351426591f220075fa7a7cec776f4f86c837a3f6 --- .../loc_stub/Makefile.am | 9 +++ .../loc_stub/configure.ac | 67 +++++++++++++++++++ .../include/loc_stub_android_runtime.h | 45 +++++++++++++ .../loc_stub/include/loc_stub_gettid.h | 44 ++++++++++++ .../include/loc_stub_property_service.h | 42 ++++++++++++ .../loc_stub/include/loc_stub_sched_policy.h | 64 ++++++++++++++++++ .../loc_stub/include/loc_stub_time.h | 45 +++++++++++++ .../loc_stub/loc-stub.pc.in | 10 +++ .../loc_stub/src/Makefile.am | 39 +++++++++++ .../loc_stub/src/loc_stub_android_runtime.cpp | 41 ++++++++++++ .../loc_stub/src/loc_stub_gettid.cpp | 37 ++++++++++ .../src/loc_stub_property_service.cpp | 42 ++++++++++++ .../loc_stub/src/loc_stub_sched_policy.cpp | 50 ++++++++++++++ .../loc_stub/src/loc_stub_time.cpp | 46 +++++++++++++ 14 files changed, 581 insertions(+) create mode 100644 platform_lib_abstractions/loc_stub/Makefile.am create mode 100644 platform_lib_abstractions/loc_stub/configure.ac create mode 100644 platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h create mode 100644 platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h create mode 100644 platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h create mode 100644 platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h create mode 100644 platform_lib_abstractions/loc_stub/include/loc_stub_time.h create mode 100644 platform_lib_abstractions/loc_stub/loc-stub.pc.in create mode 100644 platform_lib_abstractions/loc_stub/src/Makefile.am create mode 100644 platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp create mode 100644 platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp create mode 100644 platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp create mode 100644 platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp create mode 100644 platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp diff --git a/platform_lib_abstractions/loc_stub/Makefile.am b/platform_lib_abstractions/loc_stub/Makefile.am new file mode 100644 index 00000000..d81e363a --- /dev/null +++ b/platform_lib_abstractions/loc_stub/Makefile.am @@ -0,0 +1,9 @@ +# Makefile.am for gps loc-stub + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = src + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = loc-stub.pc +EXTRA_DIST = $(pkgconfig_DATA) diff --git a/platform_lib_abstractions/loc_stub/configure.ac b/platform_lib_abstractions/loc_stub/configure.ac new file mode 100644 index 00000000..8900f040 --- /dev/null +++ b/platform_lib_abstractions/loc_stub/configure.ac @@ -0,0 +1,67 @@ +# configure.ac -- Autoconf script for gps loc-stub +# +# Process this file with autoconf to produce a configure script + +# Requires autoconf tool later than 2.61 +AC_PREREQ(2.61) +# Initialize the gps loc-stub package version 1.0.0 +AC_INIT([loc-stub],1.0.0) +# Does not strictly follow GNU Coding standards +AM_INIT_AUTOMAKE([foreign]) +# Disables auto rebuilding of configure, Makefile.ins +AM_MAINTAINER_MODE +# Verifies the --srcdir is correct by checking for the path +AC_CONFIG_SRCDIR([Makefile.am]) +# defines some macros variable to be included by source +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +# Checks for programs. +AC_PROG_LIBTOOL +AC_PROG_CXX +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_AWK +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +PKG_PROG_PKG_CONFIG + +# Checks for libraries. +AC_ARG_WITH([hardware_include], + AC_HELP_STRING([--with-hardware-include=@<:@dir@:>@], + [Specify the location of the hardware headers]), + [hardware_incdir=$withval], + with_hardware_include=no) + +if test "x$with_hardware_include" != "xno"; then + CPPFLAGS="${CPPFLAGS} -I${hardware_incdir}" +fi + +AC_ARG_WITH([glib], + AC_HELP_STRING([--with-glib], + [enable glib, building HLOS systems which use glib])) + +if (test "x${with_glib}" = "xyes"); then + AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) + PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, + AC_MSG_ERROR(GThread >= 2.16 is required)) + PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, + AC_MSG_ERROR(GLib >= 2.16 is required)) + GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" + GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" + + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) +fi + +AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") + +AC_CONFIG_FILES([ \ + Makefile \ + src/Makefile \ + loc-stub.pc + ]) + +AC_OUTPUT diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h b/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h new file mode 100644 index 00000000..c8764eea --- /dev/null +++ b/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LOC_STUB_ANDROID_RUNTIME_H__ +#define __LOC_STUB_ANDROID_RUNTIME_H__ + +#include + +namespace android { + +class AndroidRuntime +{ +public: + /** create a new thread that is visible from Java */ + static pthread_t createJavaThread(const char* name, void (*start)(void *), + void* arg); +}; + +} +#endif /* __LOC_STUB_ANDROID_RUNTIME_H__ */ diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h b/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h new file mode 100644 index 00000000..677bc81a --- /dev/null +++ b/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LOC_STUB_GETTID_H__ +#define __LOC_STUB_GETTID_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +pid_t gettid(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __LOC_STUB_GETTID_H__ */ diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h b/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h new file mode 100644 index 00000000..3677cdf6 --- /dev/null +++ b/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h @@ -0,0 +1,42 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LOC_STUB_PROPERTY_SERVICE_H__ +#define __LOC_STUB_PROPERTY_SERVICE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int property_get(const char *key, char *value, const char *default_value); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LOC_STUB_PROPERTY_SERVICE_H__ */ diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h b/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h new file mode 100644 index 00000000..a42b117b --- /dev/null +++ b/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h @@ -0,0 +1,64 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LOC_STUB_SCHED_POLICY_H__ +#define __LOC_STUB_SCHED_POLICY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + SP_BACKGROUND = 0, + SP_FOREGROUND = 1, +} SchedPolicy; + +/*=========================================================================== +FUNCTION set_sched_policy + +DESCRIPTION + Local copy of this function which bypasses android set_sched_policy + +DEPENDENCIES + None + +RETURN VALUE + 0 + +SIDE EFFECTS + N/A + +===========================================================================*/ +int set_sched_policy(int tid, SchedPolicy policy); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LOC_STUB_SCHED_POLICY_H__ */ + diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_time.h b/platform_lib_abstractions/loc_stub/include/loc_stub_time.h new file mode 100644 index 00000000..271e2ff4 --- /dev/null +++ b/platform_lib_abstractions/loc_stub/include/loc_stub_time.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LOC_STUB_TIME_H__ +#define __LOC_STUB_TIME_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int64_t systemTime(int clock); +int64_t elapsedMillisSinceBoot(); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LOC_STUB_TIME_H__ */ diff --git a/platform_lib_abstractions/loc_stub/loc-stub.pc.in b/platform_lib_abstractions/loc_stub/loc-stub.pc.in new file mode 100644 index 00000000..c2ae764b --- /dev/null +++ b/platform_lib_abstractions/loc_stub/loc-stub.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: loc-stub +Description: QTI GPS Location Stub +Version: @VERSION +Libs: -L${libdir} -lloc_stub +Cflags: -I${includedir}/loc-stub diff --git a/platform_lib_abstractions/loc_stub/src/Makefile.am b/platform_lib_abstractions/loc_stub/src/Makefile.am new file mode 100644 index 00000000..c8ab5fcb --- /dev/null +++ b/platform_lib_abstractions/loc_stub/src/Makefile.am @@ -0,0 +1,39 @@ +AM_CFLAGS = \ + -I../include \ + -fno-short-enums + +libloc_stub_la_extra_h = \ + ../include/utils/Log.h + +libloc_stub_la_c_sources = \ + loc_stub_android_runtime.cpp \ + loc_stub_gettid.cpp \ + loc_stub_property_service.cpp \ + loc_stub_sched_policy.cpp \ + loc_stub_time.cpp + +libloc_stub_la_SOURCES = $(libloc_stub_la_c_sources) $(libloc_stub_la_extra_h) + +library_include_HEADERS = \ + ../include/loc_stub_android_runtime.h \ + ../include/loc_stub_gettid.h \ + ../include/loc_stub_property_service.h \ + ../include/loc_stub_sched_policy.h \ + ../include/loc_stub_time.h + +library_includedir = $(pkgincludedir) + +if USE_GLIB +libloc_stub_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_stub_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_stub_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_stub_la_CFLAGS = $(AM_CFLAGS) +libloc_stub_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_stub_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_stub_la_LIBADD = -lstdc++ -ldl -llog + +#Create and Install libraries +lib_LTLIBRARIES = libloc_stub.la diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp b/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp new file mode 100644 index 00000000..1db69b24 --- /dev/null +++ b/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp @@ -0,0 +1,41 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "loc_stub_android_runtime.h" + +namespace android { + +pthread_t AndroidRuntime::createJavaThread(const char* name, + void (*start)(void *), void* arg) +{ + pthread_t threadId = 0; + pthread_create(&threadId, NULL, (void *(*)(void*))start, arg); + return threadId; +} + +} diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp b/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp new file mode 100644 index 00000000..55ef48a1 --- /dev/null +++ b/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp @@ -0,0 +1,37 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "loc_stub_gettid.h" +#include +#include + +// Required for off-target environment to compile properly +pid_t gettid(void) +{ + return syscall(SYS_gettid); +} diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp b/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp new file mode 100644 index 00000000..f9d9e3ef --- /dev/null +++ b/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp @@ -0,0 +1,42 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "loc_stub_property_service.h" +#include +#include + +int property_get(const char *key, char * value, const char *default_value) +{ + /* This will disable gps interface + value[0] = '1'; + */ + if (strcmp(key, "ro.baseband") == 0) { + memcpy(value, "msm", 4); + } + return 0; +} diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp b/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp new file mode 100644 index 00000000..781be295 --- /dev/null +++ b/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp @@ -0,0 +1,50 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "loc_stub_sched_policy.h" + +/*=========================================================================== +FUNCTION set_sched_policy + +DESCRIPTION + Local copy of this function which bypasses android set_sched_policy + +DEPENDENCIES + None + +RETURN VALUE + 0 + +SIDE EFFECTS + N/A + +===========================================================================*/ +int set_sched_policy(int tid, SchedPolicy policy) +{ + return 0; +} diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp b/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp new file mode 100644 index 00000000..82dc593f --- /dev/null +++ b/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp @@ -0,0 +1,46 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "loc_stub_time.h" +#include +#include + +int64_t systemTime(int clock) +{ + struct timeval t; + t.tv_sec = t.tv_usec = 0; + gettimeofday(&t, NULL); + return t.tv_sec*1000000LL + t.tv_usec; +} + + +int64_t elapsedMillisSinceBoot() +{ + int64_t t_us = systemTime(0); + return (int64_t) t_us / 1000LL; +} From 836bdc4386232b3a86d062f89f3093845d05cb29 Mon Sep 17 00:00:00 2001 From: Dongmei Wang Date: Tue, 2 Dec 2014 18:39:10 -0800 Subject: [PATCH 26/41] loc-pla: Create Platform Library Abstraction layer Defined PLA functions to enable gps libraries to call platform-dependent library calls transparantly. Removed fake files and replaced the fake function with defined PLA functions. CRs-fixed: 605817 Change-Id: I677f658001329a10ef9b49bd963631a83fb4c85f --- configure.ac | 4 ++ core/ContextBase.cpp | 1 - core/LocAdapterBase.cpp | 1 - core/LocApiBase.cpp | 1 - core/LocApiBase.h | 4 +- core/LocDualContext.cpp | 1 - core/Makefile.am | 10 ++- core/MsgTask.cpp | 9 +-- core/loc_core_log.cpp | 1 - loc_api/Makefile.am | 17 +++--- .../libloc_api-rpc-glue/src/LocApiRpc.cpp | 3 +- .../libloc_api-rpc-glue/src/loc_api_log.c | 3 +- .../src/loc_api_rpc_glue.c | 3 +- loc_api/libloc_api_50001/LocEngAdapter.h | 3 +- loc_api/libloc_api_50001/loc.cpp | 12 ++-- loc_api/libloc_api_50001/loc_eng.cpp | 19 +----- loc_api/libloc_api_50001/loc_eng.h | 1 - loc_api/libloc_api_50001/loc_eng_agps.cpp | 3 +- loc_api/libloc_api_50001/loc_eng_agps.h | 2 +- loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp | 5 +- .../loc_eng_dmn_conn_glue_msg.c | 5 +- .../loc_eng_dmn_conn_glue_pipe.c | 5 +- .../loc_eng_dmn_conn_handler.cpp | 5 +- .../loc_eng_dmn_conn_thread_helper.c | 5 +- loc_api/libloc_api_50001/loc_eng_msg.h | 4 +- loc_api/libloc_api_50001/loc_eng_ni.cpp | 3 +- loc_api/libloc_api_50001/loc_eng_nmea.cpp | 4 +- loc_api/libloc_api_50001/loc_eng_xtra.cpp | 5 +- platform_lib_abstractions/loc_pla/Makefile.am | 10 +++ .../loc_pla/configure.ac | 61 +++++++++++++++++++ .../include/platform_lib_android_runtime.h | 45 ++++++++++++++ .../loc_pla/include/platform_lib_gettid.h | 20 +++--- .../include}/platform_lib_includes.h | 15 +++-- .../loc_pla/include/platform_lib_log_util.h | 25 ++++---- .../include}/platform_lib_macros.h | 43 +++++-------- .../include/platform_lib_property_service.h | 43 +++++++++++++ .../include/platform_lib_sched_policy.h | 37 +++-------- .../{ => loc_pla/include}/platform_lib_time.h | 21 ++----- .../loc_pla/loc-pla.pc.in | 10 +++ .../loc_pla/src/Makefile.am | 40 ++++++++++++ .../src/platform_lib_android_runtime.cpp | 40 ++++++++++++ .../loc_pla/src/platform_lib_gettid.cpp | 23 +++---- .../loc_pla/src/platform_lib_log_util.cpp | 48 +++++++++++++++ .../src/platform_lib_property_service.cpp | 39 ++++++++++++ .../loc_pla/src/platform_lib_sched_policy.cpp | 30 +++------ .../{ => loc_pla/src}/platform_lib_time.cpp | 35 ++++++----- utils/Makefile.am | 13 ++-- utils/linked_list.c | 5 +- utils/loc_cfg.cpp | 4 +- utils/loc_log.cpp | 60 +----------------- utils/loc_target.cpp | 5 +- utils/loc_timer.h | 4 +- utils/msg_q.c | 5 +- 53 files changed, 494 insertions(+), 326 deletions(-) create mode 100644 platform_lib_abstractions/loc_pla/Makefile.am create mode 100644 platform_lib_abstractions/loc_pla/configure.ac create mode 100644 platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h rename loc_api/fake_property_service.h => platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h (85%) rename platform_lib_abstractions/{ => loc_pla/include}/platform_lib_includes.h (81%) rename utils/log_util.h => platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h (93%) rename platform_lib_abstractions/{ => loc_pla/include}/platform_lib_macros.h (82%) create mode 100644 platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h rename core/fake_sched_policy.h => platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h (72%) rename platform_lib_abstractions/{ => loc_pla/include}/platform_lib_time.h (83%) create mode 100644 platform_lib_abstractions/loc_pla/loc-pla.pc.in create mode 100644 platform_lib_abstractions/loc_pla/src/Makefile.am create mode 100644 platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp rename loc_api/fake_property_service.c => platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp (81%) create mode 100644 platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp create mode 100644 platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp rename core/fake_sched_policy.c => platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp (75%) rename platform_lib_abstractions/{ => loc_pla/src}/platform_lib_time.cpp (81%) diff --git a/configure.ac b/configure.ac index 9b0f6ce0..4ef39eed 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,10 @@ PKG_CHECK_MODULES([DATA], [data]) AC_SUBST([DATA_CFLAGS]) AC_SUBST([DATA_LIBS]) +PKG_CHECK_MODULES([LOCPLA], [loc-pla]) +AC_SUBST([LOCPLA_CFLAGS]) +AC_SUBST([LOCPLA_LIBS]) + AC_ARG_WITH([libhardware_includes], AC_HELP_STRING([--with-libhardware-includes=@<:@dir@:>@], [Specify the location of the libhardware headers]), diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index db84509c..b2869bb9 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index c6199da9..054a295c 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include namespace loc_core { diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 64bc2492..3cd2ffa8 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include namespace loc_core { diff --git a/core/LocApiBase.h b/core/LocApiBase.h index e162cfc7..c48927c4 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,7 +33,7 @@ #include #include #include -#include +#include namespace loc_core { diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index d9420ada..b4eaf7ff 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include namespace loc_core { diff --git a/core/Makefile.am b/core/Makefile.am index 8a3c2a17..e2d05be4 100644 --- a/core/Makefile.am +++ b/core/Makefile.am @@ -1,6 +1,6 @@ AM_CFLAGS = -I./ \ -I../utils \ - -I../platform_lib_abstractions \ + $(LOCPLA_CFLAGS) \ -fno-short-enums libloc_core_la_h_sources = \ @@ -13,8 +13,7 @@ libloc_core_la_h_sources = \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ - loc_core_log.h \ - fake_sched_policy.h + loc_core_log.h libloc_core_la_c_sources = \ MsgTask.cpp \ @@ -22,8 +21,7 @@ libloc_core_la_c_sources = \ LocAdapterBase.cpp \ ContextBase.cpp \ LocDualContext.cpp \ - loc_core_log.cpp \ - fake_sched_policy.c + loc_core_log.cpp library_includedir = $(pkgincludedir)/core @@ -41,7 +39,7 @@ 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 ../utils/libgps_utils_so.la +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/core/MsgTask.cpp b/core/MsgTask.cpp index 7d70a9d7..df6db808 100644 --- a/core/MsgTask.cpp +++ b/core/MsgTask.cpp @@ -29,16 +29,9 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_MsgTask" -#ifdef _ANDROID -#include -#include -#else -#include "fake_sched_policy.h" -#endif #include #include #include -#include #include #include @@ -100,7 +93,7 @@ void* MsgTask::loopMain(void* arg) { MsgTask* copy = (MsgTask*)arg; // make sure we do not run in background scheduling group - set_sched_policy(GETTID_PLATFORM_LIB_ABSTRACTION, SP_FOREGROUND); + platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); if (NULL != copy->mAssociator) { copy->mAssociator(); diff --git a/core/loc_core_log.cpp b/core/loc_core_log.cpp index 43cd60bc..7d26ba65 100644 --- a/core/loc_core_log.cpp +++ b/core/loc_core_log.cpp @@ -31,7 +31,6 @@ #define LOG_TAG "LocSvc_core_log" #include -#include #include #include diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am index e18d3a74..c5bffed2 100644 --- a/loc_api/Makefile.am +++ b/loc_api/Makefile.am @@ -2,8 +2,8 @@ AM_CFLAGS = \ -I./ \ -I../core \ -I./libloc_api_50001 \ - -I../platform_lib_abstractions \ -I../utils \ + $(LOCPLA_CFLAGS) \ -fno-short-enums \ -DTARGET_USES_QCOM_BSP @@ -26,8 +26,7 @@ libloc_eng_so_la_SOURCES = \ libloc_api_50001/loc_eng_dmn_conn_handler.cpp \ libloc_api_50001/loc_eng_dmn_conn_thread_helper.c \ libloc_api_50001/loc_eng_dmn_conn_glue_msg.c \ - libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c \ - fake_property_service.c + libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c libloc_eng_so_la_SOURCES += libloc_eng_so_la_h_sources @@ -41,13 +40,12 @@ libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libloc_eng_so_la_LIBADD = -lstdc++ -ldl -llog ../utils/libgps_utils_so.la ../core/libloc_core.la +libloc_eng_so_la_LIBADD = -lstdc++ -ldl -llog $(LOCPLA_LIBS) ../utils/libgps_utils_so.la ../core/libloc_core.la libgps_default_so_la_SOURCES = \ libloc_api_50001/loc.cpp \ - libloc_api_50001/gps.c \ - fake_property_service.c + libloc_api_50001/gps.c if USE_GLIB libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ @@ -59,7 +57,7 @@ libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libgps_default_so_la_LIBADD = -lstdc++ -llog ../utils/libgps_utils_so.la ../core/libloc_core.la -ldl libloc_eng_so.la +libgps_default_so_la_LIBADD = -lstdc++ -llog $(LOCPLA_LIBS) ../utils/libgps_utils_so.la ../core/libloc_core.la -ldl libloc_eng_so.la libloc_ds_api_CFLAGS = \ @@ -83,7 +81,7 @@ libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS) endif -libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl ../utils/libgps_utils_so.la +libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la libloc_api_v02_CFLAGS = \ $(QMIF_CFLAGS) \ @@ -108,7 +106,7 @@ libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_api_v02_CFLAGS endif libloc_api_v02_la_CXXFLAGS = -std=c++0x -libloc_api_v02_la_LIBADD = -lstdc++ -lqmi_cci -lqmi_common_so ../core/libloc_core.la ../utils/libgps_utils_so.la libloc_ds_api.la +libloc_api_v02_la_LIBADD = -lstdc++ -lqmi_cci -lqmi_common_so $(QMIF_LIBS) $(LOCPLA_LIBS) ../core/libloc_core.la ../utils/libgps_utils_so.la libloc_ds_api.la library_include_HEADERS = \ libloc_api_50001/LocEngAdapter.h \ @@ -119,7 +117,6 @@ library_include_HEADERS = \ libloc_api_50001/loc_eng_agps.h \ libloc_api_50001/loc_eng_msg.h \ libloc_api_50001/loc_eng_log.h \ - fake_property_service.h \ $(WORKSPACE)/qcom-opensource/location/loc_api/ds_api/ds_client.h \ $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/location_service_v02.h \ $(WORKSPACE)/qcom-opensource/location/loc_api/loc_api_v02/loc_api_v02_log.h \ diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp index 08474fc4..24708d43 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #ifdef USE_GLIB diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c index 1c482325..eb685fdf 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011, 2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,7 +32,6 @@ #include "loc_api_log.h" #include "loc_log.h" -#include "log_util.h" #include "platform_lib_includes.h" #include "rpc/rpc.h" #include "loc_api_fixup.h" diff --git a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c index e0f400cf..8c12426b 100644 --- a/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c +++ b/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -62,7 +62,6 @@ #endif /* USE_GLIB */ /* Logging Improvement */ -#include "log_util.h" #include "platform_lib_includes.h" /*Maximum number of Modem init*/ #define RPC_TRY_NUM 10 diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index d03dc660..ea04f077 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 7031605c..0a933af0 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -43,11 +43,7 @@ #include #include #include -#ifdef _ANDROID -#include -#else -#include "fake_property_service.h" -#endif +#include using namespace loc_core; @@ -174,7 +170,7 @@ extern "C" const GpsInterface* gps_get_hardware_interface () loc_eng_read_config(); // check to see if GPS should be disabled - property_get("gps.disable", propBuf, ""); + platform_lib_abstraction_property_get("gps.disable", propBuf, ""); if (propBuf[0] == '1') { LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n"); @@ -475,7 +471,7 @@ static int loc_inject_location(double latitude, double longitude, float accuracy { char value[PROPERTY_VALUE_MAX]; memset(value, 0, sizeof(value)); - (void)property_get("persist.gps.qc_nlp_in_use", value, "0"); + (void)platform_lib_abstraction_property_get("persist.gps.qc_nlp_in_use", value, "0"); if(0 == strcmp(value, "1")) { enable_cpi = false; @@ -596,7 +592,7 @@ const void* loc_get_extension(const char* name) else if (strcmp(name, AGPS_RIL_INTERFACE) == 0) { char baseband[PROPERTY_VALUE_MAX]; - property_get("ro.baseband", baseband, "msm"); + platform_lib_abstraction_property_get("ro.baseband", baseband, "msm"); if (strcmp(baseband, "csfb") == 0) { ret_val = &sLocEngAGpsRilInterface; diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index c3e82f85..4bc12b3b 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -46,21 +46,6 @@ #include #include #include - -#ifdef _ANDROID -#include -#include -#else -#include "fake_sched_policy.h" -#include "fake_property_service.h" -#endif - -#ifndef USE_GLIB -#include -#include -#endif /* USE_GLIB */ - - #if defined(USE_GLIB) && !defined(OFF_TARGET) #include #endif @@ -69,7 +54,6 @@ #endif /* USE_GLIB */ #include - #include #include #include @@ -78,8 +62,7 @@ #include #include #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include "loc_core_log.h" #include "loc_eng_log.h" diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 59351311..c1dc8af5 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -54,7 +54,6 @@ typedef unsigned char boolean; #include #include #include -#include #include #include diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp index d6cc1369..cf9fe82d 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.cpp +++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,7 +32,6 @@ #include #include -#include #include #include #include diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h index 81a4133e..d68970f3 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/loc_api/libloc_api_50001/loc_eng_agps.h @@ -40,7 +40,7 @@ #include #include #include - +#include #if defined(USE_GLIB) && !defined(OFF_TARGET) #include #endif /* USE_GLIB */ diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp index 918ae220..d24e0c9d 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -37,8 +37,7 @@ #include #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include "loc_eng_dmn_conn_glue_msg.h" #include "loc_eng_dmn_conn_handler.h" #include "loc_eng_dmn_conn.h" diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c index a1076ff9..e947fa1d 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,8 +31,7 @@ #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include "loc_eng_dmn_conn_glue_msg.h" #include "loc_eng_dmn_conn_handler.h" diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c index 5d9a449e..cbc4ea64 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -37,8 +37,7 @@ #include #include "loc_eng_dmn_conn_glue_pipe.h" -#include "log_util.h" -#include "platform_lib_includes.h" +#include /*=========================================================================== FUNCTION loc_eng_dmn_conn_glue_pipeget diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp index edd53f21..137f686b 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,8 +31,7 @@ #include #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include "loc_eng_msg.h" #include "loc_eng_dmn_conn.h" #include "loc_eng_dmn_conn_handler.h" diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c index 9fed9d42..b30f6d7a 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,8 +28,7 @@ */ #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include "loc_eng_dmn_conn_thread_helper.h" /*=========================================================================== diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index f4ba2dc5..9a8b0e4d 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,11 +34,11 @@ #include #include #include -#include #include #include #include #include +#include #ifndef SSID_BUF_SIZE #define SSID_BUF_SIZE (32+1) diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index 74abfd42..cc894481 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -43,8 +43,7 @@ #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include using namespace loc_core; diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 842eda1f..8e99d941 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,7 +36,7 @@ #include #include #include -#include "log_util.h" +#include /*=========================================================================== FUNCTION loc_eng_nmea_send diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/loc_api/libloc_api_50001/loc_eng_xtra.cpp index 45822867..1459c4c7 100644 --- a/loc_api/libloc_api_50001/loc_eng_xtra.cpp +++ b/loc_api/libloc_api_50001/loc_eng_xtra.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -32,8 +32,7 @@ #include #include -#include "log_util.h" -#include "platform_lib_includes.h" +#include using namespace loc_core; diff --git a/platform_lib_abstractions/loc_pla/Makefile.am b/platform_lib_abstractions/loc_pla/Makefile.am new file mode 100644 index 00000000..8996763e --- /dev/null +++ b/platform_lib_abstractions/loc_pla/Makefile.am @@ -0,0 +1,10 @@ +# Makefile.am for gps loc-pla +# + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = src + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = loc-pla.pc +EXTRA_DIST = $(pkgconfig_DATA) diff --git a/platform_lib_abstractions/loc_pla/configure.ac b/platform_lib_abstractions/loc_pla/configure.ac new file mode 100644 index 00000000..a8b892b5 --- /dev/null +++ b/platform_lib_abstractions/loc_pla/configure.ac @@ -0,0 +1,61 @@ +# configure.ac -- Autoconf script for gps loc-pla +# +# Process this file with autoconf to produce a configure script + +# Requires autoconf tool later than 2.61 +AC_PREREQ(2.61) +# Initialize the gps loc-pla package version 1.0.0 +AC_INIT([loc-pla],1.0.0) +# Does not strictly follow GNU Coding standards +AM_INIT_AUTOMAKE([foreign]) +# Disables auto rebuilding of configure, Makefile.ins +AM_MAINTAINER_MODE +# Verifies the --srcdir is correct by checking for the path +AC_CONFIG_SRCDIR([include/platform_lib_includes.h]) +# defines some macros variable to be included by source +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +# Checks for programs. +AC_PROG_LIBTOOL +AC_PROG_CXX +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_AWK +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +PKG_PROG_PKG_CONFIG + +# Checks for libraries. +PKG_CHECK_MODULES([LOCSTUB], [loc-stub]) +AC_SUBST([LOCSTUB_CFLAGS]) +AC_SUBST([LOCSTUB_LIBS]) + +AC_ARG_WITH([glib], + AC_HELP_STRING([--with-glib], + [enable glib, building HLOS systems which use glib])) + +if (test "x${with_glib}" = "xyes"); then + AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib]) + PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes, + AC_MSG_ERROR(GThread >= 2.16 is required)) + PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes, + AC_MSG_ERROR(GLib >= 2.16 is required)) + GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS" + GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS" + + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) +fi + +AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes") + +AC_CONFIG_FILES([ \ + Makefile \ + src/Makefile \ + loc-pla.pc \ + ]) + +AC_OUTPUT diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h b/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h new file mode 100644 index 00000000..9a954f08 --- /dev/null +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PLATFORM_LIB_ANDROID_RUNTIME_H__ +#define __PLATFORM_LIB_ANDROID_RUNTIME_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +pthread_t platform_lib_abstraction_createJavaThread(const char* name, void (*start)(void *), void* arg); +#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION platform_lib_abstraction_createJavaThread + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__PLATFORM_LIB_ANDROID_RUNTIME_H__ */ diff --git a/loc_api/fake_property_service.h b/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h similarity index 85% rename from loc_api/fake_property_service.h rename to platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h index 1c15a4ee..9956937c 100644 --- a/loc_api/fake_property_service.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -24,22 +24,18 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ -#ifndef _FAKE_PROPERTY_SERVICE_H_ -#define _FAKE_PROPERTY_SERVICE_H +#ifndef __PLATFORM_LIB_GETTID_H__ +#define __PLATFORM_LIB_GETTID_H__ + +#include #ifdef __cplusplus extern "C" { #endif - -#define PROPERTY_VALUE_MAX 92 -int property_get(const char *key, char *value, const char *default_value); - +pid_t platform_lib_abstraction_gettid(); #ifdef __cplusplus } -#endif - - -#endif +#endif /* __cplusplus */ +#endif /* __PLATFORM_LIB_GETTID_H__ */ diff --git a/platform_lib_abstractions/platform_lib_includes.h b/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h similarity index 81% rename from platform_lib_abstractions/platform_lib_includes.h rename to platform_lib_abstractions/loc_pla/include/platform_lib_includes.h index 5858674f..47c37df8 100644 --- a/platform_lib_abstractions/platform_lib_includes.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -26,10 +26,15 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _PLATFORM_LIB_INCLUDES_H_ -#define _PLATFORM_LIB_INCLUDES_H_ +#ifndef __PLATFORM_LIB_INCLUDES_H__ +#define __PLATFORM_LIB_INCLUDES_H__ -#include "platform_lib_time.h" +#include "platform_lib_android_runtime.h" +#include "platform_lib_gettid.h" +#include "platform_lib_log_util.h" #include "platform_lib_macros.h" +#include "platform_lib_property_service.h" +#include "platform_lib_sched_policy.h" +#include "platform_lib_time.h" -#endif +#endif /* __PLATFORM_LIB_INCLUDES_H__ */ diff --git a/utils/log_util.h b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h similarity index 93% rename from utils/log_util.h rename to platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h index 7fb0c780..f78303c9 100644 --- a/utils/log_util.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 The Linux Foundation. All rights reserved. +/* Copyright (c) 2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -24,26 +24,27 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ -#ifndef __LOG_UTIL_H__ -#define __LOG_UTIL_H__ +#ifndef __PLATFORM_LIB_LOG_UTIL_H__ +#define __PLATFORM_LIB_LOG_UTIL_H__ + +#include "platform_lib_macros.h" #ifndef USE_GLIB #include -#endif /* USE_GLIB */ - -#ifdef USE_GLIB +#else #include +#include +#include #include +#include #include #ifndef LOG_TAG #define LOG_TAG "GPS_UTILS" - -#endif // LOG_TAG +#endif /* LOG_TAG */ #endif /* USE_GLIB */ @@ -86,8 +87,8 @@ extern const char ENTRY_TAG[]; * MODULE EXPORTED FUNCTIONS * *============================================================================*/ -extern void loc_logger_init(unsigned long debug, unsigned long timestamp); -extern char* get_timestamp(char* str, unsigned long buf_size); +void loc_logger_init(unsigned long debug, unsigned long timestamp); +char* get_timestamp(char* str, unsigned long buf_size); #ifndef DEBUG_DMN_LOC_API @@ -168,4 +169,4 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); } } #endif -#endif // __LOG_UTIL_H__ +#endif /* __PLATFORM_LIB_LOG_UTIL_H__ */ diff --git a/platform_lib_abstractions/platform_lib_macros.h b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h similarity index 82% rename from platform_lib_abstractions/platform_lib_macros.h rename to platform_lib_abstractions/loc_pla/include/platform_lib_macros.h index a1db21a9..32035d28 100644 --- a/platform_lib_abstractions/platform_lib_macros.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,14 +29,21 @@ #ifndef __PLATFORM_LIB_MACROS_H__ #define __PLATFORM_LIB_MACROS_H__ -#include -#include -#include - #ifdef __cplusplus extern "C" { #endif +#ifdef USE_GLIB +#include +#ifndef OFF_TARGET +#include +#define strlcat g_strlcat +#define strlcpy g_strlcpy +#else +#define strlcat strncat +#define strlcpy strncpy +#endif + #define TS_PRINTF(format, x...) \ { \ struct timeval tv; \ @@ -49,38 +56,16 @@ extern "C" { fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \ } - -#ifdef USE_GLIB -#ifndef OFF_TARGET -#define strlcat g_strlcat -#define strlcpy g_strlcpy -#else -#define strlcat strncat -#define strlcpy strncpy -#endif #define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) #define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid)) - -#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread -#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot()) - -#else - -pid_t gettid(void); - -#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid()) -#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread -#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime()) - -#endif +#endif /* USE_GLIB */ #ifdef __cplusplus } #endif /*__cplusplus */ -#endif +#endif /* __PLATFORM_LIB_MACROS_H__ */ diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h b/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h new file mode 100644 index 00000000..006c94d5 --- /dev/null +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h @@ -0,0 +1,43 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PLATFORM_LIB_PROPERTY_SERVICE_H__ +#define __PLATFORM_LIB_PROPERTY_SERVICE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define PROPERTY_VALUE_MAX 92 +int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __PLATFORM_LIB_PROPERTY_SERVICE_H__ */ diff --git a/core/fake_sched_policy.h b/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h similarity index 72% rename from core/fake_sched_policy.h rename to platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h index 5b7c7de5..d10f1513 100644 --- a/core/fake_sched_policy.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -24,42 +24,23 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ -#ifndef _FAKE_SCHED_POLICY_H -#define _FAKE_SCHED_POLICY_H +#ifndef __PLATFORM_LIB_SCHED_POLICY_H__ +#define __PLATFORM_LIB_SCHED_POLICY_H__ #ifdef __cplusplus extern "C" { #endif - typedef enum { - SP_BACKGROUND = 0, - SP_FOREGROUND = 1, -} SchedPolicy; - -/*=========================================================================== -FUNCTION set_sched_policy - -DESCRIPTION - Local copy of this function which bypasses android set_sched_policy - -DEPENDENCIES - None - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -int set_sched_policy(int tid, SchedPolicy policy); + PLA_SP_BACKGROUND = 0, + PLA_SP_FOREGROUND = 1, +} PLASchedPolicy; +int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy); #ifdef __cplusplus } -#endif +#endif /* __cplusplus */ -#endif // _FAKE_SCHED_POLICY_H +#endif /* __PLATFORM_LIB_SCHED_POLICY_H__ */ diff --git a/platform_lib_abstractions/platform_lib_time.h b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h similarity index 83% rename from platform_lib_abstractions/platform_lib_time.h rename to platform_lib_abstractions/loc_pla/include/platform_lib_time.h index 8bdffa97..c05b15ce 100644 --- a/platform_lib_abstractions/platform_lib_time.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -26,20 +26,11 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _PLATFORM_LIB_TIME_H_ -#define _PLATFORM_LIB_TIME_H_ +#ifndef __PLATFORM_LIB_TIME_H__ +#define __PLATFORM_LIB_TIME_H__ -#include +#include -#ifdef __cplusplus -extern "C" { -#endif +int64_t platform_lib_abstraction_elapsed_millis_since_boot(); -int64_t systemTime(int clock); -int64_t elapsedMillisSinceBoot(); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif +#endif /* __PLATFORM_LIB_TIME_H__ */ diff --git a/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/platform_lib_abstractions/loc_pla/loc-pla.pc.in new file mode 100644 index 00000000..1aad2f47 --- /dev/null +++ b/platform_lib_abstractions/loc_pla/loc-pla.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: loc-pla +Description: QTI GPS Location Platform Library Abstractions +Version: @VERSION@ +Libs: -L${libdir} -lloc_pla +Cflags: -I${includedir}/loc-pla diff --git a/platform_lib_abstractions/loc_pla/src/Makefile.am b/platform_lib_abstractions/loc_pla/src/Makefile.am new file mode 100644 index 00000000..3936837d --- /dev/null +++ b/platform_lib_abstractions/loc_pla/src/Makefile.am @@ -0,0 +1,40 @@ +AM_CFLAGS = \ + $(LOCSTUB_CFLAGS) \ + -I../include \ + -fno-short-enums + +h_sources = \ + ../include/platform_lib_android_runtime.h \ + ../include/platform_lib_gettid.h \ + ../include/platform_lib_includes.h \ + ../include/platform_lib_log_util.h \ + ../include/platform_lib_macros.h \ + ../include/platform_lib_property_service.h \ + ../include/platform_lib_sched_policy.h \ + ../include/platform_lib_time.h + +library_includedir = $(pkgincludedir) +library_include_HEADERS = $(h_sources) + +libloc_pla_la_SOURCES = \ + platform_lib_android_runtime.cpp \ + platform_lib_gettid.cpp \ + platform_lib_log_util.cpp \ + platform_lib_property_service.cpp \ + platform_lib_sched_policy.cpp \ + platform_lib_time.cpp + +if USE_GLIB +libloc_pla_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_pla_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_pla_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_pla_la_CFLAGS = $(AM_CFLAGS) +libloc_pla_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_pla_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_pla_la_LIBADD = -lstdc++ -ldl -llog $(LOCSTUB_LIBS) + +#Create and Install libraries +lib_LTLIBRARIES = libloc_pla.la diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp new file mode 100644 index 00000000..447e02e3 --- /dev/null +++ b/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp @@ -0,0 +1,40 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "platform_lib_android_runtime.h" + +#ifdef USE_GLIB +#include +#else +#include +#endif /* USE_GLIB */ + +pthread_t platform_lib_abstraction_createJavaThread(const char* name, void (*start)(void *), void* arg) +{ + return android::AndroidRuntime::createJavaThread(name, start, arg); +} diff --git a/loc_api/fake_property_service.c b/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp similarity index 81% rename from loc_api/fake_property_service.c rename to platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp index 9d660fac..86863273 100644 --- a/loc_api/fake_property_service.c +++ b/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -24,22 +24,17 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ -#include +#include "platform_lib_gettid.h" + #ifdef USE_GLIB -#include -#endif +#include +#else +#include +#endif /* USE_GLIB */ -int property_get(const char *key, char * value, const char *default_value) +pid_t platform_lib_abstraction_gettid() { - /* This will disable gps interface - value[0] = '1'; - */ - if (strcmp(key, "ro.baseband") == 0) { - memcpy(value, "msm", 4); - } - return 0; + return gettid(); } - diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp new file mode 100644 index 00000000..37a5d4a7 --- /dev/null +++ b/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp @@ -0,0 +1,48 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "platform_lib_log_util.h" + +void loc_logger_init(unsigned long debug, unsigned long timestamp) +{ + loc_logger.DEBUG_LEVEL = debug; + loc_logger.TIMESTAMP = timestamp; +} + +char * get_timestamp(char *str, unsigned long buf_size) +{ + struct timeval tv; + struct timezone tz; + int hh, mm, ss; + gettimeofday(&tv, &tz); + hh = tv.tv_sec/3600%24; + mm = (tv.tv_sec%3600)/60; + ss = tv.tv_sec%60; + snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec); + return str; +} + diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp new file mode 100644 index 00000000..1cc63abb --- /dev/null +++ b/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp @@ -0,0 +1,39 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "platform_lib_property_service.h" + +#ifdef USE_GLIB +#include +#else +#include +#endif /* USE_GLIB */ + +int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value) +{ + return property_get(key, value, default_value); +} diff --git a/core/fake_sched_policy.c b/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp similarity index 75% rename from core/fake_sched_policy.c rename to platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp index ce99b938..ba6b3505 100644 --- a/core/fake_sched_policy.c +++ b/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -24,28 +24,18 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ -#include "fake_sched_policy.h" +#include "platform_lib_sched_policy.h" -/*=========================================================================== -FUNCTION set_sched_policy +#ifdef USE_GLIB +#include +#else +#include +#endif /* USE_GLIB */ -DESCRIPTION - Local copy of this function which bypasses android set_sched_policy - -DEPENDENCIES - None - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -int set_sched_policy(int tid, SchedPolicy policy) +int platform_lib_abstraction_set_sched_policy(int tid, PLASchedPolicy policy) { - return 0; + return set_sched_policy(tid, (SchedPolicy)policy); } + diff --git a/platform_lib_abstractions/platform_lib_time.cpp b/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp similarity index 81% rename from platform_lib_abstractions/platform_lib_time.cpp rename to platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp index 45bb8e6b..dc7dff11 100644 --- a/platform_lib_abstractions/platform_lib_time.cpp +++ b/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -25,24 +25,23 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include -#include #include "platform_lib_time.h" -int64_t systemTime(int clock) +#ifdef USE_GLIB +#include +#else +#include +#endif /* USE_GLIB */ + +int64_t platform_lib_abstraction_elapsed_millis_since_boot() { - struct timeval t; - t.tv_sec = t.tv_usec = 0; - gettimeofday(&t, NULL); - return t.tv_sec*1000000LL + t.tv_usec; +#ifdef USE_GLIB + + return elapsedMillisSinceBoot(); + +#else + + return android::elapsedRealtime(); + +#endif } - - -int64_t elapsedMillisSinceBoot() -{ - int64_t t_us = systemTime(0); - return (int64_t) t_us / 1000LL; -} - - diff --git a/utils/Makefile.am b/utils/Makefile.am index 0e7083eb..5e718439 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -6,19 +6,15 @@ AM_CFLAGS = -Wundef \ -fno-short-enums \ -fpic \ -I./ \ - -I../platform_lib_abstractions + $(LOCPLA_CFLAGS) libgps_utils_so_la_h_sources = \ - log_util.h \ msg_q.h \ linked_list.h \ loc_cfg.h \ loc_log.h \ loc_target.h \ - loc_timer.h \ - ../platform_lib_abstractions/platform_lib_includes.h \ - ../platform_lib_abstractions/platform_lib_time.h \ - ../platform_lib_abstractions/platform_lib_macros.h + loc_timer.h libgps_utils_so_la_c_sources = \ linked_list.c \ @@ -26,8 +22,7 @@ libgps_utils_so_la_c_sources = \ loc_cfg.cpp \ loc_log.cpp \ loc_timer.c \ - loc_target.cpp \ - ../platform_lib_abstractions/platform_lib_time.cpp + loc_target.cpp library_includedir = $(pkgincludedir)/utils @@ -45,7 +40,7 @@ libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) endif -libgps_utils_so_la_LIBADD = -lstdc++ -llog +libgps_utils_so_la_LIBADD = -lstdc++ -llog $(LOCPLA_LIBS) #Create and Install libraries lib_LTLIBRARIES = libgps_utils_so.la diff --git a/utils/linked_list.c b/utils/linked_list.c index 92617fee..1109acd3 100644 --- a/utils/linked_list.c +++ b/utils/linked_list.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,8 +31,7 @@ #include #define LOG_TAG "LocSvc_utils_ll" -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include #include diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 037ffaf8..8c76d1fe 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,7 +38,7 @@ #include #include #include -#include +#include #if defined(USE_GLIB) && !defined(OFF_TARGET) #include #endif diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp index 597b5b62..c64310eb 100644 --- a/utils/loc_log.cpp +++ b/utils/loc_log.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,11 +34,7 @@ #include #include "loc_log.h" #include "msg_q.h" -#ifdef USE_GLIB -#include -#endif /* USE_GLIB */ -#include "log_util.h" -#include "platform_lib_includes.h" +#include #define BUFFER_SIZE 120 @@ -180,55 +176,3 @@ char *loc_get_time(char *time_string, unsigned long buf_size) return time_string; } - - -/*=========================================================================== -FUNCTION loc_logger_init - -DESCRIPTION - Initializes the state of DEBUG_LEVEL and TIMESTAMP - -DEPENDENCIES - N/A - -RETURN VALUE - None - -SIDE EFFECTS - N/A -===========================================================================*/ -void loc_logger_init(unsigned long debug, unsigned long timestamp) -{ - loc_logger.DEBUG_LEVEL = debug; - loc_logger.TIMESTAMP = timestamp; -} - - -/*=========================================================================== -FUNCTION get_timestamp - -DESCRIPTION - Generates a timestamp using the current system time - -DEPENDENCIES - N/A - -RETURN VALUE - Char pointer to the parameter str - -SIDE EFFECTS - N/A -===========================================================================*/ -char * get_timestamp(char *str, unsigned long buf_size) -{ - struct timeval tv; - struct timezone tz; - int hh, mm, ss; - gettimeofday(&tv, &tz); - hh = tv.tv_sec/3600%24; - mm = (tv.tv_sec%3600)/60; - ss = tv.tv_sec%60; - snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec); - return str; -} - diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index 5eff1714..b5a62972 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -38,7 +38,6 @@ #include #include "loc_target.h" #include "loc_log.h" -#include "log_util.h" #include #define APQ8064_ID_1 "109" @@ -109,7 +108,7 @@ static bool is_qca1530(void) for (i = 0; i < QCA1530_DETECT_TIMEOUT; ++i) { - ret = property_get(qca1530_property_name, buf, NULL); + ret = platform_lib_abstraction_property_get(qca1530_property_name, buf, NULL); if (ret < 0) { LOC_LOGV( "qca1530: property %s is not accessible, ret=%d", @@ -165,7 +164,7 @@ unsigned int loc_get_target(void) goto detected; } - property_get("ro.baseband", baseband, ""); + platform_lib_abstraction_property_get("ro.baseband", baseband, ""); if (!access(hw_platform, F_OK)) { read_a_line(hw_platform, rd_hw_platform, LINE_LEN); } else { diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 0034d278..5ca15862 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include "log_util.h" +#include /* Return values: diff --git a/utils/msg_q.c b/utils/msg_q.c index f82d4c03..1555668c 100644 --- a/utils/msg_q.c +++ b/utils/msg_q.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,8 +29,7 @@ #include "msg_q.h" #define LOG_TAG "LocSvc_utils_q" -#include "log_util.h" -#include "platform_lib_includes.h" +#include #include "linked_list.h" #include #include From c3643ebf64a443a97c5c8d793bdd704038e8d8d6 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Thu, 5 Nov 2015 09:59:54 -0800 Subject: [PATCH 27/41] remove link depedency to dsi_netctrl temporarily the link dependency is necessary for ds_api to work, but it would bring in libqcci_legacy indirectly, which would cause crash at runtime when calling into the qmi client implementation fromlibqcci_legacy, while the right impl is from qmi-frameworks. Change-Id: If986fe059199dd752526dbe837fcf03b4b4d8002 --- loc_api/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am index c5bffed2..d42d4d99 100644 --- a/loc_api/Makefile.am +++ b/loc_api/Makefile.am @@ -81,7 +81,7 @@ libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS) endif -libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la +libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la libloc_api_v02_CFLAGS = \ $(QMIF_CFLAGS) \ From 30c54b87d961e45e625b64c38e56800a637ac076 Mon Sep 17 00:00:00 2001 From: Ruifeng Xu Date: Mon, 9 Nov 2015 16:15:07 -0800 Subject: [PATCH 28/41] Xtra client always reports carrier as 'unknown' The problem was caused by populating the carrier upon phone bootup when the the property maybe not initialized yet. This module is updated to remove the populating code of carrier in phone bootup. Change-Id: I9c3f970aa0f0ca0805fdc2e04aa809329b6a2676 CRs-fixed: 935146 --- loc_api/libloc_api_50001/LocEngAdapter.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 35447d48..3e5a6b55 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -101,7 +101,6 @@ void LocEngAdapter::setXtraUserAgent() { char release[PROPERTY_VALUE_MAX]; char manufacture[PROPERTY_VALUE_MAX]; char model[PROPERTY_VALUE_MAX]; - char carrier[PROPERTY_VALUE_MAX]; char board[PROPERTY_VALUE_MAX]; char brand[PROPERTY_VALUE_MAX]; char chipsetsn[CHIPSET_SERIAL_NUMBER_MAX_LEN]; @@ -111,13 +110,12 @@ void LocEngAdapter::setXtraUserAgent() { property_get("ro.build.version.release", release, defVal); property_get("ro.product.manufacturer", manufacture, defVal); property_get("ro.product.model", model, defVal); - property_get("ro.carrier", carrier, defVal); property_get("ro.product.board", board, defVal); property_get("ro.product.brand", brand, defVal); getChipsetSerialNo(chipsetsn, sizeof(chipsetsn), defVal); - snprintf(userAgent, sizeof(userAgent), "A/%s/%s/%s/%s/%s/QCX3/s%u/-/%s/-/%s/-/-/-", - release, manufacture, model, board, carrier, + snprintf(userAgent, sizeof(userAgent), "A/%s/%s/%s/%s/-/QCX3/s%u/-/%s/-/%s/-/-/-", + release, manufacture, model, board, mContext->getIzatDevId(), chipsetsn, brand); for (int i = 0; i < sizeof(userAgent) && userAgent[i]; i++) { From c53037dc6aec4ed5a55facda08f1b5321e67ca65 Mon Sep 17 00:00:00 2001 From: Ruifeng Xu Date: Fri, 28 Aug 2015 16:54:16 -0700 Subject: [PATCH 29/41] encode field separator characters Replace all separator characters ('/','+','|','%') in the raw string by their corresponding encodings (%2F","%2B","%7C", "%25") Change-Id: I3c895adc2ce1cef36032a25e3c6fd63e70350607 CRs-fixed: 881265 --- loc_api/libloc_api_50001/LocEngAdapter.cpp | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 3e5a6b55..592662df 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -114,6 +114,12 @@ void LocEngAdapter::setXtraUserAgent() { property_get("ro.product.brand", brand, defVal); getChipsetSerialNo(chipsetsn, sizeof(chipsetsn), defVal); + encodeInPlace(release, PROPERTY_VALUE_MAX); + encodeInPlace(manufacture, PROPERTY_VALUE_MAX); + encodeInPlace(model, PROPERTY_VALUE_MAX); + encodeInPlace(board, PROPERTY_VALUE_MAX); + encodeInPlace(brand, PROPERTY_VALUE_MAX); + snprintf(userAgent, sizeof(userAgent), "A/%s/%s/%s/%s/-/QCX3/s%u/-/%s/-/%s/-/-/-", release, manufacture, model, board, mContext->getIzatDevId(), chipsetsn, brand); @@ -197,6 +203,56 @@ void LocEngAdapter::setXtraUserAgent() { return; } + /** + * encode the given string value such that all separator characters ('/','+','|','%') + * in the string are repaced by their corresponding encodings (%2F","%2B","%7C", "%25") + */ + static void encodeInPlace(char value[], const int size) { + char buffer[size]; + + struct ENCODE { + const char ch; + const char *code; + }; + + const ENCODE encodings[] = { {'/', "%2F"}, {'+', "%2B"}, {'|', "%7C",}, {'%', "%25"} }; + const int nencodings = (int)sizeof(encodings) / sizeof(encodings[0]); + + int inpos = 0, outpos = 0; + while(value[inpos] != '\0' && outpos < size - 1) { + // check if escaped character + int escchar = 0; + while(escchar < nencodings && encodings[escchar].ch != value[inpos]) { + escchar++; + } + + if (escchar == nencodings) { + // non escaped character + buffer[outpos++] = value[inpos++]; + continue; + } + + // escaped character + int codepos = 0; + #define NUM_CHARS_IN_CODE 3 + + if (outpos + NUM_CHARS_IN_CODE >= size) { + // skip last character if there is insufficient space + break; + } + + while(outpos < size - 1 && codepos < NUM_CHARS_IN_CODE) { + buffer[outpos++] = encodings[escchar].code[codepos++]; + } + inpos++; + } + + // copy to ouput + value[outpos] = '\0'; + while(--outpos >= 0) { + value[outpos] = buffer[outpos]; + } + } }; sendMsg(new LocSetXtraUserAgent(mContext)); From 34c44606e99047e8b12c1d40685e123ecd9cde18 Mon Sep 17 00:00:00 2001 From: Jiafei Wen Date: Wed, 25 Nov 2015 19:10:06 -0800 Subject: [PATCH 30/41] Add the support for geofence dwell This change adds the support for geofence dwell mask. Change-Id: I4cbde8d3c49ef4ac287d34a88ea25787b507cdbe CRs-Fixed: 940557 --- core/gps_extended_c.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index 27deb442..fefbcfe0 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -378,6 +378,7 @@ enum loc_api_adapter_event_index { 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 }; @@ -407,6 +408,7 @@ enum loc_api_adapter_event_index { #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1< Date: Thu, 18 Sep 2014 17:18:36 -0700 Subject: [PATCH 31/41] Remove reduntant clearing of GpsLocation memory GpsLocation memory will now be cleared inside the Loc Api handler itself, so no need to do it a second time before calling into the Loc Api handler. Change-Id: Iec37624621d6eb4806eb8e13c807bb4e40584e39 CRs-fixed: 726800 --- loc_api/libloc_api_50001/loc_eng.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 4bc12b3b..19c54a0f 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1972,7 +1972,6 @@ static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data) GpsLocationExtended locationExtended; memset(&locationExtended, 0, sizeof (GpsLocationExtended)); locationExtended.size = sizeof(locationExtended); - memset(&location, 0, sizeof location); ret_val = loc_eng_data.adapter->getZpp(location.gpsLocation, tech_mask); //Mark the location source as from ZPP From a4e5f9c15087b61591b56894da1817db22572563 Mon Sep 17 00:00:00 2001 From: Tushar Janefalkar Date: Wed, 14 Nov 2012 11:32:40 -0800 Subject: [PATCH 32/41] Add buffer length check for XTRA data To prevent reading beyond the length of the buffer that contains XTRA data, a check has been introduced assuming an approximate limit for the size of the data Change-Id: I7e05beadec76c3308448b9198fd23c8e8b97394d CRs-fixed: 420623 --- loc_api/libloc_api_50001/loc.cpp | 8 ++++++-- loc_api/libloc_api_50001/loc.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 0a933af0..83249f40 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -801,8 +801,12 @@ SIDE EFFECTS static int loc_xtra_inject_data(char* data, int length) { ENTRY_LOG(); - int ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length); - + int ret_val = -1; + if( (data != NULL) && ((unsigned int)length <= XTRA_DATA_MAX_SIZE)) + ret_val = loc_eng_xtra_inject_data(loc_afw_data, data, length); + else + LOC_LOGE("%s, Could not inject XTRA data. Buffer address: %p, length: %d", + __func__, data, length); EXIT_LOG(%d, ret_val); return ret_val; } diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h index 55456193..8f41659a 100644 --- a/loc_api/libloc_api_50001/loc.h +++ b/loc_api/libloc_api_50001/loc.h @@ -38,6 +38,8 @@ extern "C" { #include #include +#define XTRA_DATA_MAX_SIZE 100000 /*bytes*/ + typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt); typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt); typedef void* (*loc_ext_parser)(void* data); From 46f999155d24dbb1ed860b5509d794c123163846 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Mon, 4 Jan 2016 16:17:34 -0800 Subject: [PATCH 33/41] Reduce TBF limit in GPS HAL Currently Location HAL forces TBF of 1 second or larger even though ALM permits lower values. GPS HAL shall have smaller limits as Modem code actually controls minimum TBF value Change-Id: I4a2bbd51da34e441f148275ec3c2c4fa9ece7599 CRs-Fixed: 951152 --- core/gps_extended.h | 14 ++++++++++---- core/gps_extended_c.h | 34 ++++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/core/gps_extended.h b/core/gps_extended.h index 9eec3f92..b6d7a41b 100644 --- a/core/gps_extended.h +++ b/core/gps_extended.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* 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 @@ -29,11 +29,16 @@ #ifndef GPS_EXTENDED_H #define GPS_EXTENDED_H +#include +/** + * @file + * @brief C++ declarations for GPS types + */ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include #if defined(USE_GLIB) || defined(OFF_TARGET) #include #endif @@ -51,7 +56,8 @@ struct LocPosMode uint32_t gap, uint32_t accu, uint32_t time, const char* cred, const char* prov) : mode(m), recurrence(recr), - min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap), + min_interval(gap < GPS_MIN_POSSIBLE_FIX_INTERVAL_MS ? + GPS_MIN_POSSIBLE_FIX_INTERVAL_MS : gap), preferred_accuracy(accu), preferred_time(time) { memset(credentials, 0, sizeof(credentials)); memset(provider, 0, sizeof(provider)); @@ -66,7 +72,7 @@ struct LocPosMode inline LocPosMode() : mode(LOC_POSITION_MODE_MS_BASED), recurrence(GPS_POSITION_RECURRENCE_PERIODIC), - min_interval(MIN_POSSIBLE_FIX_INTERVAL), + min_interval(GPS_DEFAULT_FIX_INTERVAL_MS), preferred_accuracy(50), preferred_time(120000) { memset(credentials, 0, sizeof(credentials)); memset(provider, 0, sizeof(provider)); diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index 55c158e3..f8e540fb 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* 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 @@ -29,14 +29,19 @@ #ifndef GPS_EXTENDED_C_H #define GPS_EXTENDED_C_H -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include +/** + * @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 */ @@ -177,7 +182,24 @@ typedef enum loc_position_mode_type { } LocPositionMode; -#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */ +/** + * @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 /** GpsLocationExtended has valid latitude and longitude. */ #define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0) From db367819e26af1a6b8cb013e0dcda575d242c732 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 29 Dec 2015 22:35:36 -0800 Subject: [PATCH 34/41] Sub milli sec part in the relevant NMEA Strings NMEA Strings should introduce the sub milli sec part in the relevant NMEA Strings for NHZ Sessions Change-Id: I9bac4caa26e87741e5e82e16a8047af20ac8012b CRs-Fixed: 951144 --- loc_api/libloc_api_50001/loc_eng_nmea.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 8e99d941..6c9356e4 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -124,7 +124,6 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, char* pMarker = sentence; int lengthRemaining = sizeof(sentence); int length = 0; - time_t utcTime(location.gpsLocation.timestamp/1000); tm * pTm = gmtime(&utcTime); int utcYear = pTm->tm_year % 100; // 2 digit year @@ -133,6 +132,7 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, int utcHours = pTm->tm_hour; int utcMinutes = pTm->tm_min; int utcSeconds = pTm->tm_sec; + int utcMSeconds = (location.gpsLocation.timestamp)%1000; if (generate_nmea) { // ------------------ @@ -278,8 +278,8 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, pMarker = sentence; lengthRemaining = sizeof(sentence); - length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," , - utcHours, utcMinutes, utcSeconds); + length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d.%02d,A," , + utcHours, utcMinutes, utcSeconds,utcMSeconds/10); if (length < 0 || length >= lengthRemaining) { @@ -431,8 +431,8 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, pMarker = sentence; lengthRemaining = sizeof(sentence); - length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," , - utcHours, utcMinutes, utcSeconds); + length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d.%02d," , + utcHours, utcMinutes, utcSeconds, utcMSeconds/10); if (length < 0 || length >= lengthRemaining) { From 89f41a9b1602ce82ea6272f2a3be8595fb4b6058 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 29 Dec 2015 22:35:36 -0800 Subject: [PATCH 35/41] Sub milli sec part in the relevant NMEA Strings NMEA Strings should introduce the sub milli sec part in the relevant NMEA Strings for NHZ Sessions Change-Id: I9bac4caa26e87741e5e82e16a8047af20ac8012b CRs-Fixed: 951144 --- loc_api/libloc_api_50001/loc_eng_nmea.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 126a97f0..2868c0e8 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -136,6 +136,7 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, int utcHours = pTm->tm_hour; int utcMinutes = pTm->tm_min; int utcSeconds = pTm->tm_sec; + int utcMSeconds = (location.gpsLocation.timestamp)%1000; if (generate_nmea) { // ------------------ @@ -281,8 +282,8 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, pMarker = sentence; lengthRemaining = sizeof(sentence); - length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d,A," , - utcHours, utcMinutes, utcSeconds); + length = snprintf(pMarker, lengthRemaining, "$GPRMC,%02d%02d%02d.%02d,A," , + utcHours, utcMinutes, utcSeconds,utcMSeconds/10); if (length < 0 || length >= lengthRemaining) { @@ -434,8 +435,8 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, pMarker = sentence; lengthRemaining = sizeof(sentence); - length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d," , - utcHours, utcMinutes, utcSeconds); + length = snprintf(pMarker, lengthRemaining, "$GPGGA,%02d%02d%02d.%02d," , + utcHours, utcMinutes, utcSeconds, utcMSeconds/10); if (length < 0 || length >= lengthRemaining) { From ecb67363ee73c0374424795ae6014a794065f5ab Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Thu, 4 Feb 2016 10:06:28 -0800 Subject: [PATCH 36/41] Fix compilation issues for m_master merge into oe_master Fixed compilation issues for M upgrade Change-Id: I602aa7c8a2db9682a1fe94b7ca892027281deec7 --- core/LocAdapterBase.cpp | 2 +- core/LocApiBase.cpp | 2 +- core/LocDualContext.cpp | 5 ++ core/Makefile.am | 7 +- core/UlpProxyBase.h | 1 - loc_api/Makefile.am | 4 +- loc_api/libloc_api_50001/LocEngAdapter.cpp | 3 +- loc_api/libloc_api_50001/Makefile.am | 78 +++++++++++++++++++ loc_api/libloc_api_50001/loc_eng.cpp | 7 +- loc_api/libloc_api_50001/loc_eng_ni.cpp | 2 - .../loc_pla/include/platform_lib_macros.h | 2 + .../loc_pla/include/platform_lib_time.h | 4 +- .../loc_pla/src/Makefile.am | 1 + .../loc_stub/src/Makefile.am | 1 + utils/LocTimer.h | 2 +- utils/Makefile.am | 15 +++- utils/MsgTask.cpp | 3 +- utils/loc_cfg.cpp | 2 +- utils/loc_misc_utils.cpp | 2 +- utils/loc_timer.h | 2 +- 20 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 loc_api/libloc_api_50001/Makefile.am diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 8fdb8cbb..e9bec95c 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index dcd35fec..45d16e90 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index b5f33ac3..74b2903a 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include namespace loc_core { @@ -58,7 +59,11 @@ 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; diff --git a/core/Makefile.am b/core/Makefile.am index e2d05be4..341153ad 100644 --- a/core/Makefile.am +++ b/core/Makefile.am @@ -1,10 +1,11 @@ AM_CFLAGS = -I./ \ -I../utils \ $(LOCPLA_CFLAGS) \ + -I$(WORKSPACE)/gps-noship/flp \ + -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums libloc_core_la_h_sources = \ - MsgTask.h \ LocApiBase.h \ LocAdapterBase.h \ ContextBase.h \ @@ -13,10 +14,10 @@ libloc_core_la_h_sources = \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ - loc_core_log.h + loc_core_log.h \ + LocAdapterProxyBase.h libloc_core_la_c_sources = \ - MsgTask.cpp \ LocApiBase.cpp \ LocAdapterBase.cpp \ ContextBase.cpp \ diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 59e265e8..2bafb0ab 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -31,7 +31,6 @@ #include #include "fused_location_extended.h" - namespace loc_core { class LocAdapterBase; diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am index d42d4d99..a5f529bd 100644 --- a/loc_api/Makefile.am +++ b/loc_api/Makefile.am @@ -5,6 +5,7 @@ AM_CFLAGS = \ -I../utils \ $(LOCPLA_CFLAGS) \ -fno-short-enums \ + -D__func__=__PRETTY_FUNCTION__ \ -DTARGET_USES_QCOM_BSP libloc_eng_so_la_h_sources = \ @@ -81,7 +82,8 @@ libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS) endif -libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la +libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la +#libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la libloc_api_v02_CFLAGS = \ $(QMIF_CFLAGS) \ diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 1d1a59ed..f3290dbd 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -339,9 +339,10 @@ void LocEngAdapter::requestPowerVote() LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp); setGpsLock(powerUp ? 103 : 101); } - +#ifndef USE_GLIB delete mUlp; mUlp = ulp; +#endif } void LocInternalAdapter::reportPosition(UlpLocation &location, diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am new file mode 100644 index 00000000..c7624272 --- /dev/null +++ b/loc_api/libloc_api_50001/Makefile.am @@ -0,0 +1,78 @@ +AM_CFLAGS = \ + -I../../utils \ + -I../../platform_lib_abstractions \ + -I$(WORKSPACE)/gps-noship/flp \ + -fno-short-enums \ + -D__func__=__PRETTY_FUNCTION__ \ + -DFEATURE_GNSS_BIT_API + +libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp + +if USE_GLIB +libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) +libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif +libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la + + +libloc_eng_so_la_SOURCES = \ + loc_eng.cpp \ + loc_eng_agps.cpp \ + loc_eng_xtra.cpp \ + loc_eng_ni.cpp \ + loc_eng_log.cpp \ + loc_eng_dmn_conn.cpp \ + loc_eng_dmn_conn_handler.cpp \ + loc_eng_dmn_conn_thread_helper.c \ + loc_eng_dmn_conn_glue_msg.c \ + loc_eng_dmn_conn_glue_pipe.c + + +if USE_GLIB +libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) +libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la + + +libgps_default_so_la_SOURCES = \ + loc.cpp \ + gps.c + +if USE_GLIB +libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libgps_default_so_la_CFLAGS = $(AM_CFLAGS) +libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la + +library_include_HEADERS = \ + LocEngAdapter.h \ + loc.h \ + loc_eng.h \ + loc_eng_xtra.h \ + loc_eng_ni.h \ + loc_eng_agps.h \ + loc_eng_msg.h \ + loc_eng_log.h + +library_includedir = $(pkgincludedir)/libloc_api_50001 + +#Create and Install libraries +lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index de72aa8d..6aac28ba 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -46,12 +46,7 @@ #include #include #include -#if defined(USE_GLIB) && !defined(OFF_TARGET) -#include -#endif -#ifdef USE_GLIB -#include -#endif /* USE_GLIB */ + #include #include diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index 3b20bbbc..a29784fc 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -235,8 +235,6 @@ static void* ni_thread_proc(void *args) LOC_LOGD("pSession->resp is %d\n",pSession->resp); - LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); - // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h index 32035d28..c712122e 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h @@ -35,6 +35,8 @@ extern "C" { #ifdef USE_GLIB #include +#include +#include #ifndef OFF_TARGET #include #define strlcat g_strlcat diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h index c05b15ce..7033a7a1 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h @@ -30,7 +30,9 @@ #define __PLATFORM_LIB_TIME_H__ #include - +#ifndef USE_GLIB +#include +#endif int64_t platform_lib_abstraction_elapsed_millis_since_boot(); #endif /* __PLATFORM_LIB_TIME_H__ */ diff --git a/platform_lib_abstractions/loc_pla/src/Makefile.am b/platform_lib_abstractions/loc_pla/src/Makefile.am index 3936837d..6ee0be70 100644 --- a/platform_lib_abstractions/loc_pla/src/Makefile.am +++ b/platform_lib_abstractions/loc_pla/src/Makefile.am @@ -1,6 +1,7 @@ AM_CFLAGS = \ $(LOCSTUB_CFLAGS) \ -I../include \ + -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums h_sources = \ diff --git a/platform_lib_abstractions/loc_stub/src/Makefile.am b/platform_lib_abstractions/loc_stub/src/Makefile.am index c8ab5fcb..8bda7113 100644 --- a/platform_lib_abstractions/loc_stub/src/Makefile.am +++ b/platform_lib_abstractions/loc_stub/src/Makefile.am @@ -1,5 +1,6 @@ AM_CFLAGS = \ -I../include \ + -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums libloc_stub_la_extra_h = \ diff --git a/utils/LocTimer.h b/utils/LocTimer.h index c1468524..c6a63620 100644 --- a/utils/LocTimer.h +++ b/utils/LocTimer.h @@ -31,7 +31,7 @@ #define __LOC_TIMER_CPP_H__ #include -#include +#include // opaque class to provide service implementation. class LocTimerDelegate; diff --git a/utils/Makefile.am b/utils/Makefile.am index 5e718439..50f10078 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -14,15 +14,24 @@ libgps_utils_so_la_h_sources = \ loc_cfg.h \ loc_log.h \ loc_target.h \ - loc_timer.h + loc_timer.h \ + MsgTask.h \ + LocHeap.h \ + LocThread.h \ + LocTimer.h \ + loc_misc_utils.h libgps_utils_so_la_c_sources = \ linked_list.c \ msg_q.c \ loc_cfg.cpp \ loc_log.cpp \ - loc_timer.c \ - loc_target.cpp + loc_target.cpp \ + LocHeap.cpp \ + LocTimer.cpp \ + LocThread.cpp \ + MsgTask.cpp \ + loc_misc_utils.cpp library_includedir = $(pkgincludedir)/utils diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp index f33d6024..78a3fe00 100644 --- a/utils/MsgTask.cpp +++ b/utils/MsgTask.cpp @@ -33,6 +33,7 @@ #include #include #include +#include static void LocMsgDestroy(void* msg) { delete (LocMsg*)msg; @@ -77,7 +78,7 @@ void MsgTask::sendMsg(const LocMsg* msg) const { void MsgTask::prerun() { // make sure we do not run in background scheduling group - set_sched_policy(gettid(), SP_FOREGROUND); + platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); } bool MsgTask::run() { diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 967d2f30..926781a6 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #ifdef USE_GLIB #include diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp index 7e96313f..dfe19a2d 100644 --- a/utils/loc_misc_utils.cpp +++ b/utils/loc_misc_utils.cpp @@ -28,7 +28,7 @@ */ #include #include -#include +#include #include #include diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 2967858e..25fd1790 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ #include - +#include /* user_data: client context pointer, passthrough. Originally received from calling client when loc_timer_start() is called. From a05f77fa0bc52e4af440f8fe3a4b043209396680 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Thu, 11 Feb 2016 14:50:58 -0800 Subject: [PATCH 37/41] make LocSharedLock::mRef ops atomic The current share() and drop() calls are not thread safe, which can cause memory heap correuption. This changes the read / write ops to be atomic. Change-Id: Ic241d4573bdf2e58c4e264e97bd41b56f882c791 CRs-Fixed: 975372 --- utils/LocSharedLock.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/LocSharedLock.h b/utils/LocSharedLock.h index 6b9e27f1..7fe62376 100644 --- a/utils/LocSharedLock.h +++ b/utils/LocSharedLock.h @@ -30,6 +30,7 @@ #define __LOC_SHARED_LOCK__ #include +#include #include // This is a utility created for use cases such that there are more than @@ -39,16 +40,16 @@ // this share lock's share() method has to be called, so that the obj // can maintain an accurate client count. class LocSharedLock { - uint32_t mRef; + volatile int32_t mRef; pthread_mutex_t mMutex; inline ~LocSharedLock() { pthread_mutex_destroy(&mMutex); } public: // first client to create this LockSharedLock inline LocSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); } // following client(s) are to *share()* this lock created by the first client - inline LocSharedLock* share() { mRef++; return this; } + inline LocSharedLock* share() { android_atomic_inc(&mRef); return this; } // whe a client no longer needs this shared lock, drop() shall be called. - inline void drop() { if (0 == --mRef) delete this; } + inline void drop() { if (1 == android_atomic_dec(&mRef)) delete this; } // locking the lock to enter critical section inline void lock() { pthread_mutex_lock(&mMutex); } // unlocking the lock to leave the critical section From fa7a874eb0586c7844fe3a4cb8d0063ce53464f0 Mon Sep 17 00:00:00 2001 From: Deven Patel Date: Wed, 2 Mar 2016 12:49:02 -0800 Subject: [PATCH 38/41] Revert "Fix compilation issues for m_master merge into oe_master". This reverts commit ecb67363ee73c0374424795ae6014a794065f5ab Change-Id: I7b540247b246ea4caf710247d2c58b55515dae7c --- core/LocAdapterBase.cpp | 2 +- core/LocApiBase.cpp | 2 +- core/LocDualContext.cpp | 5 -- core/Makefile.am | 7 +- core/UlpProxyBase.h | 1 + loc_api/Makefile.am | 4 +- loc_api/libloc_api_50001/LocEngAdapter.cpp | 3 +- loc_api/libloc_api_50001/Makefile.am | 78 ------------------- loc_api/libloc_api_50001/loc_eng.cpp | 7 +- loc_api/libloc_api_50001/loc_eng_ni.cpp | 2 + .../loc_pla/include/platform_lib_macros.h | 2 - .../loc_pla/include/platform_lib_time.h | 4 +- .../loc_pla/src/Makefile.am | 1 - .../loc_stub/src/Makefile.am | 1 - utils/LocTimer.h | 2 +- utils/Makefile.am | 15 +--- utils/MsgTask.cpp | 3 +- utils/loc_cfg.cpp | 2 +- utils/loc_misc_utils.cpp | 2 +- utils/loc_timer.h | 2 +- 20 files changed, 25 insertions(+), 120 deletions(-) delete mode 100644 loc_api/libloc_api_50001/Makefile.am diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index e9bec95c..8fdb8cbb 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 45d16e90..dcd35fec 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index 74b2903a..b5f33ac3 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include namespace loc_core { @@ -59,11 +58,7 @@ 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; diff --git a/core/Makefile.am b/core/Makefile.am index 341153ad..e2d05be4 100644 --- a/core/Makefile.am +++ b/core/Makefile.am @@ -1,11 +1,10 @@ AM_CFLAGS = -I./ \ -I../utils \ $(LOCPLA_CFLAGS) \ - -I$(WORKSPACE)/gps-noship/flp \ - -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums libloc_core_la_h_sources = \ + MsgTask.h \ LocApiBase.h \ LocAdapterBase.h \ ContextBase.h \ @@ -14,10 +13,10 @@ libloc_core_la_h_sources = \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ - loc_core_log.h \ - LocAdapterProxyBase.h + loc_core_log.h libloc_core_la_c_sources = \ + MsgTask.cpp \ LocApiBase.cpp \ LocAdapterBase.cpp \ ContextBase.cpp \ diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 2bafb0ab..59e265e8 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -31,6 +31,7 @@ #include #include "fused_location_extended.h" + namespace loc_core { class LocAdapterBase; diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am index a5f529bd..d42d4d99 100644 --- a/loc_api/Makefile.am +++ b/loc_api/Makefile.am @@ -5,7 +5,6 @@ AM_CFLAGS = \ -I../utils \ $(LOCPLA_CFLAGS) \ -fno-short-enums \ - -D__func__=__PRETTY_FUNCTION__ \ -DTARGET_USES_QCOM_BSP libloc_eng_so_la_h_sources = \ @@ -82,8 +81,7 @@ libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS) endif -libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la -#libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la +libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la libloc_api_v02_CFLAGS = \ $(QMIF_CFLAGS) \ diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index f3290dbd..1d1a59ed 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -339,10 +339,9 @@ void LocEngAdapter::requestPowerVote() LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp); setGpsLock(powerUp ? 103 : 101); } -#ifndef USE_GLIB + delete mUlp; mUlp = ulp; -#endif } void LocInternalAdapter::reportPosition(UlpLocation &location, diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am deleted file mode 100644 index c7624272..00000000 --- a/loc_api/libloc_api_50001/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -AM_CFLAGS = \ - -I../../utils \ - -I../../platform_lib_abstractions \ - -I$(WORKSPACE)/gps-noship/flp \ - -fno-short-enums \ - -D__func__=__PRETTY_FUNCTION__ \ - -DFEATURE_GNSS_BIT_API - -libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp - -if USE_GLIB -libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) -libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif -libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la - - -libloc_eng_so_la_SOURCES = \ - loc_eng.cpp \ - loc_eng_agps.cpp \ - loc_eng_xtra.cpp \ - loc_eng_ni.cpp \ - loc_eng_log.cpp \ - loc_eng_dmn_conn.cpp \ - loc_eng_dmn_conn_handler.cpp \ - loc_eng_dmn_conn_thread_helper.c \ - loc_eng_dmn_conn_glue_msg.c \ - loc_eng_dmn_conn_glue_pipe.c - - -if USE_GLIB -libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) -libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la - - -libgps_default_so_la_SOURCES = \ - loc.cpp \ - gps.c - -if USE_GLIB -libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libgps_default_so_la_CFLAGS = $(AM_CFLAGS) -libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la - -library_include_HEADERS = \ - LocEngAdapter.h \ - loc.h \ - loc_eng.h \ - loc_eng_xtra.h \ - loc_eng_ni.h \ - loc_eng_agps.h \ - loc_eng_msg.h \ - loc_eng_log.h - -library_includedir = $(pkgincludedir)/libloc_api_50001 - -#Create and Install libraries -lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 6aac28ba..de72aa8d 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -46,7 +46,12 @@ #include #include #include - +#if defined(USE_GLIB) && !defined(OFF_TARGET) +#include +#endif +#ifdef USE_GLIB +#include +#endif /* USE_GLIB */ #include #include diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index a29784fc..3b20bbbc 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -235,6 +235,8 @@ static void* ni_thread_proc(void *args) LOC_LOGD("pSession->resp is %d\n",pSession->resp); + LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); + // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h index c712122e..32035d28 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h @@ -35,8 +35,6 @@ extern "C" { #ifdef USE_GLIB #include -#include -#include #ifndef OFF_TARGET #include #define strlcat g_strlcat diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h index 7033a7a1..c05b15ce 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h @@ -30,9 +30,7 @@ #define __PLATFORM_LIB_TIME_H__ #include -#ifndef USE_GLIB -#include -#endif + int64_t platform_lib_abstraction_elapsed_millis_since_boot(); #endif /* __PLATFORM_LIB_TIME_H__ */ diff --git a/platform_lib_abstractions/loc_pla/src/Makefile.am b/platform_lib_abstractions/loc_pla/src/Makefile.am index 6ee0be70..3936837d 100644 --- a/platform_lib_abstractions/loc_pla/src/Makefile.am +++ b/platform_lib_abstractions/loc_pla/src/Makefile.am @@ -1,7 +1,6 @@ AM_CFLAGS = \ $(LOCSTUB_CFLAGS) \ -I../include \ - -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums h_sources = \ diff --git a/platform_lib_abstractions/loc_stub/src/Makefile.am b/platform_lib_abstractions/loc_stub/src/Makefile.am index 8bda7113..c8ab5fcb 100644 --- a/platform_lib_abstractions/loc_stub/src/Makefile.am +++ b/platform_lib_abstractions/loc_stub/src/Makefile.am @@ -1,6 +1,5 @@ AM_CFLAGS = \ -I../include \ - -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums libloc_stub_la_extra_h = \ diff --git a/utils/LocTimer.h b/utils/LocTimer.h index c6a63620..c1468524 100644 --- a/utils/LocTimer.h +++ b/utils/LocTimer.h @@ -31,7 +31,7 @@ #define __LOC_TIMER_CPP_H__ #include -#include +#include // opaque class to provide service implementation. class LocTimerDelegate; diff --git a/utils/Makefile.am b/utils/Makefile.am index 50f10078..5e718439 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -14,24 +14,15 @@ libgps_utils_so_la_h_sources = \ loc_cfg.h \ loc_log.h \ loc_target.h \ - loc_timer.h \ - MsgTask.h \ - LocHeap.h \ - LocThread.h \ - LocTimer.h \ - loc_misc_utils.h + loc_timer.h libgps_utils_so_la_c_sources = \ linked_list.c \ msg_q.c \ loc_cfg.cpp \ loc_log.cpp \ - loc_target.cpp \ - LocHeap.cpp \ - LocTimer.cpp \ - LocThread.cpp \ - MsgTask.cpp \ - loc_misc_utils.cpp + loc_timer.c \ + loc_target.cpp library_includedir = $(pkgincludedir)/utils diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp index 78a3fe00..f33d6024 100644 --- a/utils/MsgTask.cpp +++ b/utils/MsgTask.cpp @@ -33,7 +33,6 @@ #include #include #include -#include static void LocMsgDestroy(void* msg) { delete (LocMsg*)msg; @@ -78,7 +77,7 @@ void MsgTask::sendMsg(const LocMsg* msg) const { void MsgTask::prerun() { // make sure we do not run in background scheduling group - platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); + set_sched_policy(gettid(), SP_FOREGROUND); } bool MsgTask::run() { diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 926781a6..967d2f30 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #ifdef USE_GLIB #include diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp index dfe19a2d..7e96313f 100644 --- a/utils/loc_misc_utils.cpp +++ b/utils/loc_misc_utils.cpp @@ -28,7 +28,7 @@ */ #include #include -#include +#include #include #include diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 25fd1790..2967858e 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ #include -#include + /* user_data: client context pointer, passthrough. Originally received from calling client when loc_timer_start() is called. From a29688ff347be4972133eb11ccecaf03b0d3445e Mon Sep 17 00:00:00 2001 From: Deven Patel Date: Mon, 7 Mar 2016 10:44:34 -0800 Subject: [PATCH 39/41] Revert "Merging m_master changes to oe_master". This reverts commit 1aeb6bad84c0afd0e032c3d4d7e33959501e18f1 Change-Id: Iec0a96e7cdfe55ef5836c92a2ae1cce407f6cd5e --- core/Android.mk | 14 +- core/ContextBase.cpp | 29 +- core/ContextBase.h | 11 +- core/LBSProxyBase.h | 13 +- core/LocAdapterBase.cpp | 41 +- core/LocAdapterBase.h | 27 +- core/LocAdapterProxyBase.h | 70 - core/LocApiBase.cpp | 96 +- core/LocApiBase.h | 60 +- core/LocDualContext.cpp | 97 +- core/LocDualContext.h | 34 +- core/MsgTask.cpp | 131 ++ {utils => core}/MsgTask.h | 45 +- core/UlpProxyBase.h | 14 +- core/gps_extended_c.h | 222 +-- core/loc_core_log.cpp | 67 +- etc/gps.conf | 38 +- loc_api/NOTICE | 13 + .../libloc_api-rpc-glue/rpc_inc/LocApiRpc.h | 8 +- .../libloc_api-rpc-glue/src/LocApiRpc.cpp | 48 +- loc_api/libloc_api-rpc/Android.mk | 61 + loc_api/libloc_api-rpc/gen-1240/Makefile.xdr | 29 + loc_api/libloc_api-rpc/gen-1240/loc_api.xdr | 172 ++ .../libloc_api-rpc/gen-1240/loc_api_cb.xdr | 85 + .../libloc_api-rpc/gen-1240/loc_api_cb_svc.c | 64 + .../libloc_api-rpc/gen-1240/loc_api_cb_xdr.c | 32 + .../libloc_api-rpc/gen-1240/loc_api_clnt.c | 91 + .../gen-1240/loc_api_common.xdr | 906 +++++++++ .../gen-1240/loc_api_common_xdr.c | 1650 +++++++++++++++++ .../libloc_api-rpc/gen-1240/loc_api_fixup.c | 48 + .../gen-1240/loc_api_rpc_glue.c | 339 ++++ loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c | 171 ++ loc_api/libloc_api-rpc/gen-3200/Makefile.xdr | 29 + loc_api/libloc_api-rpc/gen-3200/loc_api.xdr | 164 ++ .../libloc_api-rpc/gen-3200/loc_api_cb.xdr | 90 + .../libloc_api-rpc/gen-3200/loc_api_cb_svc.c | 64 + .../libloc_api-rpc/gen-3200/loc_api_cb_xdr.c | 32 + .../libloc_api-rpc/gen-3200/loc_api_clnt.c | 82 + .../gen-3200/loc_api_common.xdr | 803 ++++++++ .../gen-3200/loc_api_common_xdr.c | 1441 ++++++++++++++ .../libloc_api-rpc/gen-3200/loc_api_fixup.c | 48 + .../gen-3200/loc_api_rpc_glue.c | 339 ++++ loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c | 171 ++ loc_api/libloc_api-rpc/inc-1240/loc_api.h | 210 +++ loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h | 64 + .../libloc_api-rpc/inc-1240/loc_api_common.h | 1154 ++++++++++++ .../libloc_api-rpc/inc-1240/loc_api_fixup.h | 188 ++ .../inc-1240/loc_apicb_appinit.h | 34 + loc_api/libloc_api-rpc/inc-3200/loc_api.h | 198 ++ loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h | 64 + .../libloc_api-rpc/inc-3200/loc_api_common.h | 1031 ++++++++++ .../libloc_api-rpc/inc-3200/loc_api_fixup.h | 188 ++ .../inc-3200/loc_apicb_appinit.h | 34 + loc_api/libloc_api-rpc/inc/debug.h | 57 + loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h | 100 + .../libloc_api-rpc/src/loc_apicb_appinit.c | 61 + loc_api/libloc_api_50001/Android.mk | 11 +- loc_api/libloc_api_50001/LocEngAdapter.cpp | 346 +--- loc_api/libloc_api_50001/LocEngAdapter.h | 90 +- loc_api/libloc_api_50001/gps.c | 2 +- loc_api/libloc_api_50001/loc.cpp | 258 +-- loc_api/libloc_api_50001/loc.h | 2 +- loc_api/libloc_api_50001/loc_eng.cpp | 672 ++----- loc_api/libloc_api_50001/loc_eng.h | 106 +- loc_api/libloc_api_50001/loc_eng_agps.cpp | 4 +- loc_api/libloc_api_50001/loc_eng_agps.h | 12 - loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp | 2 +- loc_api/libloc_api_50001/loc_eng_dmn_conn.h | 12 +- loc_api/libloc_api_50001/loc_eng_msg.h | 14 +- loc_api/libloc_api_50001/loc_eng_ni.cpp | 169 +- loc_api/libloc_api_50001/loc_eng_ni.h | 8 - loc_api/libloc_api_50001/loc_eng_nmea.cpp | 62 +- loc_api/libloc_api_50001/loc_eng_nmea.h | 3 +- loc_api/libloc_api_50001/loc_eng_xtra.cpp | 58 +- .../loc_pla/include/platform_lib_log_util.h | 52 +- utils/Android.mk | 33 +- utils/LocHeap.cpp | 354 ---- utils/LocHeap.h | 96 - utils/LocSharedLock.h | 59 - utils/LocThread.cpp | 264 --- utils/LocThread.h | 92 - utils/LocTimer.cpp | 737 -------- utils/LocTimer.h | 74 - utils/MsgTask.cpp | 100 - utils/linked_list.c | 6 +- utils/loc_cfg.cpp | 462 ++--- utils/loc_cfg.h | 26 +- utils/loc_log.cpp | 82 +- utils/loc_log.h | 17 +- utils/loc_misc_utils.cpp | 114 -- utils/loc_misc_utils.h | 99 - utils/loc_target.cpp | 62 +- utils/loc_target.h | 16 +- utils/loc_timer.c | 187 ++ utils/loc_timer.h | 36 +- utils/msg_q.c | 8 +- .../elapsed_millis_since_boot.cpp | 46 - .../platform_lib_includes.h | 35 - .../platform_lib_macros.h | 81 - .../platform_lib_time.h | 35 - 100 files changed, 11537 insertions(+), 4839 deletions(-) delete mode 100644 core/LocAdapterProxyBase.h create mode 100644 core/MsgTask.cpp rename {utils => core}/MsgTask.h (67%) create mode 100644 loc_api/NOTICE create mode 100644 loc_api/libloc_api-rpc/Android.mk create mode 100644 loc_api/libloc_api-rpc/gen-1240/Makefile.xdr create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api.xdr create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c create mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/Makefile.xdr create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api.xdr create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c create mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c create mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api.h create mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h create mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api_common.h create mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h create mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h create mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api.h create mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h create mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api_common.h create mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h create mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h create mode 100644 loc_api/libloc_api-rpc/inc/debug.h create mode 100644 loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h create mode 100644 loc_api/libloc_api-rpc/src/loc_apicb_appinit.c delete mode 100644 utils/LocHeap.cpp delete mode 100644 utils/LocHeap.h delete mode 100644 utils/LocSharedLock.h delete mode 100644 utils/LocThread.cpp delete mode 100644 utils/LocThread.h delete mode 100644 utils/LocTimer.cpp delete mode 100644 utils/LocTimer.h delete mode 100644 utils/MsgTask.cpp delete mode 100644 utils/loc_misc_utils.cpp delete mode 100644 utils/loc_misc_utils.h create mode 100644 utils/loc_timer.c delete mode 100644 utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp delete mode 100644 utils/platform_lib_abstractions/platform_lib_includes.h delete mode 100644 utils/platform_lib_abstractions/platform_lib_macros.h delete mode 100644 utils/platform_lib_abstractions/platform_lib_time.h diff --git a/core/Android.mk b/core/Android.mk index c6d3128d..11cecc65 100644 --- a/core/Android.mk +++ b/core/Android.mk @@ -10,12 +10,6 @@ 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 \ @@ -23,6 +17,7 @@ LOCAL_SHARED_LIBRARIES := \ libdl LOCAL_SRC_FILES += \ + MsgTask.cpp \ LocApiBase.cpp \ LocAdapterBase.cpp \ ContextBase.cpp \ @@ -34,11 +29,11 @@ LOCAL_CFLAGS += \ -D_ANDROID_ LOCAL_C_INCLUDES:= \ - $(TARGET_OUT_HEADERS)/gps.utils \ - $(TARGET_OUT_HEADERS)/libflp + $(TARGET_OUT_HEADERS)/gps.utils LOCAL_COPY_HEADERS_TO:= libloc_core/ LOCAL_COPY_HEADERS:= \ + MsgTask.h \ LocApiBase.h \ LocAdapterBase.h \ ContextBase.h \ @@ -47,8 +42,7 @@ LOCAL_COPY_HEADERS:= \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ - loc_core_log.h \ - LocAdapterProxyBase.h + loc_core_log.h LOCAL_PRELINK_MODULE := false diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index 58dc8a78..b2869bb9 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -69,28 +69,13 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) // first if can not be MPQ if (TARGET_MPQ != loc_get_target()) { - if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) { - void *handle = NULL; - //try to see if LocApiV02 is present - if((handle = dlopen("libloc_api_v02.so", RTLD_NOW)) != NULL) { - LOC_LOGD("%s:%d]: libloc_api_v02.so is present", __func__, __LINE__); - getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi"); - if(getter != NULL) { - LOC_LOGD("%s:%d]: getter is not NULL for LocApiV02", __func__, __LINE__); - locApi = (*getter)(mMsgTask, exMask, this); - } - } + if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask))) { // only RPC is the option now - else { - LOC_LOGD("%s:%d]: libloc_api_v02.so is NOT present. Trying RPC", - __func__, __LINE__); - handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); - if (NULL != handle) { - getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi"); - if (NULL != getter) { - LOC_LOGD("%s:%d]: getter is not NULL in RPC", __func__, __LINE__); - locApi = (*getter)(mMsgTask, exMask, this); - } + void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); + if (NULL != handle) { + getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi"); + if (NULL != getter) { + locApi = (*getter)(mMsgTask, exMask); } } } @@ -99,7 +84,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) // locApi could still be NULL at this time // we would then create a dummy one if (NULL == locApi) { - locApi = new LocApiBase(mMsgTask, exMask, this); + locApi = new LocApiBase(mMsgTask, exMask); } return locApi; diff --git a/core/ContextBase.h b/core/ContextBase.h index fe0b8606..85cbab7e 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -56,17 +56,12 @@ public: inline const MsgTask* getMsgTask() { return mMsgTask; } inline LocApiBase* getLocApi() { return mLocApi; } inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; } - inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); } - inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); } - inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); } + inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); } + inline bool hasCPIExt() { return mLBSProxy->hasCPIExt(); } 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); } }; } // namespace loc_core diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h index 0faf8012..f0d1a329 100644 --- a/core/LBSProxyBase.h +++ b/core/LBSProxyBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,14 +35,12 @@ 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 { + LOC_API_ADAPTER_EVENT_MASK_T exMask) const { return NULL; } protected: @@ -51,11 +49,8 @@ public: inline virtual ~LBSProxyBase() {} inline virtual void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) const {} - inline virtual bool hasAgpsExtendedCapabilities() const { return false; } - inline virtual bool hasCPIExtendedCapabilities() const { return false; } - inline virtual void modemPowerVote(bool power) const {} - virtual void injectFeatureConfig(ContextBase* context) const {} - inline virtual IzatDevId_t getIzatDevId() const { return 0; } + inline virtual bool hasAgpsExt() const { return false; } + inline virtual bool hasCPIExt() const { return false; } }; typedef LBSProxyBase* (getLBSProxy_t)(); diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 8fdb8cbb..054a295c 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -32,8 +32,7 @@ #include #include #include -#include -#include +#include namespace loc_core { @@ -42,45 +41,27 @@ namespace loc_core { // 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) : + ContextBase* context) : mEvtMask(mask), mContext(context), - mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase), - mMsgTask(context->getMsgTask()) + mLocApi(context->getLocApi()), mMsgTask(context->getMsgTask()) { mLocApi->addAdapter(this); } -void LocAdapterBase::handleEngineUpEvent() -{ - if (mLocAdapterProxyBase) { - mLocAdapterProxyBase->handleEngineUpEvent(); - } -} - -void LocAdapterBase::handleEngineDownEvent() -{ - if (mLocAdapterProxyBase) { - mLocAdapterProxyBase->handleEngineDownEvent(); - } -} +void LocAdapterBase:: + handleEngineDownEvent() +DEFAULT_IMPL() 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() - } -} + LocPosTechMask loc_technology_mask) +DEFAULT_IMPL() void LocAdapterBase:: - reportSv(GnssSvStatus &svStatus, + reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) DEFAULT_IMPL() @@ -135,8 +116,4 @@ DEFAULT_IMPL(false) bool LocAdapterBase:: requestNiNotify(GpsNiNotification ¬ify, const void* data) DEFAULT_IMPL(false) - -void LocAdapterBase:: - reportGpsMeasurementData(GpsData &gpsMeasurementData) -DEFAULT_IMPL() } // namespace loc_core diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 5f4660b8..8222b24b 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,23 +35,19 @@ namespace loc_core { -class LocAdapterProxyBase; - class LocAdapterBase { protected: - LOC_API_ADAPTER_EVENT_MASK_T mEvtMask; + const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask; ContextBase* mContext; LocApiBase* mLocApi; - LocAdapterProxyBase* mLocAdapterProxyBase; const MsgTask* mMsgTask; inline LocAdapterBase(const MsgTask* msgTask) : - mEvtMask(0), mContext(NULL), mLocApi(NULL), - mLocAdapterProxyBase(NULL), mMsgTask(msgTask) {} + mEvtMask(0), mContext(NULL), mLocApi(NULL), mMsgTask(msgTask) {} public: inline virtual ~LocAdapterBase() { mLocApi->removeAdapter(this); } LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, - ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL); + ContextBase* context); inline LOC_API_ADAPTER_EVENT_MASK_T checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const { return mEvtMask & mask; @@ -69,19 +65,10 @@ public: mMsgTask->sendMsg(msg); } - inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled) - { - mEvtMask = - isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event); - - mLocApi->updateEvtMask(); - } - // This will be overridden by the individual adapters // if necessary. inline virtual void setUlpProxy(UlpProxyBase* ulp) {} - virtual void handleEngineUpEvent(); + inline virtual void handleEngineUpEvent() {} virtual void handleEngineDownEvent(); inline virtual void setPositionModeInt(LocPosMode& posMode) {} virtual void startFixInt() {} @@ -92,7 +79,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GnssSvStatus &svStatus, + virtual void reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -110,8 +97,6 @@ public: virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data); inline virtual bool isInSession() { return false; } - ContextBase* getContext() const { return mContext; } - virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData); }; } // namespace loc_core diff --git a/core/LocAdapterProxyBase.h b/core/LocAdapterProxyBase.h deleted file mode 100644 index 1ddcca4c..00000000 --- a/core/LocAdapterProxyBase.h +++ /dev/null @@ -1,70 +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 -#include - -namespace loc_core { - -class LocAdapterProxyBase { -private: - LocAdapterBase *mLocAdapterBase; -protected: - inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, - ContextBase* context): - mLocAdapterBase(new LocAdapterBase(mask, context, this)) { - } - inline virtual ~LocAdapterProxyBase() { - delete mLocAdapterBase; - } - ContextBase* getContext() const { - return mLocAdapterBase->getContext(); - } - inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled) { - mLocAdapterBase->updateEvtMask(event,isEnabled); - } - -public: - inline virtual void handleEngineUpEvent() {}; - inline virtual void handleEngineDownEvent() {}; - inline virtual bool reportPosition(UlpLocation &location, - GpsLocationExtended &locationExtended, - enum loc_sess_status status, - LocPosTechMask loc_technology_mask) { - return false; - } -}; - -} // namespace loc_core - -#endif //LOC_ADAPTER_PROXY_BASE_H diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index dcd35fec..3cd2ffa8 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -32,8 +32,7 @@ #include #include #include -#include -#include +#include namespace loc_core { @@ -126,10 +125,8 @@ struct LocOpenMsg : public LocMsg { }; LocApiBase::LocApiBase(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T excludedMask, - ContextBase* context) : - mExcludedMask(excludedMask), mMsgTask(msgTask), - mMask(0), mSupportedMsg(0), mContext(context) + LOC_API_ADAPTER_EVENT_MASK_T excludedMask) : + mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0) { memset(mLocAdapters, 0, sizeof(mLocAdapters)); } @@ -204,18 +201,11 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter) } } -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()); } @@ -232,17 +222,6 @@ void LocApiBase::reportPosition(UlpLocation &location, 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, @@ -253,24 +232,10 @@ void LocApiBase::reportPosition(UlpLocation &location, ); } -void LocApiBase::reportSv(GnssSvStatus &svStatus, +void LocApiBase::reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { - // print the SV info before delivering - LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n gps/glo/bds in use" - " mask: %x/%x/%x\n sv: prn snr elevation azimuth", - svStatus.num_svs, svStatus.ephemeris_mask, - svStatus.almanac_mask, svStatus.gps_used_in_fix_mask, - svStatus.glo_used_in_fix_mask, svStatus.bds_used_in_fix_mask); - for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) { - LOC_LOGV(" %d: %d %f %f %f", - i, - svStatus.sv_list[i].prn, - svStatus.sv_list[i].snr, - svStatus.sv_list[i].elevation, - svStatus.sv_list[i].azimuth); - } // loop through adapters, and deliver to all adapters. TO_ALL_LOCADAPTERS( mLocAdapters[i]->reportSv(svStatus, @@ -353,23 +318,12 @@ void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data) TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data)); } -void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList) -{ - mSupportedMsg = supportedMsgList; -} - void* LocApiBase :: getSibling() DEFAULT_IMPL(NULL) LocApiProxyBase* LocApiBase :: getLocApiProxy() DEFAULT_IMPL(NULL) -void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData) -{ - // loop through adapters, and deliver to all adapters. - TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData)); -} - enum loc_api_adapter_err LocApiBase:: open(LOC_API_ADAPTER_EVENT_MASK_T mask) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) @@ -450,8 +404,7 @@ enum loc_api_adapter_err LocApiBase:: DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: - setSensorControlConfig(int sensorUsage, - int sensorProvider) + setSensorControlConfig(int sensorUsage) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: @@ -489,23 +442,12 @@ enum loc_api_adapter_err LocApiBase:: DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: - getWwanZppFix(GpsLocation& zppLoc) + getZppFix(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) -} + getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask) +DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) int LocApiBase:: initDataServiceClient() @@ -524,30 +466,10 @@ void LocApiBase:: DEFAULT_IMPL() int LocApiBase:: - setGpsLock(LOC_GPS_LOCK_MASK lock) + setGpsLock(unsigned int lock) DEFAULT_IMPL(-1) -void LocApiBase:: - installAGpsCert(const DerEncodedCertificate* pData, - size_t length, - uint32_t slotBitMask) -DEFAULT_IMPL() - int LocApiBase:: getGpsLock() DEFAULT_IMPL(-1) - -enum loc_api_adapter_err LocApiBase:: - setXtraVersionCheck(enum xtra_version_check check) -DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) - -int LocApiBase:: - updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled) -DEFAULT_IMPL(-1) - -bool LocApiBase:: - gnssConstellationConfig() -DEFAULT_IMPL(false) - } // namespace loc_core diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 5a2c56f0..c48927c4 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -36,7 +36,6 @@ #include namespace loc_core { -class ContextBase; int hexcode(char *hexstring, int string_size, const char *data, int data_size); @@ -53,13 +52,6 @@ int decodeAddress(char *addr_string, int string_size, #define TO_1ST_HANDLING_ADAPTER(adapters, call) \ for (int i = 0; i sendMsg(msg); - } - void addAdapter(LocAdapterBase* adapter); void removeAdapter(LocAdapterBase* adapter); @@ -113,7 +99,7 @@ public: enum loc_sess_status status, LocPosTechMask loc_technology_mask = LOC_POS_TECH_MASK_DEFAULT); - void reportSv(GnssSvStatus &svStatus, + void reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); void reportStatus(GpsStatusValue status); @@ -129,8 +115,6 @@ public: void reportDataCallOpened(); void reportDataCallClosed(); void requestNiNotify(GpsNiNotification ¬ify, const void* data); - void saveSupportedMsgList(uint64_t supportedMsgList); - void reportGpsMeasurementData(GpsData &gpsMeasurementData); // downward calls // All below functions are to be defined by adapter specific modules: @@ -174,7 +158,7 @@ public: virtual enum loc_api_adapter_err setLPPConfig(uint32_t profile); virtual enum loc_api_adapter_err - setSensorControlConfig(int sensorUsage, int sensorProvider); + setSensorControlConfig(int sensorUsage); virtual enum loc_api_adapter_err setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk, @@ -202,28 +186,15 @@ public: virtual enum loc_api_adapter_err setAGLONASSProtocol(unsigned long aGlonassProtocol); virtual enum loc_api_adapter_err - getWwanZppFix(GpsLocation & zppLoc); + getZppFix(GpsLocation & zppLoc); virtual enum loc_api_adapter_err - getBestAvailableZppFix(GpsLocation & zppLoc); - virtual enum loc_api_adapter_err - getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask); + getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask); virtual int initDataServiceClient(); virtual int openAndStartDataCall(); virtual void stopDataCall(); virtual void closeDataCall(); - virtual void installAGpsCert(const DerEncodedCertificate* pData, - size_t length, - uint32_t slotBitMask); + inline virtual void setInSession(bool inSession) {} - inline bool isMessageSupported (LocCheckingMessagesID msgID) const { - if (msgID > (sizeof(mSupportedMsg) << 3)) { - return false; - } else { - uint32_t messageChecker = 1 << msgID; - return (messageChecker & mSupportedMsg) == messageChecker; - } - } - void updateEvtMask(); /*Values for lock 1 = Do not lock any position sessions @@ -231,30 +202,17 @@ public: 3 = Lock MT position sessions 4 = Lock all position sessions */ - virtual int setGpsLock(LOC_GPS_LOCK_MASK lock); + virtual int setGpsLock(unsigned int lock); /* Returns Current value of GPS Lock on success -1 on failure */ virtual int getGpsLock(void); - - virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check); - - /* - Update gps reporting events - */ - virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled); - /* - Check if the modem support the service - */ - virtual bool gnssConstellationConfig(); }; typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask, - ContextBase *context); + LOC_API_ADAPTER_EVENT_MASK_T exMask); } // namespace loc_core diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index b5f33ac3..b4eaf7ff 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -49,97 +49,86 @@ LocDualContext::mBgExclMask = 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); + LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT); const MsgTask* LocDualContext::mMsgTask = NULL; ContextBase* LocDualContext::mFgContext = NULL; ContextBase* LocDualContext::mBgContext = NULL; -ContextBase* LocDualContext::mInjectContext = NULL; + // the name must be shorter than 15 chars const char* LocDualContext::mLocationHalName = "Loc_hal_worker"; -const char* LocDualContext::mLBSLibName = "liblbs_core.so"; +#ifndef USE_GLIB +const char* LocDualContext::mIzatLibName = "liblbs_core.so"; +#else +const char* LocDualContext::mIzatLibName = "liblbs_core.so.1"; +#endif -pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER; - -const MsgTask* LocDualContext::getMsgTask(LocThread::tCreate tCreator, - const char* name, bool joinable) +const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator, + const char* name) { if (NULL == mMsgTask) { - mMsgTask = new MsgTask(tCreator, name, joinable); + mMsgTask = new MsgTask(tCreator, name); } return mMsgTask; } -inline -const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) { - return getMsgTask((LocThread::tCreate)NULL, name, joinable); +const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate, + const char* name) +{ + if (NULL == mMsgTask) { + mMsgTask = new MsgTask(tAssociate, name); + } + return mMsgTask; } -ContextBase* LocDualContext::getLocFgContext(LocThread::tCreate tCreator, - LocMsg* firstMsg, const char* name, bool joinable) +ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator, + const char* name) { - pthread_mutex_lock(&LocDualContext::mGetLocContextMutex); - LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__); if (NULL == mFgContext) { - LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__); - const MsgTask* msgTask = getMsgTask(tCreator, name, joinable); + const MsgTask* msgTask = getMsgTask(tCreator, name); mFgContext = new LocDualContext(msgTask, mFgExclMask); } - 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) +ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate, + const char* name) +{ + if (NULL == mFgContext) { + const MsgTask* msgTask = getMsgTask(tAssociate, name); + mFgContext = new LocDualContext(msgTask, + mFgExclMask); + } + return mFgContext; + +} + +ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator, + const char* name) { - pthread_mutex_lock(&LocDualContext::mGetLocContextMutex); - LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__); if (NULL == mBgContext) { - LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__); - const MsgTask* msgTask = getMsgTask(tCreator, name, joinable); + const MsgTask* msgTask = getMsgTask(tCreator, name); mBgContext = new LocDualContext(msgTask, mBgExclMask); } - 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) +ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate, + const char* name) { - 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); + if (NULL == mBgContext) { + const MsgTask* msgTask = getMsgTask(tAssociate, name); + mBgContext = new LocDualContext(msgTask, + mBgExclMask); } - LOC_LOGD("%s:%d]: Exit", __func__, __LINE__); + return mBgContext; } LocDualContext::LocDualContext(const MsgTask* msgTask, LOC_API_ADAPTER_EVENT_MASK_T exMask) : - ContextBase(msgTask, exMask, mLBSLibName) + ContextBase(msgTask, exMask, mIzatLibName) { } diff --git a/core/LocDualContext.h b/core/LocDualContext.h index ce77a1aa..e761e764 100644 --- a/core/LocDualContext.h +++ b/core/LocDualContext.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -40,11 +40,11 @@ class LocDualContext : public ContextBase { static const MsgTask* mMsgTask; static ContextBase* mFgContext; static ContextBase* mBgContext; - static ContextBase* mInjectContext; - static const MsgTask* getMsgTask(LocThread::tCreate tCreator, - const char* name, bool joinable = true); - static const MsgTask* getMsgTask(const char* name, bool joinable = true); - static pthread_mutex_t mGetLocContextMutex; + + static const MsgTask* getMsgTask(MsgTask::tCreate tCreator, + const char* name); + static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate, + const char* name); protected: LocDualContext(const MsgTask* msgTask, @@ -52,23 +52,19 @@ protected: inline virtual ~LocDualContext() {} public: - static const char* mLBSLibName; + static const char* mIzatLibName; static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask; static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask; static const char* mLocationHalName; - static ContextBase* getLocFgContext(LocThread::tCreate tCreator, LocMsg* firstMsg, - const char* name, bool joinable = true); - inline static ContextBase* getLocFgContext(const char* name, bool joinable = true) { - return getLocFgContext(NULL, NULL, name, joinable); - } - static ContextBase* getLocBgContext(LocThread::tCreate tCreator, LocMsg* firstMsg, - const char* name, bool joinable = true); - inline static ContextBase* getLocBgContext(const char* name, bool joinable = true) { - return getLocBgContext(NULL, NULL, name, joinable); - } - - static void injectFeatureConfig(ContextBase *context); + static ContextBase* getLocFgContext(MsgTask::tCreate tCreator, + const char* name); + static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate, + const char* name); + static ContextBase* getLocBgContext(MsgTask::tCreate tCreator, + const char* name); + static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate, + const char* name); }; } diff --git a/core/MsgTask.cpp b/core/MsgTask.cpp new file mode 100644 index 00000000..df6db808 --- /dev/null +++ b/core/MsgTask.cpp @@ -0,0 +1,131 @@ +/* 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_MsgTask" + +#include +#include +#include +#include +#include + +namespace loc_core { + +#define MAX_TASK_COMM_LEN 15 + +static void LocMsgDestroy(void* msg) { + delete (LocMsg*)msg; +} + +MsgTask::MsgTask(tCreate tCreator, const char* threadName) : + mQ(msg_q_init2()), mAssociator(NULL){ + if (tCreator) { + tCreator(threadName, loopMain, + (void*)new MsgTask(mQ, mAssociator)); + } else { + createPThread(threadName); + } +} + +MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) : + mQ(msg_q_init2()), mAssociator(tAssociator){ + createPThread(threadName); +} + +inline +MsgTask::MsgTask(const void* q, tAssociate associator) : + mQ(q), mAssociator(associator){ +} + +MsgTask::~MsgTask() { + msg_q_unblock((void*)mQ); +} + +void MsgTask::createPThread(const char* threadName) { + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + + pthread_t tid; + // create the thread here, then if successful + // and a name is given, we set the thread name + if (!pthread_create(&tid, &attr, loopMain, + (void*)new MsgTask(mQ, mAssociator)) && + NULL != threadName) { + char lname[MAX_TASK_COMM_LEN+1]; + memcpy(lname, threadName, MAX_TASK_COMM_LEN); + lname[MAX_TASK_COMM_LEN] = 0; + pthread_setname_np(tid, lname); + } +} + +void MsgTask::sendMsg(const LocMsg* msg) const { + msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy); +} + +void* MsgTask::loopMain(void* arg) { + MsgTask* copy = (MsgTask*)arg; + + // make sure we do not run in background scheduling group + platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); + + if (NULL != copy->mAssociator) { + copy->mAssociator(); + } + + LocMsg* msg; + int cnt = 0; + + while (1) { + LOC_LOGD("MsgTask::loop() %d listening ...\n", cnt++); + + msq_q_err_type result = msg_q_rcv((void*)copy->mQ, (void **)&msg); + + if (eMSG_Q_SUCCESS != result) { + LOC_LOGE("%s:%d] fail receiving msg: %s\n", __func__, __LINE__, + loc_get_msg_q_status(result)); + // destroy the Q and exit + msg_q_destroy((void**)&(copy->mQ)); + delete copy; + return NULL; + } + + msg->log(); + // there is where each individual msg handling is invoked + msg->proc(); + + delete msg; + } + + delete copy; + + return NULL; +} + +} diff --git a/utils/MsgTask.h b/core/MsgTask.h similarity index 67% rename from utils/MsgTask.h rename to core/MsgTask.h index 9eb1f567..d09de731 100644 --- a/utils/MsgTask.h +++ b/core/MsgTask.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013,2015 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,7 +29,12 @@ #ifndef __MSG_TASK__ #define __MSG_TASK__ -#include +#include +#include +#include +#include + +namespace loc_core { struct LocMsg { inline LocMsg() {} @@ -38,30 +43,24 @@ struct LocMsg { inline virtual void log() const {} }; -class MsgTask : public LocRunnable { - const void* mQ; - LocThread* mThread; - friend class LocThreadDelegate; -protected: - virtual ~MsgTask(); +class MsgTask { public: - MsgTask(LocThread::tCreate tCreator, const char* threadName = NULL, bool joinable = true); - MsgTask(const char* threadName = NULL, bool joinable = true); - // this obj will be deleted once thread is deleted - void destroy(); + typedef void* (*tStart)(void*); + typedef pthread_t (*tCreate)(const char* name, tStart start, void* arg); + typedef int (*tAssociate)(); + MsgTask(tCreate tCreator, const char* threadName); + MsgTask(tAssociate tAssociator, const char* threadName); + ~MsgTask(); void sendMsg(const LocMsg* msg) const; - // Overrides of LocRunnable methods - // This method will be repeated called until it returns false; or - // until thread is stopped. - virtual bool run(); - // The method to be run before thread loop (conditionally repeatedly) - // calls run() - virtual void prerun(); - - // The method to be run after thread loop (conditionally repeatedly) - // calls run() - inline virtual void postrun() {} +private: + const void* mQ; + tAssociate mAssociator; + MsgTask(const void* q, tAssociate associator); + static void* loopMain(void* copy); + void createPThread(const char* name); }; +} // namespace loc_core + #endif //__MSG_TASK__ diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 59e265e8..90097571 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,7 +30,6 @@ #define ULP_PROXY_BASE_H #include -#include "fused_location_extended.h" namespace loc_core { @@ -51,7 +50,6 @@ public: mPosMode = params; return false; } - inline virtual bool reportPosition(UlpLocation &location, GpsLocationExtended &locationExtended, void* locationExt, @@ -59,7 +57,7 @@ public: LocPosTechMask loc_technology_mask) { return false; } - inline virtual bool reportSv(GnssSvStatus &svStatus, + inline virtual bool reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { return false; @@ -69,14 +67,6 @@ public: } inline virtual void setAdapter(LocAdapterBase* adapter) {} inline virtual void setCapabilities(unsigned long capabilities) {} - inline virtual bool reportBatchingSession(FlpExtBatchOptions &options, - bool active) { - return false; - } - inline virtual bool reportPositions(const FlpExtLocation* locations, - int32_t number_of_locations) { - return false; - } }; } // namespace loc_core diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index e37ff482..f8e540fb 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -31,8 +31,6 @@ #include #include -#include -#include #include /** @@ -62,31 +60,15 @@ extern "C" { /** Position source is ULP */ #define ULP_LOCATION_IS_FROM_HYBRID 0x0001 /** Position source is GNSS only */ -#define ULP_LOCATION_IS_FROM_GNSS 0x0002 +#define ULP_LOCATION_IS_FROM_GNSS 0x0002 /** Position source is ZPP only */ -#define ULP_LOCATION_IS_FROM_ZPP 0x0004 -/** Position is from a Geofence Breach Event */ -#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008 -/** Position is from Hardware FLP */ -#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010 -/** Position is from NLP */ -#define ULP_LOCATION_IS_FROM_NLP 0x0020 -/** Position is from PIP */ -#define ULP_LOCATION_IS_FROM_PIP 0x0040 +#define ULP_LOCATION_IS_FROM_ZPP 0x0004 #define ULP_MIN_INTERVAL_INVALID 0xffffffff /*Emergency SUPL*/ #define GPS_NI_TYPE_EMERGENCY_SUPL 4 -#define AGPS_CERTIFICATE_MAX_LENGTH 2000 -#define AGPS_CERTIFICATE_MAX_SLOTS 10 - -enum loc_registration_mask_status { - LOC_REGISTRATION_MASK_ENABLED, - LOC_REGISTRATION_MASK_DISABLED -}; - typedef struct { /** set to sizeof(UlpLocation) */ size_t size; @@ -153,7 +135,7 @@ typedef struct { AGpsExtType type; AGpsStatusValue status; uint32_t ipv4_addr; - struct sockaddr_storage addr; + char ipv6_addr[16]; char ssid[SSID_BUF_SIZE]; char password[SSID_BUF_SIZE]; } AGpsExtStatus; @@ -219,6 +201,22 @@ typedef enum loc_position_mode_type { */ #define GPS_DEFAULT_FIX_INTERVAL_MS 1000 +/** GpsLocationExtended has valid latitude and longitude. */ +#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0) +/** GpsLocationExtended has valid altitude. */ +#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE (1U<<1) +/** GpsLocationExtended has valid speed. */ +#define GPS_LOCATION_EXTENDED_HAS_SPEED (1U<<2) +/** GpsLocationExtended has valid bearing. */ +#define GPS_LOCATION_EXTENDED_HAS_BEARING (1U<<4) +/** GpsLocationExtended has valid accuracy. */ +#define GPS_LOCATION_EXTENDED_HAS_ACCURACY (1U<<8) + +/** GPS extended supports geofencing */ +#define GPS_EXTENDED_CAPABILITY_GEOFENCE 0x0000001 +/** GPS extended supports batching */ +#define GPS_EXTENDED_CAPABILITY_BATCHING 0x0000002 + /** Flags to indicate which values are valid in a GpsLocationExtended. */ typedef uint16_t GpsLocationExtendedFlags; /** GpsLocationExtended has valid pdop, hdop, vdop. */ @@ -233,20 +231,6 @@ typedef uint16_t GpsLocationExtendedFlags; #define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010 /** GpsLocationExtended has valid speed uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020 -/** GpsLocationExtended has valid heading uncertainty */ -#define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040 -/** GpsLocationExtended has valid horizontal reliability */ -#define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080 -/** GpsLocationExtended has valid vertical reliability */ -#define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100 - -typedef enum { - LOC_RELIABILITY_NOT_SET = 0, - LOC_RELIABILITY_VERY_LOW = 1, - LOC_RELIABILITY_LOW = 2, - LOC_RELIABILITY_MEDIUM = 3, - LOC_RELIABILITY_HIGH = 4 -}LocReliability; /** Represents gps location extended. */ typedef struct { @@ -268,55 +252,8 @@ typedef struct { float vert_unc; /** speed uncertainty in m/s */ float speed_unc; - /** heading uncertainty in degrees (0 to 359.999) */ - float bearing_unc; - /** horizontal reliability. */ - LocReliability horizontal_reliability; - /** vertical reliability. */ - LocReliability vertical_reliability; } GpsLocationExtended; -/** Represents SV status. */ -typedef struct { - /** set to sizeof(GnssSvStatus) */ - size_t size; - - /** Number of SVs currently visible. */ - int num_svs; - - /** Contains an array of SV information. */ - GpsSvInfo sv_list[GPS_MAX_SVS]; - - /** Represents a bit mask indicating which SVs - * have ephemeris data. - */ - uint32_t ephemeris_mask; - - /** Represents a bit mask indicating which SVs - * have almanac data. - */ - uint32_t almanac_mask; - - /** - * Represents a bit mask indicating which GPS SVs - * were used for computing the most recent position fix. - */ - uint32_t gps_used_in_fix_mask; - - /** - * Represents a bit mask indicating which GLONASS SVs - * were used for computing the most recent position fix. - */ - uint32_t glo_used_in_fix_mask; - - /** - * Represents a bit mask indicating which BDS SVs - * were used for computing the most recent position fix. - */ - uint64_t bds_used_in_fix_mask; - -} GnssSvStatus; - enum loc_sess_status { LOC_SESS_SUCCESS, LOC_SESS_INTERMEDIATE, @@ -365,95 +302,66 @@ enum loc_api_adapter_err { 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_ENGINE_DOWN = 100, + LOC_API_ADAPTER_ERR_FAILURE, LOC_API_ADAPTER_ERR_UNKNOWN }; enum loc_api_adapter_event_index { - LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type - LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report - LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate - LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate - LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request - LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request - LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server - LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl - LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state - LOC_API_ADAPTER_REQUEST_WIFI, // - LOC_API_ADAPTER_SENSOR_STATUS, // - LOC_API_ADAPTER_REQUEST_TIME_SYNC, // - LOC_API_ADAPTER_REPORT_SPI, // - LOC_API_ADAPTER_REPORT_NI_GEOFENCE, // - LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, // - LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, // - LOC_API_ADAPTER_PEDOMETER_CTRL, // - LOC_API_ADAPTER_MOTION_CTRL, // - LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data - LOC_API_ADAPTER_BATCH_FULL, // Batching on full - LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix - LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // - LOC_API_ADAPTER_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_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_EVENT_MAX }; -#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) + if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) && + (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL)) { location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED; - location.gpsLocation.speed = location_report_ptr->speed_horizontal; + location.gpsLocation.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal + + location_report_ptr->speed_vertical * location_report_ptr->speed_vertical); } // Heading @@ -796,7 +783,7 @@ void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_re void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) { - GnssSvStatus SvStatus = {0}; + GpsSvStatus SvStatus = {0}; GpsLocationExtended locationExtended = {0}; locationExtended.size = sizeof(locationExtended); int num_svs_max = 0; @@ -822,7 +809,7 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) { if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS) { - SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo); + SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus); SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn; // We only have the data field to report gps eph and alm mask @@ -841,7 +828,7 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) { - SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); } } // SBAS: GPS RPN: 120-151, @@ -854,12 +841,6 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) // In extended measurement report, we follow nmea standard, which is 65-96 else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS) { - if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && - (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) - { - SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); - } - SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1); } // Unsupported SV system @@ -1406,9 +1387,8 @@ GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding) } LocApiBase* getLocApi(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask, - ContextBase *context) { - return new LocApiRpc(msgTask, exMask, context); + LOC_API_ADAPTER_EVENT_MASK_T exMask) { + return new LocApiRpc(msgTask, exMask); } /*Values for lock @@ -1417,12 +1397,12 @@ LocApiBase* getLocApi(const MsgTask* msgTask, 3 = Lock MT position sessions 4 = Lock all position sessions */ -int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask) +int LocApiRpc::setGpsLock(unsigned int lock) { rpc_loc_ioctl_data_u_type ioctl_data; boolean ret_val; - LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask); - ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask); + LOC_LOGD("%s:%d]: lock: %d\n", __func__, __LINE__, lock); + ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = (rpc_loc_lock_e_type)lock; ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK; ret_val = loc_eng_ioctl (loc_eng_data.client_handle, RPC_LOC_IOCTL_SET_ENGINE_LOCK, diff --git a/loc_api/libloc_api-rpc/Android.mk b/loc_api/libloc_api-rpc/Android.mk new file mode 100644 index 00000000..06e46948 --- /dev/null +++ b/loc_api/libloc_api-rpc/Android.mk @@ -0,0 +1,61 @@ +ifneq ($(BUILD_TINY_ANDROID),true) + +ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001) + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +AMSS_VERSION:=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION) +RPC_INC:=inc-$(AMSS_VERSION) + +generated_files:= \ + gen-$(AMSS_VERSION)/loc_api_clnt.c \ + gen-$(AMSS_VERSION)/loc_api_cb_xdr.c \ + gen-$(AMSS_VERSION)/loc_api_common_xdr.c \ + gen-$(AMSS_VERSION)/loc_api_cb_svc.c \ + gen-$(AMSS_VERSION)/loc_api_xdr.c \ + gen-$(AMSS_VERSION)/loc_api_fixup.c \ + gen-$(AMSS_VERSION)/loc_api_rpc_glue.c \ + src/loc_apicb_appinit.c + +LOCAL_SRC_FILES:= $(generated_files) + +# removed from library build since the client should implement this code. +# src/loc_api_cb_server.c + +LOCAL_CFLAGS:=-fno-short-enums +LOCAL_CFLAGS+=-include $(RPC_INC)/loc_api_common.h +LOCAL_CFLAGS+=-DDEBUG +# LOCAL_CFLAGS+=-DDEBUG -DVERBOSE + +LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL + +LOCAL_SHARED_LIBRARIES:= librpc +LOCAL_STATIC_LIBRARIES:= libcommondefs-rpc + + + +LOCAL_COPY_HEADERS_TO:= libloc_api-rpc/inc +LOCAL_COPY_HEADERS:= \ + $(RPC_INC)/loc_api_cb.h \ + $(RPC_INC)/loc_api_common.h \ + $(RPC_INC)/loc_api.h \ + $(RPC_INC)/loc_api_fixup.h \ + $(RPC_INC)/loc_apicb_appinit.h \ + inc/debug.h \ + inc/loc_api_rpc_glue.h + +LOCAL_C_INCLUDES:= \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/inc \ + $(LOCAL_PATH)/$(RPC_INC) \ + $(TARGET_OUT_HEADERS)/libcommondefs-rpc \ + $(TARGET_OUT_HEADERS)/librpc + +LOCAL_MODULE:= libloc_api-rpc +LOCAL_MODULE_OWNER := qcom + +include $(BUILD_STATIC_LIBRARY) + +endif +endif diff --git a/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr b/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr new file mode 100644 index 00000000..5d9cf6c8 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr @@ -0,0 +1,29 @@ +CLIENTS:= loc_api +SERVERS:= loc_api_cb +COMMON:= loc_api_common +RPC_INC:= inc-$(AMSS_VERSION) + +all: $(CLIENTS) $(SERVERS) $(COMMON) fixup + +$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr) + +$(CLIENTS) $(SERVERS) $(COMMON):: + rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@) + rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@) + +$(CLIENTS):: + rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@) + +$(SERVERS):: + rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@) + +fixup: + mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak + sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include ../$(RPC_INC)/loc_api_common.h + rm -f ../$(RPC_INC)/loc_api_common.h.bak + +clean: + rm -f $(addsuffix _clnt.c, $(CLIENTS)) + rm -f $(addsuffix _svc.c, $(SERVERS)) + rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON)) + rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON))) diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr new file mode 100644 index 00000000..a9d60aa4 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr @@ -0,0 +1,172 @@ +/* LOC_API TOOL VERSION: 4.36 */ +/*============================================================================= + L O C _ A P I . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + the loc_api API. + + --------------------------------------------------------------------------- + Copyright (c) 2010 QUALCOMM Incorporated. + All Rights Reserved. QUALCOMM Proprietary and Confidential. + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3 + +loc_api Definition File(s): +Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16 +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + +typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>; + +/* + * Declare an rpc_uint32 type for each callback type in the API + */ +typedef rpc_uint32 rpc_loc_event_cb_f_type; + + + +/* + * These are struct declarations for the function arguments + */ + +struct rpc_loc_open_args { + rpc_loc_event_mask_type event_reg_mask; + rpc_loc_event_cb_f_type event_callback; +}; + +struct rpc_loc_close_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_start_fix_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_stop_fix_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_ioctl_args { + rpc_loc_client_handle_type handle; + rpc_loc_ioctl_e_type ioctl_type; + rpc_loc_ioctl_data_u_type *ioctl_data; +}; + + + +struct rpc_loc_api_api_version_s_args { + rpc_boolean len_not_null; +}; + +/* + * These are struct declarations for the function results + */ + +struct rpc_loc_api_rpc_glue_code_info_remote_rets { + rpc_uint32 toolvers; /* Tool version */ + rpc_uint32 features; /* Features turned on in the code. + * 0x00000001 ONCRPC Server Cleanup Support + */ + rpc_uint32 proghash; /* Unique hash value for the API XDR definition */ + rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */ +}; + +struct rpc_loc_open_rets { + rpc_loc_client_handle_type loc_open_result; +}; + +struct rpc_loc_close_rets { + rpc_int32 loc_close_result; +}; + +struct rpc_loc_start_fix_rets { + rpc_int32 loc_start_fix_result; +}; + +struct rpc_loc_stop_fix_rets { + rpc_int32 loc_stop_fix_result; +}; + +struct rpc_loc_ioctl_rets { + rpc_int32 loc_ioctl_result; +}; + + struct rpc_loc_api_api_versions_rets { + rpc_loc_api_api_versions_return_type loc_api_api_versions_result; + rpc_uint32 *len; +}; + +/* + * XDR definition of the LOC_API program ( vers. 0x00040002 ) + */ + +program LOC_APIPROG { + version LOC_APIVERS_0001 { + + void + rpc_loc_api_null( void ) = 0; + + rpc_loc_api_rpc_glue_code_info_remote_rets + rpc_loc_api_rpc_glue_code_info_remote( void ) = 1; + + rpc_loc_open_rets + rpc_loc_open( rpc_loc_open_args ) = 2; + + rpc_loc_close_rets + rpc_loc_close( rpc_loc_close_args ) = 3; + + rpc_loc_start_fix_rets + rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4; + + rpc_loc_stop_fix_rets + rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5; + + rpc_loc_ioctl_rets + rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6; + + rpc_loc_api_api_versions_rets + rpc_loc_api_api_versions( void ) = 0xFFFFFFFF; + + + + + } = 0x00040001; + + + + version LOC_APIVERS_0002 { + +/* Following elements added in enum rpc_loc_ni_event_e_type in 0x00040002 +RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ +*/ + + void + rpc_loc_api_null( void ) = 0; + + } = 0x00040002; + + +} = 0x3000008c; + +const LOC_APIVERS = 0x00040002; diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr new file mode 100644 index 00000000..1bd4e151 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr @@ -0,0 +1,85 @@ +/* LOC_API TOOL VERSION: 4.36 */ +/*============================================================================= + L O C _ A P I _ C B . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + an api that represents the grouping of the different callback functions the + loc_api API supports. + + --------------------------------------------------------------------------- + Copyright (c) 2010 QUALCOMM Incorporated. + All Rights Reserved. QUALCOMM Proprietary and Confidential. + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3 + +loc_api Definition File(s): +Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16 +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + + +/* + * These are struct declarations for the function arguments + */ + +struct rpc_loc_event_cb_f_type_args { + rpc_uint32 cb_id; + rpc_loc_client_handle_type loc_handle; + rpc_loc_event_mask_type loc_event; + rpc_loc_event_payload_u_type *loc_event_payload; +}; + + + + + +/* + * These are struct declaratios for the function results + */ + +struct rpc_loc_event_cb_f_type_rets { + rpc_int32 loc_event_cb_f_type_result; +}; + + + +/* + * XDR definition of the LOC_API callback program ( vers. 0x00040002 ) + */ + +program LOC_APICBPROG { + version LOC_APICBVERS_0001 { + + rpc_loc_event_cb_f_type_rets + rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1; + + + + + } = 0x00040001; + + +} = 0x3100008c; + +const LOC_APICBVERS = 0x00040002; diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c new file mode 100644 index 00000000..52a0d15b --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c @@ -0,0 +1,64 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_cb.h" +#include +#include +#include +#include +#include +#include +#include + +#ifndef SIG_PF +#define SIG_PF void(*)(int) +#endif + +void +loc_apicbprog_0x00040001(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00040001_arg; + } argument; + union { + rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00040001_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_event_cb_f_type: + _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args; + _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00040001_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00040001_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c new file mode 100644 index 00000000..1d7795ed --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c @@ -0,0 +1,32 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_cb.h" + +bool_t +xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->cb_id)) + return FALSE; + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle)) + return FALSE; + if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result)) + return FALSE; + return TRUE; +} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c new file mode 100644 index 00000000..dca1e8d5 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c @@ -0,0 +1,91 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include /* for memset */ +#include "loc_api.h" + +/* Default timeout can be changed using clnt_control() */ +static struct timeval TIMEOUT = { 25, 0 }; + +enum clnt_stat +rpc_loc_api_null_0x00040001(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_open_0x00040001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_open, + (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_close_0x00040001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_close, + (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_start_fix, + (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_stop_fix, + (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_ioctl, + (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_api_versions_0x00040001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_api_versions, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_null_0x00040002(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr new file mode 100644 index 00000000..4e01607d --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr @@ -0,0 +1,906 @@ +/* LOC_API TOOL VERSION: 4.36 */ +/*============================================================================= + L O C _ A P I _ C O M M O N . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + an api that represents the grouping of the different callback functions the + loc_api API supports. + + --------------------------------------------------------------------------- + Copyright (c) 2010 QUALCOMM Incorporated. + All Rights Reserved. QUALCOMM Proprietary and Confidential. + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6 +Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3 + +loc_api Definition File(s): +Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16 +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + +const LOC_API_TOOLVERS = 0x00040024; +const LOC_API_FEATURES = 0x00000001; + +const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010; + +const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200; + +const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080; + +const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040; + +const RPC_LOC_EVENT_RESERVED = 0x8000000000000000; + +const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001; + +const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020; + +const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008; + +const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002; + +const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100; + +const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00040001; +const RPC_LOC_OPEN_VERSION = 0x00040001; +const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00040001; +const RPC_LOC_API_NULL_VERSION = 0x00040001; +const RPC_LOC_STOP_FIX_VERSION = 0x00040001; +const RPC_LOC_IOCTL_VERSION = 0x00040001; +const RPC_LOC_START_FIX_VERSION = 0x00040001; +const RPC_LOC_CLOSE_VERSION = 0x00040001; +const RPC_LOC_API_API_VERSIONS_VERSION = 0x00040001; +const RPC_LOC_API_API_MAJOR_NUM = 0x0004; +const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0; + +typedef bool rpc_boolean; + +typedef unsigned long rpc_uint32; + +typedef unsigned short rpc_uint16; + +typedef unsigned char rpc_uint8; + +typedef long rpc_int32; + +typedef unsigned char rpc_byte; + +typedef unsigned hyper rpc_uint64; + +typedef rpc_int32 rpc_loc_client_handle_type; + +typedef rpc_uint64 rpc_loc_event_mask_type; + +typedef rpc_uint64 rpc_loc_position_valid_mask_type; + +typedef rpc_uint32 rpc_loc_pos_technology_mask_type; + +enum rpc_loc_session_status_e_type { + RPC_LOC_SESS_STATUS_SUCCESS = 0, + RPC_LOC_SESS_STATUS_IN_PROGESS = 1, + RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, + RPC_LOC_SESS_STATUS_TIMEOUT = 3, + RPC_LOC_SESS_STATUS_USER_END = 4, + RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, + RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, + RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, + RPC_LOC_SESS_STATUS_MAX = 268435456 +}; + +struct rpc_loc_calendar_time_s_type { + rpc_uint16 year; + unsigned char month; + unsigned char day_of_week; + unsigned char day; + unsigned char hour; + unsigned char minute; + unsigned char second; + rpc_uint16 millisecond; +}; + +struct rpc_loc_parsed_position_s_type { + rpc_loc_position_valid_mask_type valid_mask; + rpc_loc_session_status_e_type session_status; + rpc_loc_calendar_time_s_type timestamp_calendar; + rpc_uint64 timestamp_utc; + rpc_uint8 leap_seconds; + float time_unc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float speed_horizontal; + float speed_vertical; + float heading; + float hor_unc_circular; + float hor_unc_ellipse_semi_major; + float hor_unc_ellipse_semi_minor; + float hor_unc_ellipse_orient_azimuth; + float vert_unc; + float speed_unc; + float heading_unc; + unsigned char confidence_horizontal; + unsigned char confidence_vertical; + float magnetic_deviation; + rpc_loc_pos_technology_mask_type technology_mask; +}; + +enum rpc_loc_sv_system_e_type { + RPC_LOC_SV_SYSTEM_GPS = 1, + RPC_LOC_SV_SYSTEM_GALILEO = 2, + RPC_LOC_SV_SYSTEM_SBAS = 3, + RPC_LOC_SV_SYSTEM_COMPASS = 4, + RPC_LOC_SV_SYSTEM_GLONASS = 5, + RPC_LOC_SV_SYSTEM_MAX = 268435456 +}; + +enum rpc_loc_sv_status_e_type { + RPC_LOC_SV_STATUS_IDLE = 1, + RPC_LOC_SV_STATUS_SEARCH = 2, + RPC_LOC_SV_STATUS_TRACK = 3, + RPC_LOC_SV_STATUS_MAX = 268435456 +}; + +typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; + +struct rpc_loc_sv_info_s_type { + rpc_loc_sv_info_valid_mask_type valid_mask; + rpc_loc_sv_system_e_type system; + rpc_uint8 prn; + rpc_uint8 health_status; + rpc_loc_sv_status_e_type process_status; + rpc_boolean has_eph; + rpc_boolean has_alm; + float elevation; + float azimuth; + float snr; +}; + +typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; + +struct rpc_loc_gnss_info_s_type { + rpc_loc_gnss_info_valid_mask_type valid_mask; + float position_dop; + float horizontal_dop; + float vertical_dop; + rpc_boolean altitude_assumed; + rpc_uint16 sv_count; + rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/ +}; + +struct rpc_loc_nmea_report_s_type { + rpc_uint16 length; + opaque nmea_sentences[1200]; /* EVAL:[1200]*/ +}; + +enum rpc_loc_status_event_e_type { + RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, + RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2, + RPC_LOC_STATUS_EVENT_MAX = 268435456 +}; + +enum rpc_loc_engine_state_e_type { + RPC_LOC_ENGINE_STATE_ON = 1, + RPC_LOC_ENGINE_STATE_OFF = 2, + RPC_LOC_ENGINE_STATE_MAX = 268435456 +}; + +enum rpc_loc_fix_session_state_e_type { + RPC_LOC_FIX_SESSION_STATE_BEGIN = 1, + RPC_LOC_FIX_SESSION_STATE_END = 2, + RPC_LOC_FIX_SESSION_STATE_MAX = 268435456 +}; + +union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + rpc_loc_engine_state_e_type engine_state; + case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: + rpc_loc_fix_session_state_e_type fix_session_state; + default: + void; +}; + +struct rpc_loc_status_event_s_type { + rpc_loc_status_event_e_type event; + rpc_loc_status_event_payload_u_type payload; +}; + +enum rpc_loc_server_addr_e_type { + RPC_LOC_SERVER_ADDR_IPV4 = 1, + RPC_LOC_SERVER_ADDR_URL = 2, + RPC_LOC_SERVER_ADDR_MAX = 268435456 +}; + +struct rpc_loc_server_addr_ipv4_type { + rpc_uint32 addr; + rpc_uint16 port; +}; + +struct rpc_loc_server_addr_url_type { + rpc_uint16 length; + opaque addr[256]; /* EVAL:[256]*/ +}; + +union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) { + case RPC_LOC_SERVER_ADDR_IPV4: + rpc_loc_server_addr_ipv4_type ipv4; + case RPC_LOC_SERVER_ADDR_URL: + rpc_loc_server_addr_url_type url; + default: + void; +}; + +struct rpc_loc_server_info_s_type { + rpc_loc_server_addr_e_type addr_type; + rpc_loc_server_addr_u_type addr_info; +}; + +enum rpc_loc_ni_notify_verify_e_type { + RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, + RPC_LOC_NI_USER_NOTIFY_ONLY = 2, + RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, + RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, + RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, + RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456 +}; + +enum rpc_loc_ni_event_e_type { + RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, + RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, + RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, + RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4, + RPC_LOC_NI_EVENT_MAX = 268435456 +}; + +enum rpc_loc_ni_datacoding_scheme_e_type { + RPC_LOC_NI_PRESUPL_ISO646IRV = 0, + RPC_LOC_NI_PRESUPL_ISO8859 = 1, + RPC_LOC_NI_PRESUPL_UTF8 = 2, + RPC_LOC_NI_PRESUPL_UTF16 = 3, + RPC_LOC_NI_PRESUPL_UCS2 = 4, + RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, + RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, + RPC_LOC_NI_PRESUPL_JIS = 7, + RPC_LOC_NI_PRESUPL_EUC = 8, + RPC_LOC_NI_PRESUPL_GB2312 = 9, + RPC_LOC_NI_PRESUPL_CNS11643 = 10, + RPC_LOC_NI_PRESUPL_KSC1001 = 11, + RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, + RPC_LOC_NI_SS_GERMAN = 12, + RPC_LOC_NI_SS_ENGLISH = 13, + RPC_LOC_NI_SS_ITALIAN = 14, + RPC_LOC_NI_SS_FRENCH = 15, + RPC_LOC_NI_SS_SPANISH = 16, + RPC_LOC_NI_SS_DUTCH = 17, + RPC_LOC_NI_SS_SWEDISH = 18, + RPC_LOC_NI_SS_DANISH = 19, + RPC_LOC_NI_SS_PORTUGUESE = 20, + RPC_LOC_NI_SS_FINNISH = 21, + RPC_LOC_NI_SS_NORWEGIAN = 22, + RPC_LOC_NI_SS_GREEK = 23, + RPC_LOC_NI_SS_TURKISH = 24, + RPC_LOC_NI_SS_HUNGARIAN = 25, + RPC_LOC_NI_SS_POLISH = 26, + RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, + RPC_LOC_NI_SUPL_UTF8 = 28, + RPC_LOC_NI_SUPL_UCS2 = 29, + RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, + RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647 +}; + +enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { + RPC_LOC_NI_VX_OCTET = 0, + RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, + RPC_LOC_NI_VX_ASCII = 2, + RPC_LOC_NI_VX_IA5 = 3, + RPC_LOC_NI_VX_UNICODE = 4, + RPC_LOC_NI_VX_SHIFT_JIS = 5, + RPC_LOC_NI_VX_KOREAN = 6, + RPC_LOC_NI_VX_LATIN_HEBREW = 7, + RPC_LOC_NI_VX_LATIN = 8, + RPC_LOC_NI_VX_GSM = 9, + RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456 +}; + +enum rpc_loc_ni_vx_pos_mode_e_type { + RPC_LOC_VX_MS_ASSISTED_ONLY = 1, + RPC_LOC_VX_MS_BASED_ONLY = 2, + RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, + RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, + RPC_LOC_VX_POS_MODE_MAX = 268435456 +}; + +struct rpc_loc_ni_vx_requester_id_s_type { + unsigned char requester_id_length; + opaque requester_id[200]; /* EVAL:[200]*/ +}; + +struct rpc_loc_ni_vx_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + unsigned char pos_qos_incl; + unsigned char pos_qos; + rpc_uint32 num_fixes; + rpc_uint32 tbf; + rpc_loc_ni_vx_pos_mode_e_type pos_mode; + rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; + rpc_loc_ni_vx_requester_id_s_type requester_id; + rpc_uint16 user_resp_timer_val; +}; + +enum rpc_loc_ni_supl_pos_method_e_type { + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, + RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, + RPC_LOC_NI_POSMETHOD_AFLT = 6, + RPC_LOC_NI_POSMETHOD_ECID = 7, + RPC_LOC_NI_POSMETHOD_EOTD = 8, + RPC_LOC_NI_POSMETHOD_OTDOA = 9, + RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, + RPC_LOC_NI_POSMETHOD_MAX = 268435456 +}; + +struct rpc_loc_ni_supl_slp_session_id_s_type { + unsigned char presence; + opaque session_id[4]; /* EVAL:[4]*/ + rpc_loc_server_info_s_type slp_address; +}; + +struct rpc_loc_ni_requestor_id_s_type { + unsigned char data_coding_scheme; + opaque requestor_id_string[200]; /* EVAL:[200]*/ + unsigned char string_len; +}; + +struct rpc_loc_ni_supl_client_name_s_type { + unsigned char data_coding_scheme; + opaque client_name_string[64]; /* EVAL:[64]*/ + unsigned char string_len; +}; + +struct rpc_loc_ni_supl_qop_s_type { + unsigned char bit_mask; + unsigned char horacc; + unsigned char veracc; + rpc_uint16 maxLocAge; + unsigned char delay; +}; + +struct rpc_loc_ni_supl_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + rpc_uint16 flags; + rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; + opaque supl_hash[8]; /* EVAL:[8]*/ + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_supl_pos_method_e_type pos_method; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_supl_client_name_s_type client_name; + rpc_loc_ni_supl_qop_s_type supl_qop; + rpc_uint16 user_response_timer; +}; + +struct rpc_loc_ni_ext_client_address_s_type { + unsigned char ext_client_address_len; + opaque ext_client_address[20]; /* EVAL:[20]*/ +}; + +enum rpc_loc_ni_location_type_e_type { + RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, + RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, + RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, + RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456 +}; + +struct rpc_loc_ni_deferred_location_s_type { + unsigned char unused_bits; + unsigned char ms_available; +}; + +struct rpc_loc_ni_codeword_string_s_type { + unsigned char data_coding_scheme; + opaque lcs_codeword_string[20]; /* EVAL:[20]*/ + unsigned char string_len; +}; + +struct rpc_loc_ni_service_type_id_s_type { + unsigned char lcs_service_type_id; +}; + +struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + unsigned char invoke_id; + rpc_uint16 flags; + unsigned char notification_length; + opaque notification_text[64]; /* EVAL:[64]*/ + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_ext_client_address_s_type ext_client_address_data; + rpc_loc_ni_location_type_e_type location_type; + rpc_loc_ni_deferred_location_s_type deferred_location; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_codeword_string_s_type codeword_string; + rpc_loc_ni_service_type_id_s_type service_type_id; + rpc_uint16 user_response_timer; +}; + +enum rpc_loc_ni_service_interaction_e_type { + RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1, + RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456 +}; + +struct rpc_loc_ni_vx_service_interaction_req_s_type { + rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req; + rpc_loc_ni_service_interaction_e_type service_interation_type; +}; + +union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + rpc_loc_ni_vx_notify_verify_req_s_type vx_req; + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + rpc_loc_ni_supl_notify_verify_req_s_type supl_req; + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; + case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ: + rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req; + default: + void; +}; + +struct rpc_loc_ni_event_s_type { + rpc_loc_ni_event_e_type event; + rpc_loc_ni_event_payload_u_type payload; +}; + +enum rpc_loc_assist_data_request_e_type { + RPC_LOC_ASSIST_DATA_TIME_REQ = 1, + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, + RPC_LOC_ASSIST_DATA_MAX = 268435456 +}; + + typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/ + + typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; /* EVAL:[3]*/ + +struct rpc_loc_time_download_source_s_type { + rpc_uint32 delay_threshold; + rpc_struct_loc_time_download_source_s_type_servers servers; +}; + + typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/ + + typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; /* EVAL:[3]*/ + +struct rpc_loc_predicted_orbits_data_source_s_type { + rpc_uint32 max_file_size; + rpc_uint32 max_part_size; + rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; +}; + +union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) { + case RPC_LOC_ASSIST_DATA_TIME_REQ: + rpc_loc_time_download_source_s_type time_download; + case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: + rpc_loc_predicted_orbits_data_source_s_type data_download; + default: + void; +}; + +struct rpc_loc_assist_data_request_s_type { + rpc_loc_assist_data_request_e_type event; + rpc_loc_assist_data_request_payload_u_type payload; +}; + +typedef rpc_uint32 rpc_loc_server_connection_handle; + +enum rpc_loc_server_protocol_e_type { + RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, + RPC_LOC_SERVER_PROTOCOL_SUPL = 1, + RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, + RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, + RPC_LOC_SERVER_PROTOCOL_MAX = 16777216 +}; + +enum rpc_loc_server_request_e_type { + RPC_LOC_SERVER_REQUEST_OPEN = 1, + RPC_LOC_SERVER_REQUEST_CLOSE = 2, + RPC_LOC_SERVER_REQUEST_MAX = 268435456 +}; + +struct rpc_loc_server_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; +}; + +struct rpc_loc_server_close_req_s_type { + rpc_loc_server_connection_handle conn_handle; +}; + +union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) { + case RPC_LOC_SERVER_REQUEST_OPEN: + rpc_loc_server_open_req_s_type open_req; + case RPC_LOC_SERVER_REQUEST_CLOSE: + rpc_loc_server_close_req_s_type close_req; + default: + void; +}; + +struct rpc_loc_server_request_s_type { + rpc_loc_server_request_e_type event; + rpc_loc_server_request_u_type payload; +}; + +enum rpc_loc_qwip_request_e_type { + RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0, + RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM, + RPC_LOC_QWIP_STOP_PERIODIC_FIXES, + RPC_LOC_QWIP_SUSPEND, + RPC_LOC_QWIP_REQUEST_MAX = 268435456 +}; + +struct rpc_loc_qwip_request_s_type { + rpc_loc_qwip_request_e_type request_type; + rpc_uint16 tbf_ms; +}; + +struct rpc_loc_reserved_payload_s_type { + rpc_uint16 data_size; + opaque data<>; +}; + +enum rpc_loc_ioctl_e_type { + RPC_LOC_IOCTL_GET_API_VERSION = 1, + RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, + RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, + RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, + RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, + RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, + RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, + RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, + RPC_LOC_IOCTL_INJECT_POSITION = 407, + RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, + RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, + RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, + RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411, + RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412, + RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413, + RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, + RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, + RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, + RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, + RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, + RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, + RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, + RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, + RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, + RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, + RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, + RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, + RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, + RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, + RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, + RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, + RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, + RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, + RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824 +}; + +struct rpc_loc_api_version_s_type { + unsigned char major; + unsigned char minor; +}; + +enum rpc_loc_fix_recurrence_e_type { + RPC_LOC_PERIODIC_FIX = 1, + RPC_LOC_SINGLE_FIX = 2, + RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456 +}; + +enum rpc_loc_operation_mode_e_type { + RPC_LOC_OPER_MODE_DEFAULT = 1, + RPC_LOC_OPER_MODE_MSB = 2, + RPC_LOC_OPER_MODE_MSA = 3, + RPC_LOC_OPER_MODE_STANDALONE = 4, + RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, + RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, + RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, + RPC_LOC_OPER_MODE_CELL_ID = 8, + RPC_LOC_OPER_MODE_MAX = 268435456 +}; + +enum rpc_loc_notify_e_type { + RPC_LOC_NOTIFY_ON_INTERVAL = 1, + RPC_LOC_NOTIFY_ON_DISTANCE = 2, + RPC_LOC_NOTIFY_ON_ANY = 3, + RPC_LOC_NOTIFY_ON_ALL = 4, + RPC_LOC_NOTIFY_TYPE_MAX = 268435456 +}; + +struct rpc_loc_fix_criteria_s_type { + rpc_uint32 valid_mask; + rpc_loc_fix_recurrence_e_type recurrence_type; + rpc_loc_operation_mode_e_type preferred_operation_mode; + rpc_uint32 preferred_accuracy; + rpc_uint32 preferred_response_time; + rpc_boolean intermediate_pos_report_enabled; + rpc_loc_notify_e_type notify_type; + rpc_uint32 min_interval; + float min_distance; + rpc_uint32 min_dist_sample_interval; +}; + +enum rpc_loc_ni_user_resp_e_type { + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456 +}; + +struct rpc_loc_user_verify_s_type { + rpc_loc_ni_user_resp_e_type user_resp; + rpc_loc_ni_event_s_type ni_event_pass_back; +}; + +enum rpc_loc_predicted_orbits_data_format_e_type { + RPC_LOC_PREDICTED_ORBITS_XTRA = 0, + RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456 +}; + +struct rpc_loc_predicted_orbits_data_s_type { + rpc_loc_predicted_orbits_data_format_e_type format_type; + rpc_uint32 total_size; + rpc_uint8 total_parts; + rpc_uint8 part; + rpc_uint16 part_len; + opaque data_ptr<>; +}; + +struct rpc_loc_predicted_orbits_data_validity_report_s_type { + rpc_uint64 start_time_utc; + rpc_uint16 valid_duration_hrs; +}; + +struct rpc_loc_predicted_orbits_auto_download_config_s_type { + rpc_boolean enable; + unsigned char auto_check_every_hrs; +}; + +struct rpc_loc_assist_data_time_s_type { + rpc_uint64 time_utc; + rpc_uint32 uncertainty; +}; + +typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; + +struct rpc_loc_assist_data_pos_s_type { + rpc_loc_assist_pos_valid_mask_type valid_mask; + rpc_uint64 timestamp_utc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float hor_unc_circular; + float vert_unc; + unsigned char confidence_horizontal; + unsigned char confidence_vertical; + rpc_int32 timestamp_age; +}; + +enum rpc_loc_server_open_status_e_type { + RPC_LOC_SERVER_OPEN_SUCCESS = 1, + RPC_LOC_SERVER_OPEN_FAIL = 2, + RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456 +}; + +struct rpc_loc_server_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + opaque apn_name[100]; /* EVAL:[100]*/ +}; + +enum rpc_loc_server_close_status_e_type { + RPC_LOC_SERVER_CLOSE_SUCCESS = 1, + RPC_LOC_SERVER_CLOSE_FAIL = 2, + RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456 +}; + +struct rpc_loc_server_close_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_close_status_e_type close_status; +}; + +struct rpc_loc_wiper_fix_time_s_type { + rpc_uint32 slow_clock_count; +}; + +struct rpc_loc_wiper_fix_pos_s_type { + rpc_int32 lat; + rpc_int32 lon; + rpc_uint16 HEPE; + rpc_uint8 num_of_aps_used; + rpc_uint8 fix_error_code; +}; + +struct rpc_loc_wiper_ap_info_s_type { + opaque mac_addr[6]; /* EVAL:[6]*/ + rpc_int32 rssi; + rpc_uint16 channel; + rpc_uint8 ap_qualifier; +}; + +struct rpc_loc_wiper_ap_set_s_type { + rpc_uint8 num_of_aps; + rpc_loc_wiper_ap_info_s_type ap_info[50]; /* EVAL:[50]*/ +}; + +struct rpc_loc_wiper_position_report_s_type { + rpc_uint8 wiper_valid_info_flag; + rpc_loc_wiper_fix_time_s_type wiper_fix_time; + rpc_loc_wiper_fix_pos_s_type wiper_fix_position; + rpc_loc_wiper_ap_set_s_type wiper_ap_set; +}; + +enum rpc_loc_wiper_status_e_type { + RPC_LOC_WIPER_STATUS_AVAILABLE = 1, + RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2, + RPC_LOC_WIPER_STATUS_E_SIZE = 268435456 +}; + +enum rpc_loc_fs_operation_e_type { + RPC_LOC_FS_CREATE_WRITE_FILE = 1, + RPC_LOC_FS_APPEND_FILE = 2, + RPC_LOC_FS_DELETE_FILE = 3, + RPC_LOC_FS_READ_FILE = 4, + RPC_LOC_FS_MAX = 268435456 +}; + +struct rpc_loc_efs_data_s_type { + opaque filename[64]; /* EVAL:[64]*/ + rpc_loc_fs_operation_e_type operation; + rpc_uint32 total_size; + opaque data_ptr<>; + rpc_uint32 part_len; + rpc_uint8 part; + rpc_uint8 total_parts; + rpc_uint32 reserved; +}; + +enum rpc_loc_lock_e_type { + RPC_LOC_LOCK_NONE = 1, + RPC_LOC_LOCK_MI = 2, + RPC_LOC_LOCK_MT = 3, + RPC_LOC_LOCK_ALL = 4, + RPC_LOC_LOCK_MAX = 268435456 +}; + +typedef rpc_uint32 rpc_loc_nmea_sentence_type; + +typedef rpc_uint32 rpc_loc_assist_data_type; + +struct rpc_loc_assist_data_delete_s_type { + rpc_loc_assist_data_type type; + rpc_uint32 reserved[8]; /* EVAL:[8]*/ +}; + +union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) { + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + rpc_loc_fix_criteria_s_type fix_criteria; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + rpc_loc_user_verify_s_type user_verify_resp; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + rpc_loc_assist_data_time_s_type assistance_data_time; + case RPC_LOC_IOCTL_INJECT_POSITION: + rpc_loc_assist_data_pos_s_type assistance_data_position; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + rpc_loc_server_open_status_s_type conn_open_status; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + rpc_loc_server_close_status_s_type conn_close_status; + case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT: + rpc_loc_wiper_position_report_s_type wiper_pos; + case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS: + rpc_loc_wiper_status_e_type wiper_status; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + rpc_loc_lock_e_type engine_lock; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + rpc_boolean sbas_mode; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + rpc_loc_nmea_sentence_type nmea_types; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + rpc_boolean on_demand_lpm; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + rpc_loc_server_info_s_type server_addr; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + rpc_loc_assist_data_delete_s_type assist_data_delete; + case RPC_LOC_IOCTL_ACCESS_EFS_DATA: + rpc_loc_efs_data_s_type efs_data; + default: + void; +}; + +union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) { + case RPC_LOC_IOCTL_GET_API_VERSION: + rpc_loc_api_version_s_type api_version; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + rpc_loc_fix_criteria_s_type fix_criteria; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + rpc_loc_lock_e_type engine_lock; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + rpc_boolean sbas_mode; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + rpc_loc_nmea_sentence_type nmea_types; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + rpc_boolean on_demand_lpm; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + rpc_loc_server_info_s_type server_addr; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; + default: + void; +}; + +struct rpc_loc_ioctl_callback_s_type { + rpc_loc_ioctl_e_type type; + rpc_int32 status; + rpc_loc_ioctl_callback_data_u_type data; +}; + +union rpc_loc_event_payload_u_type switch (unsigned hyper disc) { + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + rpc_loc_parsed_position_s_type parsed_location_report; + case RPC_LOC_EVENT_SATELLITE_REPORT: + rpc_loc_gnss_info_s_type gnss_report; + case RPC_LOC_EVENT_NMEA_POSITION_REPORT: + rpc_loc_nmea_report_s_type nmea_report; + case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: + rpc_loc_ni_event_s_type ni_request; + case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: + rpc_loc_assist_data_request_s_type assist_data_request; + case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: + rpc_loc_server_request_s_type loc_server_request; + case RPC_LOC_EVENT_IOCTL_REPORT: + rpc_loc_ioctl_callback_s_type ioctl_report; + case RPC_LOC_EVENT_STATUS_REPORT: + rpc_loc_status_event_s_type status_report; + case RPC_LOC_EVENT_WPS_NEEDED_REQUEST: + rpc_loc_qwip_request_s_type qwip_request; + case RPC_LOC_EVENT_RESERVED: + rpc_loc_reserved_payload_s_type reserved; + default: + void; +}; + diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c new file mode 100644 index 00000000..7c860bf3 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c @@ -0,0 +1,1650 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_common.h" + +bool_t +xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp) +{ + register int32_t *buf; + + if (!xdr_bool (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp) +{ + register int32_t *buf; + + if (!xdr_u_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp) +{ + register int32_t *buf; + + if (!xdr_u_short (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp) +{ + register int32_t *buf; + + if (!xdr_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_byte (XDR *xdrs, rpc_byte *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp) +{ + register int32_t *buf; + + if (!xdr_u_quad_t (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->year)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->month)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->day_of_week)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->day)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->hour)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->minute)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->second)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->millisecond)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status)) + return FALSE; + if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds)) + return FALSE; + if (!xdr_float (xdrs, &objp->time_unc)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_horizontal)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_vertical)) + return FALSE; + if (!xdr_float (xdrs, &objp->heading)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_circular)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth)) + return FALSE; + if (!xdr_float (xdrs, &objp->vert_unc)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_unc)) + return FALSE; + if (!xdr_float (xdrs, &objp->heading_unc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_vertical)) + return FALSE; + if (!xdr_float (xdrs, &objp->magnetic_deviation)) + return FALSE; + if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->prn)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->health_status)) + return FALSE; + if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->has_eph)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->has_alm)) + return FALSE; + if (!xdr_float (xdrs, &objp->elevation)) + return FALSE; + if (!xdr_float (xdrs, &objp->azimuth)) + return FALSE; + if (!xdr_float (xdrs, &objp->snr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_float (xdrs, &objp->position_dop)) + return FALSE; + if (!xdr_float (xdrs, &objp->horizontal_dop)) + return FALSE; + if (!xdr_float (xdrs, &objp->vertical_dop)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->sv_count)) + return FALSE; + if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80, + sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint16 (xdrs, &objp->length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->nmea_sentences, 1200)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state)) + return FALSE; + break; + case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: + if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->addr)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->port)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint16 (xdrs, &objp->length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->addr, 256)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_SERVER_ADDR_IPV4: + if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4)) + return FALSE; + break; + case RPC_LOC_SERVER_ADDR_URL: + if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type)) + return FALSE; + if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->requester_id_length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->requester_id, 200)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->pos_qos_incl)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->pos_qos)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->tbf)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->presence)) + return FALSE; + if (!xdr_opaque (xdrs, objp->session_id, 4)) + return FALSE; + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_opaque (xdrs, objp->requestor_id_string, 200)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_opaque (xdrs, objp->client_name_string, 64)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->bit_mask)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->horacc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->veracc)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->delay)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id)) + return FALSE; + if (!xdr_opaque (xdrs, objp->supl_hash, 8)) + return FALSE; + if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method)) + return FALSE; + if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->ext_client_address_len)) + return FALSE; + if (!xdr_opaque (xdrs, objp->ext_client_address, 20)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->unused_bits)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->ms_available)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->lcs_service_type_id)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->invoke_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->notification_length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->notification_text, 64)) + return FALSE; + if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data)) + return FALSE; + if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type)) + return FALSE; + if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location)) + return FALSE; + if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) + return FALSE; + if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string)) + return FALSE; + if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req)) + return FALSE; + if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ: + if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp) +{ + register int32_t *buf; + + if (!xdr_string (xdrs, objp, 256)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp) +{ + register int32_t *buf; + + if (!xdr_vector (xdrs, (char *)objp, 3, + sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold)) + return FALSE; + if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp) +{ + register int32_t *buf; + + if (!xdr_string (xdrs, objp, 256)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp) +{ + register int32_t *buf; + + if (!xdr_vector (xdrs, (char *)objp, 3, + sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size)) + return FALSE; + if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_ASSIST_DATA_TIME_REQ: + if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download)) + return FALSE; + break; + case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: + if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_SERVER_REQUEST_OPEN: + if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req)) + return FALSE; + break; + case RPC_LOC_SERVER_REQUEST_CLOSE: + if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->data_size)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->major)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->minor)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type)) + return FALSE; + if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled)) + return FALSE; + if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->min_interval)) + return FALSE; + if (!xdr_float (xdrs, &objp->min_distance)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp)) + return FALSE; + if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->part)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->part_len)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_boolean (xdrs, &objp->enable)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, &objp->time_utc)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_circular)) + return FALSE; + if (!xdr_float (xdrs, &objp->vert_unc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_vertical)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status)) + return FALSE; + if (!xdr_opaque (xdrs, objp->apn_name, 100)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->lat)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->lon)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->HEPE)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_opaque (xdrs, objp->mac_addr, 6)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->rssi)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->channel)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->ap_info, 50, + sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag)) + return FALSE; + if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time)) + return FALSE; + if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position)) + return FALSE; + if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_opaque (xdrs, objp->filename, 64)) + return FALSE; + if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->part_len)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->part)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->reserved)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->reserved, 8, + sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_POSITION: + if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT: + if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos)) + return FALSE; + break; + case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS: + if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr)) + return FALSE; + break; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete)) + return FALSE; + break; + case RPC_LOC_IOCTL_ACCESS_EFS_DATA: + if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_IOCTL_GET_API_VERSION: + if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr)) + return FALSE; + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source)) + return FALSE; + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->status)) + return FALSE; + if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_quad_t (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report)) + return FALSE; + break; + case RPC_LOC_EVENT_SATELLITE_REPORT: + if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report)) + return FALSE; + break; + case RPC_LOC_EVENT_NMEA_POSITION_REPORT: + if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report)) + return FALSE; + break; + case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: + if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request)) + return FALSE; + break; + case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: + if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request)) + return FALSE; + break; + case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: + if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request)) + return FALSE; + break; + case RPC_LOC_EVENT_IOCTL_REPORT: + if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report)) + return FALSE; + break; + case RPC_LOC_EVENT_STATUS_REPORT: + if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report)) + return FALSE; + break; + case RPC_LOC_EVENT_WPS_NEEDED_REQUEST: + if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request)) + return FALSE; + break; + case RPC_LOC_EVENT_RESERVED: + if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved)) + return FALSE; + break; + default: + break; + } + return TRUE; +} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c new file mode 100644 index 00000000..fe512f5d --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c @@ -0,0 +1,48 @@ +/*============================================================================= + L O C _ A P I _ F I X U P . C + +GENERAL DESCRIPTION + This file adds API constants that are not automatically transmitted to + the RPC stubs, and it also fixes other RPC-related problems. + + --------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --------------------------------------------------------------------------- +=============================================================================*/ + +#include + +#include "loc_api_fixup.h" + +#ifdef ADD_XDR_FLOAT + +int +xdr_float(xdrp, fp) + XDR *xdrp; + float *fp; +{ + return xdr_long(xdrp, (long*)fp); +} + +int +xdr_double(xdrp, dp) + XDR *xdrp; + double *dp; +{ + return xdr_long(xdrp, (long*)dp + 1) + && xdr_long(xdrp, (long*)dp); +} + +#endif /* ADD_XDR_FLOAT */ diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c new file mode 100644 index 00000000..fbaca8b6 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c @@ -0,0 +1,339 @@ +/****************************************************************************** + @file loc_api_rpc_glue.c + @brief Android Loc API glue code using rpcgen. + + DESCRIPTION + Loc API glue code for Android + + ----------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ----------------------------------------------------------------------------- + ******************************************************************************/ +/*===================================================================== + EDIT HISTORY FOR MODULE + + This section contains comments describing changes made to the module. + Notice that changes are listed in reverse chronological order. + +when who what, where, why +-------- --- ------------------------------------------------------- +03/05/2009 dx Initial version + +======================================================================*/ +/*===================================================================== + + INCLUDE FILES FOR MODULE + +======================================================================*/ +//#define LOG_NDDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Include RPC headers */ +#include "loc_api_rpc_glue.h" + +/* Callback init */ +#include "loc_apicb_appinit.h" + +/* Logging */ +#define LOG_TAG "lib_api_rpc_glue" +#include + +/* Comment this out to enable logging */ +#undef LOGD +#define LOGD(...) {} + +/*===================================================================== + External declarations +======================================================================*/ + +CLIENT* loc_api_clnt = NULL; + +/* Callback ID and pointer */ +#define LOC_API_CB_ID 1 +loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */ + +#define RPC_FUNC_VERSION_BASE(a,b) a ## b +#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b) + +#define LOC_GLUE_CHECK_INIT(ret_type) \ + if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } + +#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \ + if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } + +/* Callback functions */ +/* Returns 1 if successful */ +bool_t rpc_loc_event_cb_f_type_0x00040001_svc( + rpc_loc_event_cb_f_type_args *argp, + rpc_loc_event_cb_f_type_rets *ret, + struct svc_req *req) +{ + /* Callback not registered, or unexpected ID (shouldn't happen) */ + if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID) + { + LOGD("Warning: No callback handler.\n"); + ret->loc_event_cb_f_type_result = 0; + return 1; /* simply return */ + } + + LOGD("proc: %x prog: %x vers: %x\n", + (int) req->rq_proc, + (int) req->rq_prog, + (int) req->rq_vers); + + LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n", + (int) argp->loc_event, + (int) argp->loc_handle, + (int) ret); + + /* Forward callback to real callback procedure */ + rpc_loc_client_handle_type loc_handle = argp->loc_handle; + rpc_loc_event_mask_type loc_event = argp->loc_event; + const rpc_loc_event_payload_u_type* loc_event_payload = + (const rpc_loc_event_payload_u_type*) argp->loc_event_payload; + + int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload); + ret->loc_event_cb_f_type_result = rc; + + return 1; /* ok */ +} + +int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) +{ + xdr_free (xdr_result, result); + + /* + * Insert additional freeing code here, if needed + */ + // LOGD("***** loc_apicbprog_freeresult\n"); + + return 1; +} + +int loc_apicbprog_0x00040001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) +{ + return loc_apicbprog_freeresult (transp, xdr_result, result); +} + +/*=========================================================================== + +FUNCTION loc_api_glue_init + +DESCRIPTION + Initiates the RPC client + +RETURN VALUE + 1 for success + 0 for failure + +===========================================================================*/ +int loc_api_glue_init(void) +{ + if (loc_api_clnt == NULL) + { + /* Print msg */ + LOGD("Trying to create RPC client...\n"); + loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL); + LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt); + + if (loc_api_clnt == NULL) + { + fprintf(stderr, "Error: cannot create RPC client.\n"); + return 0; + } + + /* Init RPC callbacks */ + int rc = loc_apicb_app_init(); + if (rc >= 0) + { + LOGD("Loc API callback initialized.\n"); + } else { + fprintf(stderr, "Loc API callback initialization failed.\n"); + return 0; + } + } + + return 1; +} + +rpc_loc_client_handle_type loc_open ( + rpc_loc_event_mask_type event_reg_mask, + loc_event_cb_f_type *event_callback + ) +{ + LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type); + + rpc_loc_open_args args; + args.event_reg_mask = event_reg_mask; + args.event_callback = LOC_API_CB_ID; + loc_api_saved_cb = event_callback; + + rpc_loc_open_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_open_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (rpc_loc_client_handle_type) rets.loc_open_result; +} + +int32 loc_close(rpc_loc_client_handle_type handle) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_close_args args; + args.handle = handle; + + rpc_loc_close_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_close_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_close_result; +} + +int32 loc_start_fix(rpc_loc_client_handle_type handle) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_start_fix_args args; + args.handle = handle; + + rpc_loc_start_fix_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_start_fix_result; +} + +int32 loc_stop_fix(rpc_loc_client_handle_type handle) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_stop_fix_args args; + args.handle = handle; + + rpc_loc_stop_fix_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_stop_fix_result; +} + +int32 loc_ioctl( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data + ) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_ioctl_args args; + args.handle = handle; + args.ioctl_data = ioctl_data; + args.ioctl_type = ioctl_type; + if (ioctl_data != NULL) + { + /* Assign ioctl union discriminator */ + ioctl_data->disc = ioctl_type; + + /* In case the user hasn't filled in other disc fields, + automatically fill them in here */ + switch (ioctl_type) + { + case RPC_LOC_IOCTL_GET_API_VERSION: + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + case RPC_LOC_IOCTL_INJECT_RTC_VALUE: + case RPC_LOC_IOCTL_INJECT_POSITION: + case RPC_LOC_IOCTL_QUERY_ENGINE_STATE: + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + break; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc = + args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type; + break; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + break; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + default: + break; + } /* switch */ + } /* ioctl_data != NULL */ + + rpc_loc_ioctl_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_ioctl_result; +} + +/* Returns 0 if error */ +int32 loc_api_null(void) +{ + LOC_GLUE_CHECK_INIT(int32); + + int32 rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets; +} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c new file mode 100644 index 00000000..835f6b18 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c @@ -0,0 +1,171 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api.h" + +bool_t +xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp) +{ + register int32_t *buf; + + if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0, + sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask)) + return FALSE; + if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_boolean (xdrs, &objp->len_not_null)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->toolvers)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->features)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->proghash)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} diff --git a/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr b/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr new file mode 100644 index 00000000..5d9cf6c8 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr @@ -0,0 +1,29 @@ +CLIENTS:= loc_api +SERVERS:= loc_api_cb +COMMON:= loc_api_common +RPC_INC:= inc-$(AMSS_VERSION) + +all: $(CLIENTS) $(SERVERS) $(COMMON) fixup + +$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr) + +$(CLIENTS) $(SERVERS) $(COMMON):: + rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@) + rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@) + +$(CLIENTS):: + rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@) + +$(SERVERS):: + rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@) + +fixup: + mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak + sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include ../$(RPC_INC)/loc_api_common.h + rm -f ../$(RPC_INC)/loc_api_common.h.bak + +clean: + rm -f $(addsuffix _clnt.c, $(CLIENTS)) + rm -f $(addsuffix _svc.c, $(SERVERS)) + rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON)) + rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON))) diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr new file mode 100644 index 00000000..981266b3 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr @@ -0,0 +1,164 @@ +/* LOC_API TOOL VERSION: 3.28 */ +/*============================================================================= + L O C _ A P I . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + the loc_api API. + + --------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 + +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + +typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>; + +/* + * Declare an rpc_uint32 type for each callback type in the API + */ +typedef rpc_uint32 rpc_loc_event_cb_f_type; + + + +/* + * These are struct declarations for the function arguments + */ + +struct rpc_loc_open_args { + rpc_loc_event_mask_type event_reg_mask; + rpc_loc_event_cb_f_type event_callback; +}; + +struct rpc_loc_close_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_start_fix_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_stop_fix_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_ioctl_args { + rpc_loc_client_handle_type handle; + rpc_loc_ioctl_e_type ioctl_type; + rpc_loc_ioctl_data_u_type *ioctl_data; +}; + + + +struct rpc_loc_api_api_version_s_args { + rpc_boolean len_not_null; +}; + +/* + * These are struct declarations for the function results + */ + +struct rpc_loc_api_rpc_glue_code_info_remote_rets { + rpc_uint32 toolvers; /* Tool version */ + rpc_uint32 features; /* Features turned on in the code. + * 0x00000001 ONCRPC Server Cleanup Support + */ + rpc_uint32 proghash; /* Unique hash value for the API XDR definition */ + rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */ +}; + +struct rpc_loc_open_rets { + rpc_loc_client_handle_type loc_open_result; +}; + +struct rpc_loc_close_rets { + rpc_int32 loc_close_result; +}; + +struct rpc_loc_start_fix_rets { + rpc_int32 loc_start_fix_result; +}; + +struct rpc_loc_stop_fix_rets { + rpc_int32 loc_stop_fix_result; +}; + +struct rpc_loc_ioctl_rets { + rpc_int32 loc_ioctl_result; +}; + + struct rpc_loc_api_api_versions_rets { + rpc_loc_api_api_versions_return_type loc_api_api_versions_result; + rpc_uint32 *len; +}; + +/* + * XDR definition of the LOC_API program ( vers. 0x00010001 ) + */ + +program LOC_APIPROG { + version LOC_APIVERS_0001 { + + void + rpc_loc_api_null( void ) = 0; + + rpc_loc_api_rpc_glue_code_info_remote_rets + rpc_loc_api_rpc_glue_code_info_remote( void ) = 1; + + rpc_loc_open_rets + rpc_loc_open( rpc_loc_open_args ) = 2; + + rpc_loc_close_rets + rpc_loc_close( rpc_loc_close_args ) = 3; + + rpc_loc_start_fix_rets + rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4; + + rpc_loc_stop_fix_rets + rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5; + + rpc_loc_ioctl_rets + rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6; + + rpc_loc_api_api_versions_rets + rpc_loc_api_api_versions( void ) = 0xFFFFFFFF; + + + } = 0x00010001; +} = 0x3000008c; + +const LOC_APIVERS = 0x00010001; diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr new file mode 100644 index 00000000..3f53504b --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr @@ -0,0 +1,90 @@ +/* LOC_API TOOL VERSION: 3.28 */ +/*============================================================================= + L O C _ A P I _ C B . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + an api that represents the grouping of the different callback functions the + loc_api API supports. + + --------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 + +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + + +/* + * These are struct declarations for the function arguments + */ + +struct rpc_loc_event_cb_f_type_args { + rpc_uint32 cb_id; + rpc_loc_client_handle_type loc_handle; + rpc_loc_event_mask_type loc_event; + rpc_loc_event_payload_u_type *loc_event_payload; +}; + + + + + +/* + * These are struct declaratios for the function results + */ + +struct rpc_loc_event_cb_f_type_rets { + rpc_int32 loc_event_cb_f_type_result; +}; + + + +/* + * XDR definition of the LOC_API callback program ( vers. 0x00010001 ) + */ + +program LOC_APICBPROG { + version LOC_APICBVERS_0001 { + + rpc_loc_event_cb_f_type_rets + rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1; + + + } = 0x00010001; +} = 0x3100008c; + +const LOC_APICBVERS = 0x00010001; diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c new file mode 100644 index 00000000..b1aa1998 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c @@ -0,0 +1,64 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_cb.h" +#include +#include +#include +#include +#include +#include +#include + +#ifndef SIG_PF +#define SIG_PF void(*)(int) +#endif + +void +loc_apicbprog_0x00010001(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00010001_arg; + } argument; + union { + rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00010001_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_event_cb_f_type: + _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args; + _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00010001_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00010001_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c new file mode 100644 index 00000000..1d7795ed --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c @@ -0,0 +1,32 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_cb.h" + +bool_t +xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->cb_id)) + return FALSE; + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle)) + return FALSE; + if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result)) + return FALSE; + return TRUE; +} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c new file mode 100644 index 00000000..79814d42 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c @@ -0,0 +1,82 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include /* for memset */ +#include "loc_api.h" + +/* Default timeout can be changed using clnt_control() */ +static struct timeval TIMEOUT = { 25, 0 }; + +enum clnt_stat +rpc_loc_api_null_0x00010001(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_open_0x00010001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_open, + (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_close_0x00010001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_close, + (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_start_fix, + (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_stop_fix, + (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_ioctl, + (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_api_versions_0x00010001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_api_versions, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res, + TIMEOUT)); +} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr new file mode 100644 index 00000000..7ef6357c --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr @@ -0,0 +1,803 @@ +/* LOC_API TOOL VERSION: 3.28 */ +/*============================================================================= + L O C _ A P I _ C O M M O N . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + an api that represents the grouping of the different callback functions the + loc_api API supports. + + --------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 +Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 + +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + + +const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010; + +const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080; + +const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040; + +const RPC_LOC_EVENT_RESERVED = 0x8000000000000000; + +const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001; + +const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020; + +const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008; + +const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002; + +const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100; + +const RPC_LOC_OPEN_VERSION = 0x00010001; +const RPC_LOC_CLOSE_VERSION = 0x00010001; +const RPC_LOC_START_FIX_VERSION = 0x00010001; +const RPC_LOC_STOP_FIX_VERSION = 0x00010001; +const RPC_LOC_IOCTL_VERSION = 0x00010001; +const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00010001; +const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0; +const RPC_LOC_API_API_MAJOR_NUM = 0x0001; +typedef bool rpc_boolean; +typedef unsigned long rpc_uint32; + +typedef unsigned short rpc_uint16; + +typedef unsigned char rpc_uint8; + +typedef long rpc_int32; + +typedef unsigned char rpc_byte; + +typedef unsigned hyper rpc_uint64; + +typedef rpc_int32 rpc_loc_client_handle_type; + +typedef rpc_uint64 rpc_loc_event_mask_type; + +typedef rpc_uint64 rpc_loc_position_valid_mask_type; + +typedef rpc_uint32 rpc_loc_pos_technology_mask_type; + +enum rpc_loc_session_status_e_type { + RPC_LOC_SESS_STATUS_SUCCESS = 0, + RPC_LOC_SESS_STATUS_IN_PROGESS = 1, + RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, + RPC_LOC_SESS_STATUS_TIMEOUT = 3, + RPC_LOC_SESS_STATUS_USER_END = 4, + RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, + RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, + RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, + RPC_LOC_SESS_STATUS_MAX = 268435456 +}; + +struct rpc_loc_calendar_time_s_type { + rpc_uint16 year; + unsigned char month; + unsigned char day_of_week; + unsigned char day; + unsigned char hour; + unsigned char minute; + unsigned char second; + rpc_uint16 millisecond; +}; + +struct rpc_loc_parsed_position_s_type { + rpc_loc_position_valid_mask_type valid_mask; + rpc_loc_session_status_e_type session_status; + rpc_loc_calendar_time_s_type timestamp_calendar; + rpc_uint64 timestamp_utc; + rpc_uint8 leap_seconds; + float time_unc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float speed_horizontal; + float speed_vertical; + float heading; + float hor_unc_circular; + float hor_unc_ellipse_semi_major; + float hor_unc_ellipse_semi_minor; + float hor_unc_ellipse_orient_azimuth; + float vert_unc; + float speed_unc; + float heading_unc; + unsigned char confidence_horizontal; + unsigned char confidence_vertical; + float magnetic_deviation; + rpc_loc_pos_technology_mask_type technology_mask; +}; + +enum rpc_loc_sv_system_e_type { + RPC_LOC_SV_SYSTEM_GPS = 1, + RPC_LOC_SV_SYSTEM_GALILEO = 2, + RPC_LOC_SV_SYSTEM_SBAS = 3, + RPC_LOC_SV_SYSTEM_COMPASS = 4, + RPC_LOC_SV_SYSTEM_GLONASS = 5, + RPC_LOC_SV_SYSTEM_MAX = 268435456 +}; + +enum rpc_loc_sv_status_e_type { + RPC_LOC_SV_STATUS_IDLE = 1, + RPC_LOC_SV_STATUS_SEARCH = 2, + RPC_LOC_SV_STATUS_TRACK = 3, + RPC_LOC_SV_STATUS_MAX = 268435456 +}; + +typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; + +struct rpc_loc_sv_info_s_type { + rpc_loc_sv_info_valid_mask_type valid_mask; + rpc_loc_sv_system_e_type system; + rpc_uint8 prn; + rpc_uint8 health_status; + rpc_loc_sv_status_e_type process_status; + rpc_boolean has_eph; + rpc_boolean has_alm; + float elevation; + float azimuth; + float snr; +}; + +typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; + +struct rpc_loc_gnss_info_s_type { + rpc_loc_gnss_info_valid_mask_type valid_mask; + float position_dop; + float horizontal_dop; + float vertical_dop; + rpc_boolean altitude_assumed; + rpc_uint16 sv_count; + rpc_loc_sv_info_s_type sv_list; +}; + +struct rpc_loc_nmea_report_s_type { + rpc_uint16 length; + opaque nmea_sentences; +}; + +enum rpc_loc_status_event_e_type { + RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, + RPC_LOC_STATUS_EVENT_MAX = 268435456 +}; + +enum rpc_loc_engine_state_e_type { + RPC_LOC_ENGINE_STATE_ON = 1, + RPC_LOC_ENGINE_STATE_OFF = 2, + RPC_LOC_ENGINE_STATE_MAX = 268435456 +}; + +union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + rpc_loc_engine_state_e_type engine_state; + default: + void; +}; + +struct rpc_loc_status_event_s_type { + rpc_loc_status_event_e_type event; + rpc_loc_status_event_payload_u_type payload; +}; + +enum rpc_loc_server_addr_e_type { + RPC_LOC_SERVER_ADDR_IPV4 = 1, + RPC_LOC_SERVER_ADDR_URL = 2, + RPC_LOC_SERVER_ADDR_MAX = 268435456 +}; + +struct rpc_loc_server_addr_ipv4_type { + rpc_uint32 addr; + rpc_uint16 port; +}; + +struct rpc_loc_server_addr_url_type { + rpc_uint16 length; + opaque addr; +}; + +union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) { + case RPC_LOC_SERVER_ADDR_IPV4: + rpc_loc_server_addr_ipv4_type ipv4; + case RPC_LOC_SERVER_ADDR_URL: + rpc_loc_server_addr_url_type url; + default: + void; +}; + +struct rpc_loc_server_info_s_type { + rpc_loc_server_addr_e_type addr_type; + rpc_loc_server_addr_u_type addr_info; +}; + +enum rpc_loc_ni_notify_verify_e_type { + RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, + RPC_LOC_NI_USER_NOTIFY_ONLY = 2, + RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, + RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, + RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, + RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456 +}; + +enum rpc_loc_ni_event_e_type { + RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, + RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, + RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, + RPC_LOC_NI_EVENT_MAX = 268435456 +}; + +enum rpc_loc_ni_datacoding_scheme_e_type { + RPC_LOC_NI_PRESUPL_ISO646IRV = 0, + RPC_LOC_NI_PRESUPL_ISO8859 = 1, + RPC_LOC_NI_PRESUPL_UTF8 = 2, + RPC_LOC_NI_PRESUPL_UTF16 = 3, + RPC_LOC_NI_PRESUPL_UCS2 = 4, + RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, + RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, + RPC_LOC_NI_PRESUPL_JIS = 7, + RPC_LOC_NI_PRESUPL_EUC = 8, + RPC_LOC_NI_PRESUPL_GB2312 = 9, + RPC_LOC_NI_PRESUPL_CNS11643 = 10, + RPC_LOC_NI_PRESUPL_KSC1001 = 11, + RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, + RPC_LOC_NI_SS_GERMAN = 12, + RPC_LOC_NI_SS_ENGLISH = 13, + RPC_LOC_NI_SS_ITALIAN = 14, + RPC_LOC_NI_SS_FRENCH = 15, + RPC_LOC_NI_SS_SPANISH = 16, + RPC_LOC_NI_SS_DUTCH = 17, + RPC_LOC_NI_SS_SWEDISH = 18, + RPC_LOC_NI_SS_DANISH = 19, + RPC_LOC_NI_SS_PORTUGUESE = 20, + RPC_LOC_NI_SS_FINNISH = 21, + RPC_LOC_NI_SS_NORWEGIAN = 22, + RPC_LOC_NI_SS_GREEK = 23, + RPC_LOC_NI_SS_TURKISH = 24, + RPC_LOC_NI_SS_HUNGARIAN = 25, + RPC_LOC_NI_SS_POLISH = 26, + RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, + RPC_LOC_NI_SUPL_UTF8 = 28, + RPC_LOC_NI_SUPL_UCS2 = 29, + RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, + RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647 +}; + +enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { + RPC_LOC_NI_VX_OCTET = 0, + RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, + RPC_LOC_NI_VX_ASCII = 2, + RPC_LOC_NI_VX_IA5 = 3, + RPC_LOC_NI_VX_UNICODE = 4, + RPC_LOC_NI_VX_SHIFT_JIS = 5, + RPC_LOC_NI_VX_KOREAN = 6, + RPC_LOC_NI_VX_LATIN_HEBREW = 7, + RPC_LOC_NI_VX_LATIN = 8, + RPC_LOC_NI_VX_GSM = 9, + RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456 +}; + +enum rpc_loc_ni_vx_pos_mode_e_type { + RPC_LOC_VX_MS_ASSISTED_ONLY = 1, + RPC_LOC_VX_MS_BASED_ONLY = 2, + RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, + RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, + RPC_LOC_VX_POS_MODE_MAX = 268435456 +}; + +struct rpc_loc_ni_vx_requester_id_s_type { + unsigned char requester_id_length; + opaque requester_id[200]; +}; + +struct rpc_loc_ni_vx_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + unsigned char pos_qos_incl; + unsigned char pos_qos; + rpc_uint32 num_fixes; + rpc_uint32 tbf; + rpc_loc_ni_vx_pos_mode_e_type pos_mode; + rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; + rpc_loc_ni_vx_requester_id_s_type requester_id; + rpc_uint16 user_resp_timer_val; +}; + +enum rpc_loc_ni_supl_pos_method_e_type { + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, + RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, + RPC_LOC_NI_POSMETHOD_AFLT = 6, + RPC_LOC_NI_POSMETHOD_ECID = 7, + RPC_LOC_NI_POSMETHOD_EOTD = 8, + RPC_LOC_NI_POSMETHOD_OTDOA = 9, + RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, + RPC_LOC_NI_POSMETHOD_MAX = 268435456 +}; + +struct rpc_loc_ni_supl_slp_session_id_s_type { + unsigned char presence; + opaque session_id[4]; + rpc_loc_server_info_s_type slp_address; +}; + +struct rpc_loc_ni_requestor_id_s_type { + unsigned char data_coding_scheme; + opaque requestor_id_string; + unsigned char string_len; +}; + +struct rpc_loc_ni_supl_client_name_s_type { + unsigned char data_coding_scheme; + opaque client_name_string; + unsigned char string_len; +}; + +struct rpc_loc_ni_supl_qop_s_type { + unsigned char bit_mask; + unsigned char horacc; + unsigned char veracc; + unsigned char maxLocAge; + unsigned char delay; +}; + +struct rpc_loc_ni_supl_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + rpc_uint16 flags; + rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; + opaque supl_hash[8]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_supl_pos_method_e_type pos_method; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_supl_client_name_s_type client_name; + rpc_loc_ni_supl_qop_s_type supl_qop; + rpc_uint16 user_response_timer; +}; + +struct rpc_loc_ni_ext_client_address_s_type { + unsigned char ext_client_address_len; + opaque ext_client_address; +}; + +enum rpc_loc_ni_location_type_e_type { + RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, + RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, + RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, + RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456 +}; + +struct rpc_loc_ni_deferred_location_s_type { + unsigned char unused_bits; + unsigned char ms_available; +}; + +struct rpc_loc_ni_codeword_string_s_type { + unsigned char data_coding_scheme; + opaque lcs_codeword_string; + unsigned char string_len; +}; + +struct rpc_loc_ni_service_type_id_s_type { + unsigned char lcs_service_type_id; +}; + +struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + unsigned char invoke_id; + rpc_uint16 flags; + unsigned char notification_length; + opaque notification_text; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_ext_client_address_s_type ext_client_address_data; + rpc_loc_ni_location_type_e_type location_type; + rpc_loc_ni_deferred_location_s_type deferred_location; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_codeword_string_s_type codeword_string; + rpc_loc_ni_service_type_id_s_type service_type_id; + rpc_uint16 user_response_timer; +}; + +union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + rpc_loc_ni_vx_notify_verify_req_s_type vx_req; + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + rpc_loc_ni_supl_notify_verify_req_s_type supl_req; + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; + default: + void; +}; + +struct rpc_loc_ni_event_s_type { + rpc_loc_ni_event_e_type event; + rpc_loc_ni_event_payload_u_type payload; +}; + +enum rpc_loc_assist_data_request_e_type { + RPC_LOC_ASSIST_DATA_TIME_REQ = 1, + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, + RPC_LOC_ASSIST_DATA_MAX = 268435456 +}; + +typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr; + +typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; + +struct rpc_loc_time_download_source_s_type { + rpc_uint32 delay_threshold; + rpc_struct_loc_time_download_source_s_type_servers servers; +}; + +typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; + +typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; + +struct rpc_loc_predicted_orbits_data_source_s_type { + rpc_uint32 max_file_size; + rpc_uint32 max_part_size; + rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; +}; + +union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) { + case RPC_LOC_ASSIST_DATA_TIME_REQ: + rpc_loc_time_download_source_s_type time_download; + case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: + rpc_loc_predicted_orbits_data_source_s_type data_download; + default: + void; +}; + +struct rpc_loc_assist_data_request_s_type { + rpc_loc_assist_data_request_e_type event; + rpc_loc_assist_data_request_payload_u_type payload; +}; + +typedef rpc_uint32 rpc_loc_server_connection_handle; + +enum rpc_loc_server_protocol_e_type { + RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, + RPC_LOC_SERVER_PROTOCOL_SUPL = 1, + RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, + RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, + RPC_LOC_SERVER_PROTOCOL_MAX = 16777216 +}; + +enum rpc_loc_server_request_e_type { + RPC_LOC_SERVER_REQUEST_OPEN = 1, + RPC_LOC_SERVER_REQUEST_CLOSE = 2, + RPC_LOC_SERVER_REQUEST_MAX = 268435456 +}; + +struct rpc_loc_server_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; +}; + +struct rpc_loc_server_close_req_s_type { + rpc_loc_server_connection_handle conn_handle; +}; + +union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) { + case RPC_LOC_SERVER_REQUEST_OPEN: + rpc_loc_server_open_req_s_type open_req; + case RPC_LOC_SERVER_REQUEST_CLOSE: + rpc_loc_server_close_req_s_type close_req; + default: + void; +}; + +struct rpc_loc_server_request_s_type { + rpc_loc_server_request_e_type event; + rpc_loc_server_request_u_type payload; +}; + +struct rpc_loc_reserved_payload_s_type { + rpc_uint16 data_size; + opaque data<>; +}; + +enum rpc_loc_ioctl_e_type { + RPC_LOC_IOCTL_GET_API_VERSION = 1, + RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, + RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, + RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, + RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, + RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, + RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, + RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, + RPC_LOC_IOCTL_INJECT_POSITION = 407, + RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, + RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, + RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, + RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, + RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, + RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, + RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, + RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, + RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, + RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, + RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, + RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, + RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, + RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, + RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, + RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, + RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, + RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, + RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, + RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, + RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, + RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824 +}; + +struct rpc_loc_api_version_s_type { + unsigned char major; + unsigned char minor; +}; + +enum rpc_loc_fix_recurrence_e_type { + RPC_LOC_PERIODIC_FIX = 1, + RPC_LOC_SINGLE_FIX = 2, + RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456 +}; + +enum rpc_loc_operation_mode_e_type { + RPC_LOC_OPER_MODE_DEFAULT = 1, + RPC_LOC_OPER_MODE_MSB = 2, + RPC_LOC_OPER_MODE_MSA = 3, + RPC_LOC_OPER_MODE_STANDALONE = 4, + RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, + RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, + RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, + RPC_LOC_OPER_MODE_MAX = 268435456 +}; + +enum rpc_loc_notify_e_type { + RPC_LOC_NOTIFY_ON_INTERVAL = 1, + RPC_LOC_NOTIFY_ON_DISTANCE = 2, + RPC_LOC_NOTIFY_ON_ANY = 3, + RPC_LOC_NOTIFY_ON_ALL = 4, + RPC_LOC_NOTIFY_TYPE_MAX = 268435456 +}; + +struct rpc_loc_fix_criteria_s_type { + rpc_uint32 valid_mask; + rpc_loc_fix_recurrence_e_type recurrence_type; + rpc_loc_operation_mode_e_type preferred_operation_mode; + rpc_uint32 preferred_accuracy; + rpc_uint32 preferred_response_time; + rpc_boolean intermediate_pos_report_enabled; + rpc_loc_notify_e_type notify_type; + rpc_uint32 min_interval; + float min_distance; + rpc_uint32 min_dist_sample_interval; +}; + +enum rpc_loc_ni_user_resp_e_type { + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456 +}; + +struct rpc_loc_user_verify_s_type { + rpc_loc_ni_user_resp_e_type user_resp; + rpc_loc_ni_event_s_type ni_event_pass_back; +}; + +enum rpc_loc_predicted_orbits_data_format_e_type { + RPC_LOC_PREDICTED_ORBITS_XTRA = 0, + RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456 +}; + +struct rpc_loc_predicted_orbits_data_s_type { + rpc_loc_predicted_orbits_data_format_e_type format_type; + rpc_uint32 total_size; + rpc_uint8 total_parts; + rpc_uint8 part; + rpc_uint16 part_len; + opaque data_ptr<>; +}; + +struct rpc_loc_predicted_orbits_data_validity_report_s_type { + rpc_uint64 start_time_utc; + rpc_uint16 valid_duration_hrs; +}; + +struct rpc_loc_predicted_orbits_auto_download_config_s_type { + rpc_boolean enable; + unsigned char auto_check_every_hrs; +}; + +struct rpc_loc_assist_data_time_s_type { + rpc_uint64 time_utc; + rpc_uint32 uncertainty; +}; + +typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; + +struct rpc_loc_assist_data_pos_s_type { + rpc_loc_assist_pos_valid_mask_type valid_mask; + rpc_uint64 timestamp_utc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float hor_unc_circular; + float vert_unc; + unsigned char confidence_horizontal; + unsigned char confidence_vertical; +}; + +enum rpc_loc_server_open_status_e_type { + RPC_LOC_SERVER_OPEN_SUCCESS = 1, + RPC_LOC_SERVER_OPEN_FAIL = 2, + RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456 +}; + +struct rpc_loc_server_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + string apn_name<>; +}; + +enum rpc_loc_server_close_status_e_type { + RPC_LOC_SERVER_CLOSE_SUCCESS = 1, + RPC_LOC_SERVER_CLOSE_FAIL = 2, + RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456 +}; + +struct rpc_loc_server_close_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_close_status_e_type close_status; +}; + +enum rpc_loc_lock_e_type { + RPC_LOC_LOCK_NONE = 1, + RPC_LOC_LOCK_MI = 2, + RPC_LOC_LOCK_MT = 3, + RPC_LOC_LOCK_ALL = 4, + RPC_LOC_LOCK_MAX = 268435456 +}; + +typedef rpc_uint32 rpc_loc_nmea_sentence_type; + +typedef rpc_uint32 rpc_loc_assist_data_type; + +struct rpc_loc_assist_data_delete_s_type { + rpc_loc_assist_data_type type; + rpc_uint32 reserved[8]; +}; + +union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) { + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + rpc_loc_fix_criteria_s_type fix_criteria; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + rpc_loc_user_verify_s_type user_verify_resp; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + rpc_loc_assist_data_time_s_type assistance_data_time; + case RPC_LOC_IOCTL_INJECT_POSITION: + rpc_loc_assist_data_pos_s_type assistance_data_position; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + rpc_loc_server_open_status_s_type conn_open_status; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + rpc_loc_server_close_status_s_type conn_close_status; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + rpc_loc_lock_e_type engine_lock; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + rpc_boolean sbas_mode; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + rpc_loc_nmea_sentence_type nmea_types; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + rpc_boolean on_demand_lpm; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + rpc_loc_server_info_s_type server_addr; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + rpc_loc_assist_data_delete_s_type assist_data_delete; + default: + void; +}; + +union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) { + case RPC_LOC_IOCTL_GET_API_VERSION: + rpc_loc_api_version_s_type api_version; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + rpc_loc_fix_criteria_s_type fix_criteria; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + rpc_loc_lock_e_type engine_lock; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + rpc_boolean sbas_mode; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + rpc_loc_nmea_sentence_type nmea_types; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + rpc_boolean on_demand_lpm; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + rpc_loc_server_info_s_type server_addr; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; + default: + void; +}; + +struct rpc_loc_ioctl_callback_s_type { + rpc_loc_ioctl_e_type type; + rpc_int32 status; + rpc_loc_ioctl_callback_data_u_type data; +}; + +union rpc_loc_event_payload_u_type switch (unsigned hyper disc) { + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + rpc_loc_parsed_position_s_type parsed_location_report; + case RPC_LOC_EVENT_SATELLITE_REPORT: + rpc_loc_gnss_info_s_type gnss_report; + case RPC_LOC_EVENT_NMEA_POSITION_REPORT: + rpc_loc_nmea_report_s_type nmea_report; + case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: + rpc_loc_ni_event_s_type ni_request; + case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: + rpc_loc_assist_data_request_s_type assist_data_request; + case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: + rpc_loc_server_request_s_type loc_server_request; + case RPC_LOC_EVENT_IOCTL_REPORT: + rpc_loc_ioctl_callback_s_type ioctl_report; + case RPC_LOC_EVENT_STATUS_REPORT: + rpc_loc_status_event_s_type status_report; + case RPC_LOC_EVENT_RESERVED: + rpc_loc_reserved_payload_s_type reserved; + default: + void; +}; + +const RPC_LOC_API_NULL_VERSION = 0x00010001; +const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00010001; diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c new file mode 100644 index 00000000..7b37b9c3 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c @@ -0,0 +1,1441 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_common.h" + +bool_t +xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp) +{ + register int32_t *buf; + + if (!xdr_bool (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp) +{ + register int32_t *buf; + + if (!xdr_u_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp) +{ + register int32_t *buf; + + if (!xdr_u_short (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp) +{ + register int32_t *buf; + + if (!xdr_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_byte (XDR *xdrs, rpc_byte *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp) +{ + register int32_t *buf; + + if (!xdr_u_quad_t (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->year)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->month)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->day_of_week)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->day)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->hour)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->minute)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->second)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->millisecond)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status)) + return FALSE; + if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds)) + return FALSE; + if (!xdr_float (xdrs, &objp->time_unc)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_horizontal)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_vertical)) + return FALSE; + if (!xdr_float (xdrs, &objp->heading)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_circular)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth)) + return FALSE; + if (!xdr_float (xdrs, &objp->vert_unc)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_unc)) + return FALSE; + if (!xdr_float (xdrs, &objp->heading_unc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_vertical)) + return FALSE; + if (!xdr_float (xdrs, &objp->magnetic_deviation)) + return FALSE; + if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->prn)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->health_status)) + return FALSE; + if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->has_eph)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->has_alm)) + return FALSE; + if (!xdr_float (xdrs, &objp->elevation)) + return FALSE; + if (!xdr_float (xdrs, &objp->azimuth)) + return FALSE; + if (!xdr_float (xdrs, &objp->snr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_float (xdrs, &objp->position_dop)) + return FALSE; + if (!xdr_float (xdrs, &objp->horizontal_dop)) + return FALSE; + if (!xdr_float (xdrs, &objp->vertical_dop)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->sv_count)) + return FALSE; + if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT, + sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->length)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->addr)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->port)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->length)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_SERVER_ADDR_IPV4: + if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4)) + return FALSE; + break; + case RPC_LOC_SERVER_ADDR_URL: + if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type)) + return FALSE; + if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->requester_id_length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->requester_id, 200)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->pos_qos_incl)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->pos_qos)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->tbf)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->presence)) + return FALSE; + if (!xdr_opaque (xdrs, objp->session_id, 4)) + return FALSE; + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->bit_mask)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->horacc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->veracc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->maxLocAge)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->delay)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id)) + return FALSE; + if (!xdr_opaque (xdrs, objp->supl_hash, 8)) + return FALSE; + if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method)) + return FALSE; + if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->ext_client_address_len)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->unused_bits)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->ms_available)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->lcs_service_type_id)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->invoke_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->notification_length)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH)) + return FALSE; + if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data)) + return FALSE; + if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type)) + return FALSE; + if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location)) + return FALSE; + if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) + return FALSE; + if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string)) + return FALSE; + if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp) +{ + register int32_t *buf; + + if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp) +{ + register int32_t *buf; + + if (!xdr_vector (xdrs, (char *)objp, 3, + sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold)) + return FALSE; + if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp) +{ + register int32_t *buf; + + if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp) +{ + register int32_t *buf; + + if (!xdr_vector (xdrs, (char *)objp, 3, + sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size)) + return FALSE; + if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_ASSIST_DATA_TIME_REQ: + if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download)) + return FALSE; + break; + case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: + if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_SERVER_REQUEST_OPEN: + if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req)) + return FALSE; + break; + case RPC_LOC_SERVER_REQUEST_CLOSE: + if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->data_size)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->major)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->minor)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type)) + return FALSE; + if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled)) + return FALSE; + if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->min_interval)) + return FALSE; + if (!xdr_float (xdrs, &objp->min_distance)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp)) + return FALSE; + if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->part)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->part_len)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_boolean (xdrs, &objp->enable)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, &objp->time_utc)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_circular)) + return FALSE; + if (!xdr_float (xdrs, &objp->vert_unc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_vertical)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status)) + return FALSE; + if (!xdr_string (xdrs, &objp->apn_name, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->reserved, 8, + sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_POSITION: + if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr)) + return FALSE; + break; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_IOCTL_GET_API_VERSION: + if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr)) + return FALSE; + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source)) + return FALSE; + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->status)) + return FALSE; + if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_quad_t (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report)) + return FALSE; + break; + case RPC_LOC_EVENT_SATELLITE_REPORT: + if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report)) + return FALSE; + break; + case RPC_LOC_EVENT_NMEA_POSITION_REPORT: + if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report)) + return FALSE; + break; + case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: + if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request)) + return FALSE; + break; + case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: + if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request)) + return FALSE; + break; + case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: + if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request)) + return FALSE; + break; + case RPC_LOC_EVENT_IOCTL_REPORT: + if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report)) + return FALSE; + break; + case RPC_LOC_EVENT_STATUS_REPORT: + if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report)) + return FALSE; + break; + case RPC_LOC_EVENT_RESERVED: + if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved)) + return FALSE; + break; + default: + break; + } + return TRUE; +} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c new file mode 100644 index 00000000..fe512f5d --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c @@ -0,0 +1,48 @@ +/*============================================================================= + L O C _ A P I _ F I X U P . C + +GENERAL DESCRIPTION + This file adds API constants that are not automatically transmitted to + the RPC stubs, and it also fixes other RPC-related problems. + + --------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --------------------------------------------------------------------------- +=============================================================================*/ + +#include + +#include "loc_api_fixup.h" + +#ifdef ADD_XDR_FLOAT + +int +xdr_float(xdrp, fp) + XDR *xdrp; + float *fp; +{ + return xdr_long(xdrp, (long*)fp); +} + +int +xdr_double(xdrp, dp) + XDR *xdrp; + double *dp; +{ + return xdr_long(xdrp, (long*)dp + 1) + && xdr_long(xdrp, (long*)dp); +} + +#endif /* ADD_XDR_FLOAT */ diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c new file mode 100644 index 00000000..8c171222 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c @@ -0,0 +1,339 @@ +/****************************************************************************** + @file loc_api_rpc_glue.c + @brief Android Loc API glue code using rpcgen. + + DESCRIPTION + Loc API glue code for Android + + ----------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ----------------------------------------------------------------------------- + ******************************************************************************/ +/*===================================================================== + EDIT HISTORY FOR MODULE + + This section contains comments describing changes made to the module. + Notice that changes are listed in reverse chronological order. + +when who what, where, why +-------- --- ------------------------------------------------------- +03/05/2009 dx Initial version + +======================================================================*/ +/*===================================================================== + + INCLUDE FILES FOR MODULE + +======================================================================*/ +//#define LOG_NDDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +/* Include RPC headers */ +#include "loc_api_rpc_glue.h" + +/* Callback init */ +#include "loc_apicb_appinit.h" + +/* Logging */ +#define LOG_TAG "lib_api_rpc_glue" +#include + +/* Comment this out to enable logging */ +#undef LOGD +#define LOGD(...) {} + +/*===================================================================== + External declarations +======================================================================*/ + +CLIENT* loc_api_clnt = NULL; + +/* Callback ID and pointer */ +#define LOC_API_CB_ID 1 +loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */ + +#define RPC_FUNC_VERSION_BASE(a,b) a ## b +#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b) + +#define LOC_GLUE_CHECK_INIT(ret_type) \ + if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } + +#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \ + if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } + +/* Callback functions */ +/* Returns 1 if successful */ +bool_t rpc_loc_event_cb_f_type_0x00010001_svc( + rpc_loc_event_cb_f_type_args *argp, + rpc_loc_event_cb_f_type_rets *ret, + struct svc_req *req) +{ + /* Callback not registered, or unexpected ID (shouldn't happen) */ + if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID) + { + LOGD("Warning: No callback handler.\n"); + ret->loc_event_cb_f_type_result = 0; + return 1; /* simply return */ + } + + LOGD("proc: %x prog: %x vers: %x\n", + (int) req->rq_proc, + (int) req->rq_prog, + (int) req->rq_vers); + + LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n", + (int) argp->loc_event, + (int) argp->loc_handle, + (int) ret); + + /* Forward callback to real callback procedure */ + rpc_loc_client_handle_type loc_handle = argp->loc_handle; + rpc_loc_event_mask_type loc_event = argp->loc_event; + const rpc_loc_event_payload_u_type* loc_event_payload = + (const rpc_loc_event_payload_u_type*) argp->loc_event_payload; + + int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload); + ret->loc_event_cb_f_type_result = rc; + + return 1; /* ok */ +} + +int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) +{ + xdr_free (xdr_result, result); + + /* + * Insert additional freeing code here, if needed + */ + // LOGD("***** loc_apicbprog_freeresult\n"); + + return 1; +} + +int loc_apicbprog_0x00010001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) +{ + return loc_apicbprog_freeresult (transp, xdr_result, result); +} + +/*=========================================================================== + +FUNCTION loc_api_glue_init + +DESCRIPTION + Initiates the RPC client + +RETURN VALUE + 1 for success + 0 for failure + +===========================================================================*/ +int loc_api_glue_init(void) +{ + if (loc_api_clnt == NULL) + { + /* Print msg */ + LOGD("Trying to create RPC client...\n"); + loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL); + LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt); + + if (loc_api_clnt == NULL) + { + fprintf(stderr, "Error: cannot create RPC client.\n"); + return 0; + } + + /* Init RPC callbacks */ + int rc = loc_apicb_app_init(); + if (rc >= 0) + { + LOGD("Loc API callback initialized.\n"); + } else { + fprintf(stderr, "Loc API callback initialization failed.\n"); + return 0; + } + } + + return 1; +} + +rpc_loc_client_handle_type loc_open ( + rpc_loc_event_mask_type event_reg_mask, + loc_event_cb_f_type *event_callback + ) +{ + LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type); + + rpc_loc_open_args args; + args.event_reg_mask = event_reg_mask; + args.event_callback = LOC_API_CB_ID; + loc_api_saved_cb = event_callback; + + rpc_loc_open_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (rpc_loc_client_handle_type) rets.loc_open_result; +} + +int32 loc_close(rpc_loc_client_handle_type handle) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_close_args args; + args.handle = handle; + + rpc_loc_close_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_close_result; +} + +int32 loc_start_fix(rpc_loc_client_handle_type handle) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_start_fix_args args; + args.handle = handle; + + rpc_loc_start_fix_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_start_fix_result; +} + +int32 loc_stop_fix(rpc_loc_client_handle_type handle) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_stop_fix_args args; + args.handle = handle; + + rpc_loc_stop_fix_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_stop_fix_result; +} + +int32 loc_ioctl( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data + ) +{ + LOC_GLUE_CHECK_INIT(int32); + + rpc_loc_ioctl_args args; + args.handle = handle; + args.ioctl_data = ioctl_data; + args.ioctl_type = ioctl_type; + if (ioctl_data != NULL) + { + /* Assign ioctl union discriminator */ + ioctl_data->disc = ioctl_type; + + /* In case the user hasn't filled in other disc fields, + automatically fill them in here */ + switch (ioctl_type) + { + case RPC_LOC_IOCTL_GET_API_VERSION: + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + case RPC_LOC_IOCTL_INJECT_RTC_VALUE: + case RPC_LOC_IOCTL_INJECT_POSITION: + case RPC_LOC_IOCTL_QUERY_ENGINE_STATE: + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + break; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc = + args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type; + break; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + break; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + default: + break; + } /* switch */ + } /* ioctl_data != NULL */ + + rpc_loc_ioctl_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets.loc_ioctl_result; +} + +/* Returns 0 if error */ +int32 loc_api_null(void) +{ + LOC_GLUE_CHECK_INIT(int32); + + int32 rets; + enum clnt_stat stat = RPC_SUCCESS; + + stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets; +} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c new file mode 100644 index 00000000..835f6b18 --- /dev/null +++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c @@ -0,0 +1,171 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api.h" + +bool_t +xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp) +{ + register int32_t *buf; + + if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0, + sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask)) + return FALSE; + if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_boolean (xdrs, &objp->len_not_null)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->toolvers)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->features)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->proghash)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api.h b/loc_api/libloc_api-rpc/inc-1240/loc_api.h new file mode 100644 index 00000000..e02648cc --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-1240/loc_api.h @@ -0,0 +1,210 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_H_RPCGEN +#define _LOC_API_H_RPCGEN + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct { + u_int rpc_loc_api_api_versions_return_type_len; + rpc_uint32 *rpc_loc_api_api_versions_return_type_val; +} rpc_loc_api_api_versions_return_type; + +typedef rpc_uint32 rpc_loc_event_cb_f_type; + +struct rpc_loc_open_args { + rpc_loc_event_mask_type event_reg_mask; + rpc_loc_event_cb_f_type event_callback; +}; +typedef struct rpc_loc_open_args rpc_loc_open_args; + +struct rpc_loc_close_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_close_args rpc_loc_close_args; + +struct rpc_loc_start_fix_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args; + +struct rpc_loc_stop_fix_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args; + +struct rpc_loc_ioctl_args { + rpc_loc_client_handle_type handle; + rpc_loc_ioctl_e_type ioctl_type; + rpc_loc_ioctl_data_u_type *ioctl_data; +}; +typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args; + +struct rpc_loc_api_api_version_s_args { + rpc_boolean len_not_null; +}; +typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args; + +struct rpc_loc_api_rpc_glue_code_info_remote_rets { + rpc_uint32 toolvers; + rpc_uint32 features; + rpc_uint32 proghash; + rpc_uint32 cbproghash; +}; +typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets; + +struct rpc_loc_open_rets { + rpc_loc_client_handle_type loc_open_result; +}; +typedef struct rpc_loc_open_rets rpc_loc_open_rets; + +struct rpc_loc_close_rets { + rpc_int32 loc_close_result; +}; +typedef struct rpc_loc_close_rets rpc_loc_close_rets; + +struct rpc_loc_start_fix_rets { + rpc_int32 loc_start_fix_result; +}; +typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets; + +struct rpc_loc_stop_fix_rets { + rpc_int32 loc_stop_fix_result; +}; +typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets; + +struct rpc_loc_ioctl_rets { + rpc_int32 loc_ioctl_result; +}; +typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets; + +struct rpc_loc_api_api_versions_rets { + rpc_loc_api_api_versions_return_type loc_api_api_versions_result; + rpc_uint32 *len; +}; +typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets; +#define LOC_APIVERS 0x00040002 + +#define LOC_APIPROG 0x3000008c +#define LOC_APIVERS_0001 0x00040001 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_api_null 0 +extern enum clnt_stat rpc_loc_api_null_0x00040001(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00040001_svc(void *, void *, struct svc_req *); +#define rpc_loc_api_rpc_glue_code_info_remote 1 +extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *); +extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *); +#define rpc_loc_open 2 +extern enum clnt_stat rpc_loc_open_0x00040001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *); +extern bool_t rpc_loc_open_0x00040001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *); +#define rpc_loc_close 3 +extern enum clnt_stat rpc_loc_close_0x00040001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *); +extern bool_t rpc_loc_close_0x00040001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *); +#define rpc_loc_start_fix 4 +extern enum clnt_stat rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *); +extern bool_t rpc_loc_start_fix_0x00040001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *); +#define rpc_loc_stop_fix 5 +extern enum clnt_stat rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *); +extern bool_t rpc_loc_stop_fix_0x00040001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *); +#define rpc_loc_ioctl 6 +extern enum clnt_stat rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *); +extern bool_t rpc_loc_ioctl_0x00040001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *); +#define rpc_loc_api_api_versions 0xFFFFFFFF +extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(void *, rpc_loc_api_api_versions_rets *, CLIENT *); +extern bool_t rpc_loc_api_api_versions_0x00040001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *); +extern int loc_apiprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_api_null 0 +extern enum clnt_stat rpc_loc_api_null_0x00040001(); +extern bool_t rpc_loc_api_null_0x00040001_svc(); +#define rpc_loc_api_rpc_glue_code_info_remote 1 +extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(); +extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(); +#define rpc_loc_open 2 +extern enum clnt_stat rpc_loc_open_0x00040001(); +extern bool_t rpc_loc_open_0x00040001_svc(); +#define rpc_loc_close 3 +extern enum clnt_stat rpc_loc_close_0x00040001(); +extern bool_t rpc_loc_close_0x00040001_svc(); +#define rpc_loc_start_fix 4 +extern enum clnt_stat rpc_loc_start_fix_0x00040001(); +extern bool_t rpc_loc_start_fix_0x00040001_svc(); +#define rpc_loc_stop_fix 5 +extern enum clnt_stat rpc_loc_stop_fix_0x00040001(); +extern bool_t rpc_loc_stop_fix_0x00040001_svc(); +#define rpc_loc_ioctl 6 +extern enum clnt_stat rpc_loc_ioctl_0x00040001(); +extern bool_t rpc_loc_ioctl_0x00040001_svc(); +#define rpc_loc_api_api_versions 0xFFFFFFFF +extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(); +extern bool_t rpc_loc_api_api_versions_0x00040001_svc(); +extern int loc_apiprog_0x00040001_freeresult (); +#endif /* K&R C */ +#define LOC_APIVERS_0002 0x00040002 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_null_0x00040002(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00040002_svc(void *, void *, struct svc_req *); +extern int loc_apiprog_0x00040002_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_null_0x00040002(); +extern bool_t rpc_loc_api_null_0x00040002_svc(); +extern int loc_apiprog_0x00040002_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*); +extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*); +extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*); +extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*); +extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*); +extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*); +extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*); +extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*); +extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*); +extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*); +extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*); +extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*); +extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*); +extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*); +extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_api_api_versions_return_type (); +extern bool_t xdr_rpc_loc_event_cb_f_type (); +extern bool_t xdr_rpc_loc_open_args (); +extern bool_t xdr_rpc_loc_close_args (); +extern bool_t xdr_rpc_loc_start_fix_args (); +extern bool_t xdr_rpc_loc_stop_fix_args (); +extern bool_t xdr_rpc_loc_ioctl_args (); +extern bool_t xdr_rpc_loc_api_api_version_s_args (); +extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (); +extern bool_t xdr_rpc_loc_open_rets (); +extern bool_t xdr_rpc_loc_close_rets (); +extern bool_t xdr_rpc_loc_start_fix_rets (); +extern bool_t xdr_rpc_loc_stop_fix_rets (); +extern bool_t xdr_rpc_loc_ioctl_rets (); +extern bool_t xdr_rpc_loc_api_api_versions_rets (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h new file mode 100644 index 00000000..67ac0846 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h @@ -0,0 +1,64 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_CB_H_RPCGEN +#define _LOC_API_CB_H_RPCGEN + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +struct rpc_loc_event_cb_f_type_args { + rpc_uint32 cb_id; + rpc_loc_client_handle_type loc_handle; + rpc_loc_event_mask_type loc_event; + rpc_loc_event_payload_u_type *loc_event_payload; +}; +typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args; + +struct rpc_loc_event_cb_f_type_rets { + rpc_int32 loc_event_cb_f_type_result; +}; +typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets; +#define LOC_APICBVERS 0x00040002 + +#define LOC_APICBPROG 0x3100008c +#define LOC_APICBVERS_0001 0x00040001 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_event_cb_f_type 1 +extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *); +extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *); +extern int loc_apicbprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_event_cb_f_type 1 +extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(); +extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(); +extern int loc_apicbprog_0x00040001_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*); +extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_event_cb_f_type_args (); +extern bool_t xdr_rpc_loc_event_cb_f_type_rets (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_CB_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h new file mode 100644 index 00000000..6ff3baf1 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h @@ -0,0 +1,1154 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_COMMON_H_RPCGEN +#define _LOC_API_COMMON_H_RPCGEN + +#include +#include "loc_api_fixup.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LOC_API_TOOLVERS 0x00040024 +#define LOC_API_FEATURES 0x00000001 +#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 +#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200 +#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 +#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 +#define RPC_LOC_EVENT_RESERVED 0x8000000000000000 +#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 +#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 +#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 +#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 +#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 +#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00040001 +#define RPC_LOC_OPEN_VERSION 0x00040001 +#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00040001 +#define RPC_LOC_API_NULL_VERSION 0x00040001 +#define RPC_LOC_STOP_FIX_VERSION 0x00040001 +#define RPC_LOC_IOCTL_VERSION 0x00040001 +#define RPC_LOC_START_FIX_VERSION 0x00040001 +#define RPC_LOC_CLOSE_VERSION 0x00040001 +#define RPC_LOC_API_API_VERSIONS_VERSION 0x00040001 +#define RPC_LOC_API_API_MAJOR_NUM 0x0004 +#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0 + +typedef bool_t rpc_boolean; + +typedef u_long rpc_uint32; + +typedef u_short rpc_uint16; + +typedef u_char rpc_uint8; + +typedef long rpc_int32; + +typedef u_char rpc_byte; + +typedef u_quad_t rpc_uint64; + +typedef rpc_int32 rpc_loc_client_handle_type; + +typedef rpc_uint64 rpc_loc_event_mask_type; + +typedef rpc_uint64 rpc_loc_position_valid_mask_type; + +typedef rpc_uint32 rpc_loc_pos_technology_mask_type; + +enum rpc_loc_session_status_e_type { + RPC_LOC_SESS_STATUS_SUCCESS = 0, + RPC_LOC_SESS_STATUS_IN_PROGESS = 1, + RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, + RPC_LOC_SESS_STATUS_TIMEOUT = 3, + RPC_LOC_SESS_STATUS_USER_END = 4, + RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, + RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, + RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, + RPC_LOC_SESS_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type; + +struct rpc_loc_calendar_time_s_type { + rpc_uint16 year; + u_char month; + u_char day_of_week; + u_char day; + u_char hour; + u_char minute; + u_char second; + rpc_uint16 millisecond; +}; +typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type; + +struct rpc_loc_parsed_position_s_type { + rpc_loc_position_valid_mask_type valid_mask; + rpc_loc_session_status_e_type session_status; + rpc_loc_calendar_time_s_type timestamp_calendar; + rpc_uint64 timestamp_utc; + rpc_uint8 leap_seconds; + float time_unc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float speed_horizontal; + float speed_vertical; + float heading; + float hor_unc_circular; + float hor_unc_ellipse_semi_major; + float hor_unc_ellipse_semi_minor; + float hor_unc_ellipse_orient_azimuth; + float vert_unc; + float speed_unc; + float heading_unc; + u_char confidence_horizontal; + u_char confidence_vertical; + float magnetic_deviation; + rpc_loc_pos_technology_mask_type technology_mask; +}; +typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type; + +enum rpc_loc_sv_system_e_type { + RPC_LOC_SV_SYSTEM_GPS = 1, + RPC_LOC_SV_SYSTEM_GALILEO = 2, + RPC_LOC_SV_SYSTEM_SBAS = 3, + RPC_LOC_SV_SYSTEM_COMPASS = 4, + RPC_LOC_SV_SYSTEM_GLONASS = 5, + RPC_LOC_SV_SYSTEM_MAX = 268435456, +}; +typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type; + +enum rpc_loc_sv_status_e_type { + RPC_LOC_SV_STATUS_IDLE = 1, + RPC_LOC_SV_STATUS_SEARCH = 2, + RPC_LOC_SV_STATUS_TRACK = 3, + RPC_LOC_SV_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type; + +typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; + +struct rpc_loc_sv_info_s_type { + rpc_loc_sv_info_valid_mask_type valid_mask; + rpc_loc_sv_system_e_type system; + rpc_uint8 prn; + rpc_uint8 health_status; + rpc_loc_sv_status_e_type process_status; + rpc_boolean has_eph; + rpc_boolean has_alm; + float elevation; + float azimuth; + float snr; +}; +typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type; + +typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; + +struct rpc_loc_gnss_info_s_type { + rpc_loc_gnss_info_valid_mask_type valid_mask; + float position_dop; + float horizontal_dop; + float vertical_dop; + rpc_boolean altitude_assumed; + rpc_uint16 sv_count; + struct { + u_int sv_list_len; + rpc_loc_sv_info_s_type *sv_list_val; + } sv_list; +}; +typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type; + +struct rpc_loc_nmea_report_s_type { + rpc_uint16 length; + char nmea_sentences[1200]; +}; +typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type; + +enum rpc_loc_status_event_e_type { + RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, + RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2, + RPC_LOC_STATUS_EVENT_MAX = 268435456, +}; +typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type; + +enum rpc_loc_engine_state_e_type { + RPC_LOC_ENGINE_STATE_ON = 1, + RPC_LOC_ENGINE_STATE_OFF = 2, + RPC_LOC_ENGINE_STATE_MAX = 268435456, +}; +typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type; + +enum rpc_loc_fix_session_state_e_type { + RPC_LOC_FIX_SESSION_STATE_BEGIN = 1, + RPC_LOC_FIX_SESSION_STATE_END = 2, + RPC_LOC_FIX_SESSION_STATE_MAX = 268435456, +}; +typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type; + +struct rpc_loc_status_event_payload_u_type { + rpc_loc_status_event_e_type disc; + union { + rpc_loc_engine_state_e_type engine_state; + rpc_loc_fix_session_state_e_type fix_session_state; + } rpc_loc_status_event_payload_u_type_u; +}; +typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type; + +struct rpc_loc_status_event_s_type { + rpc_loc_status_event_e_type event; + rpc_loc_status_event_payload_u_type payload; +}; +typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type; + +enum rpc_loc_server_addr_e_type { + RPC_LOC_SERVER_ADDR_IPV4 = 1, + RPC_LOC_SERVER_ADDR_URL = 2, + RPC_LOC_SERVER_ADDR_MAX = 268435456, +}; +typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type; + +struct rpc_loc_server_addr_ipv4_type { + rpc_uint32 addr; + rpc_uint16 port; +}; +typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type; + +struct rpc_loc_server_addr_url_type { + rpc_uint16 length; + char addr[256]; +}; +typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type; + +struct rpc_loc_server_addr_u_type { + rpc_loc_server_addr_e_type disc; + union { + rpc_loc_server_addr_ipv4_type ipv4; + rpc_loc_server_addr_url_type url; + } rpc_loc_server_addr_u_type_u; +}; +typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type; + +struct rpc_loc_server_info_s_type { + rpc_loc_server_addr_e_type addr_type; + rpc_loc_server_addr_u_type addr_info; +}; +typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type; + +enum rpc_loc_ni_notify_verify_e_type { + RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, + RPC_LOC_NI_USER_NOTIFY_ONLY = 2, + RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, + RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, + RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, + RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type; + +enum rpc_loc_ni_event_e_type { + RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, + RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, + RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, + RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4, + RPC_LOC_NI_EVENT_MAX = 268435456, +}; +typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type; + +enum rpc_loc_ni_datacoding_scheme_e_type { + RPC_LOC_NI_PRESUPL_ISO646IRV = 0, + RPC_LOC_NI_PRESUPL_ISO8859 = 1, + RPC_LOC_NI_PRESUPL_UTF8 = 2, + RPC_LOC_NI_PRESUPL_UTF16 = 3, + RPC_LOC_NI_PRESUPL_UCS2 = 4, + RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, + RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, + RPC_LOC_NI_PRESUPL_JIS = 7, + RPC_LOC_NI_PRESUPL_EUC = 8, + RPC_LOC_NI_PRESUPL_GB2312 = 9, + RPC_LOC_NI_PRESUPL_CNS11643 = 10, + RPC_LOC_NI_PRESUPL_KSC1001 = 11, + RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, + RPC_LOC_NI_SS_GERMAN = 12, + RPC_LOC_NI_SS_ENGLISH = 13, + RPC_LOC_NI_SS_ITALIAN = 14, + RPC_LOC_NI_SS_FRENCH = 15, + RPC_LOC_NI_SS_SPANISH = 16, + RPC_LOC_NI_SS_DUTCH = 17, + RPC_LOC_NI_SS_SWEDISH = 18, + RPC_LOC_NI_SS_DANISH = 19, + RPC_LOC_NI_SS_PORTUGUESE = 20, + RPC_LOC_NI_SS_FINNISH = 21, + RPC_LOC_NI_SS_NORWEGIAN = 22, + RPC_LOC_NI_SS_GREEK = 23, + RPC_LOC_NI_SS_TURKISH = 24, + RPC_LOC_NI_SS_HUNGARIAN = 25, + RPC_LOC_NI_SS_POLISH = 26, + RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, + RPC_LOC_NI_SUPL_UTF8 = 28, + RPC_LOC_NI_SUPL_UCS2 = 29, + RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, + RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647, +}; +typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type; + +enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { + RPC_LOC_NI_VX_OCTET = 0, + RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, + RPC_LOC_NI_VX_ASCII = 2, + RPC_LOC_NI_VX_IA5 = 3, + RPC_LOC_NI_VX_UNICODE = 4, + RPC_LOC_NI_VX_SHIFT_JIS = 5, + RPC_LOC_NI_VX_KOREAN = 6, + RPC_LOC_NI_VX_LATIN_HEBREW = 7, + RPC_LOC_NI_VX_LATIN = 8, + RPC_LOC_NI_VX_GSM = 9, + RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type; + +enum rpc_loc_ni_vx_pos_mode_e_type { + RPC_LOC_VX_MS_ASSISTED_ONLY = 1, + RPC_LOC_VX_MS_BASED_ONLY = 2, + RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, + RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, + RPC_LOC_VX_POS_MODE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type; + +struct rpc_loc_ni_vx_requester_id_s_type { + u_char requester_id_length; + char requester_id[200]; +}; +typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type; + +struct rpc_loc_ni_vx_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + u_char pos_qos_incl; + u_char pos_qos; + rpc_uint32 num_fixes; + rpc_uint32 tbf; + rpc_loc_ni_vx_pos_mode_e_type pos_mode; + rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; + rpc_loc_ni_vx_requester_id_s_type requester_id; + rpc_uint16 user_resp_timer_val; +}; +typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type; + +enum rpc_loc_ni_supl_pos_method_e_type { + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, + RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, + RPC_LOC_NI_POSMETHOD_AFLT = 6, + RPC_LOC_NI_POSMETHOD_ECID = 7, + RPC_LOC_NI_POSMETHOD_EOTD = 8, + RPC_LOC_NI_POSMETHOD_OTDOA = 9, + RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, + RPC_LOC_NI_POSMETHOD_MAX = 268435456, +}; +typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type; + +struct rpc_loc_ni_supl_slp_session_id_s_type { + u_char presence; + char session_id[4]; + rpc_loc_server_info_s_type slp_address; +}; +typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type; + +struct rpc_loc_ni_requestor_id_s_type { + u_char data_coding_scheme; + char requestor_id_string[200]; + u_char string_len; +}; +typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type; + +struct rpc_loc_ni_supl_client_name_s_type { + u_char data_coding_scheme; + char client_name_string[64]; + u_char string_len; +}; +typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type; + +struct rpc_loc_ni_supl_qop_s_type { + u_char bit_mask; + u_char horacc; + u_char veracc; + rpc_uint16 maxLocAge; + u_char delay; +}; +typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type; + +struct rpc_loc_ni_supl_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + rpc_uint16 flags; + rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; + char supl_hash[8]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_supl_pos_method_e_type pos_method; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_supl_client_name_s_type client_name; + rpc_loc_ni_supl_qop_s_type supl_qop; + rpc_uint16 user_response_timer; +}; +typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type; + +struct rpc_loc_ni_ext_client_address_s_type { + u_char ext_client_address_len; + char ext_client_address[20]; +}; +typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type; + +enum rpc_loc_ni_location_type_e_type { + RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, + RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, + RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, + RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type; + +struct rpc_loc_ni_deferred_location_s_type { + u_char unused_bits; + u_char ms_available; +}; +typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type; + +struct rpc_loc_ni_codeword_string_s_type { + u_char data_coding_scheme; + char lcs_codeword_string[20]; + u_char string_len; +}; +typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type; + +struct rpc_loc_ni_service_type_id_s_type { + u_char lcs_service_type_id; +}; +typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type; + +struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + u_char invoke_id; + rpc_uint16 flags; + u_char notification_length; + char notification_text[64]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_ext_client_address_s_type ext_client_address_data; + rpc_loc_ni_location_type_e_type location_type; + rpc_loc_ni_deferred_location_s_type deferred_location; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_codeword_string_s_type codeword_string; + rpc_loc_ni_service_type_id_s_type service_type_id; + rpc_uint16 user_response_timer; +}; +typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type; + +enum rpc_loc_ni_service_interaction_e_type { + RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1, + RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456, +}; +typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type; + +struct rpc_loc_ni_vx_service_interaction_req_s_type { + rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req; + rpc_loc_ni_service_interaction_e_type service_interation_type; +}; +typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type; + +struct rpc_loc_ni_event_payload_u_type { + rpc_loc_ni_event_e_type disc; + union { + rpc_loc_ni_vx_notify_verify_req_s_type vx_req; + rpc_loc_ni_supl_notify_verify_req_s_type supl_req; + rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; + rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req; + } rpc_loc_ni_event_payload_u_type_u; +}; +typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type; + +struct rpc_loc_ni_event_s_type { + rpc_loc_ni_event_e_type event; + rpc_loc_ni_event_payload_u_type payload; +}; +typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type; + +enum rpc_loc_assist_data_request_e_type { + RPC_LOC_ASSIST_DATA_TIME_REQ = 1, + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, + RPC_LOC_ASSIST_DATA_MAX = 268435456, +}; +typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type; + +typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr; + +typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; + +struct rpc_loc_time_download_source_s_type { + rpc_uint32 delay_threshold; + rpc_struct_loc_time_download_source_s_type_servers servers; +}; +typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type; + +typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; + +typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; + +struct rpc_loc_predicted_orbits_data_source_s_type { + rpc_uint32 max_file_size; + rpc_uint32 max_part_size; + rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; +}; +typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type; + +struct rpc_loc_assist_data_request_payload_u_type { + rpc_loc_assist_data_request_e_type disc; + union { + rpc_loc_time_download_source_s_type time_download; + rpc_loc_predicted_orbits_data_source_s_type data_download; + } rpc_loc_assist_data_request_payload_u_type_u; +}; +typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type; + +struct rpc_loc_assist_data_request_s_type { + rpc_loc_assist_data_request_e_type event; + rpc_loc_assist_data_request_payload_u_type payload; +}; +typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type; + +typedef rpc_uint32 rpc_loc_server_connection_handle; + +enum rpc_loc_server_protocol_e_type { + RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, + RPC_LOC_SERVER_PROTOCOL_SUPL = 1, + RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, + RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, + RPC_LOC_SERVER_PROTOCOL_MAX = 16777216, +}; +typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type; + +enum rpc_loc_server_request_e_type { + RPC_LOC_SERVER_REQUEST_OPEN = 1, + RPC_LOC_SERVER_REQUEST_CLOSE = 2, + RPC_LOC_SERVER_REQUEST_MAX = 268435456, +}; +typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type; + +struct rpc_loc_server_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; +}; +typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type; + +struct rpc_loc_server_close_req_s_type { + rpc_loc_server_connection_handle conn_handle; +}; +typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type; + +struct rpc_loc_server_request_u_type { + rpc_loc_server_request_e_type disc; + union { + rpc_loc_server_open_req_s_type open_req; + rpc_loc_server_close_req_s_type close_req; + } rpc_loc_server_request_u_type_u; +}; +typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type; + +struct rpc_loc_server_request_s_type { + rpc_loc_server_request_e_type event; + rpc_loc_server_request_u_type payload; +}; +typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type; + +enum rpc_loc_qwip_request_e_type { + RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0, + RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1, + RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2, + RPC_LOC_QWIP_SUSPEND = 0 + 3, + RPC_LOC_QWIP_REQUEST_MAX = 268435456, +}; +typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type; + +struct rpc_loc_qwip_request_s_type { + rpc_loc_qwip_request_e_type request_type; + rpc_uint16 tbf_ms; +}; +typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type; + +struct rpc_loc_reserved_payload_s_type { + rpc_uint16 data_size; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type; + +enum rpc_loc_ioctl_e_type { + RPC_LOC_IOCTL_GET_API_VERSION = 1, + RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, + RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, + RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, + RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, + RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, + RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, + RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, + RPC_LOC_IOCTL_INJECT_POSITION = 407, + RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, + RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, + RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, + RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411, + RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412, + RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413, + RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, + RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, + RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, + RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, + RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, + RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, + RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, + RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, + RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, + RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, + RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, + RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, + RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, + RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, + RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, + RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, + RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, + RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, + RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824, +}; +typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type; + +struct rpc_loc_api_version_s_type { + u_char major; + u_char minor; +}; +typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type; + +enum rpc_loc_fix_recurrence_e_type { + RPC_LOC_PERIODIC_FIX = 1, + RPC_LOC_SINGLE_FIX = 2, + RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type; + +enum rpc_loc_operation_mode_e_type { + RPC_LOC_OPER_MODE_DEFAULT = 1, + RPC_LOC_OPER_MODE_MSB = 2, + RPC_LOC_OPER_MODE_MSA = 3, + RPC_LOC_OPER_MODE_STANDALONE = 4, + RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, + RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, + RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, + RPC_LOC_OPER_MODE_CELL_ID = 8, + RPC_LOC_OPER_MODE_MAX = 268435456, +}; +typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type; + +enum rpc_loc_notify_e_type { + RPC_LOC_NOTIFY_ON_INTERVAL = 1, + RPC_LOC_NOTIFY_ON_DISTANCE = 2, + RPC_LOC_NOTIFY_ON_ANY = 3, + RPC_LOC_NOTIFY_ON_ALL = 4, + RPC_LOC_NOTIFY_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type; + +struct rpc_loc_fix_criteria_s_type { + rpc_uint32 valid_mask; + rpc_loc_fix_recurrence_e_type recurrence_type; + rpc_loc_operation_mode_e_type preferred_operation_mode; + rpc_uint32 preferred_accuracy; + rpc_uint32 preferred_response_time; + rpc_boolean intermediate_pos_report_enabled; + rpc_loc_notify_e_type notify_type; + rpc_uint32 min_interval; + float min_distance; + rpc_uint32 min_dist_sample_interval; +}; +typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type; + +enum rpc_loc_ni_user_resp_e_type { + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456, +}; +typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type; + +struct rpc_loc_user_verify_s_type { + rpc_loc_ni_user_resp_e_type user_resp; + rpc_loc_ni_event_s_type ni_event_pass_back; +}; +typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type; + +enum rpc_loc_predicted_orbits_data_format_e_type { + RPC_LOC_PREDICTED_ORBITS_XTRA = 0, + RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456, +}; +typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type; + +struct rpc_loc_predicted_orbits_data_s_type { + rpc_loc_predicted_orbits_data_format_e_type format_type; + rpc_uint32 total_size; + rpc_uint8 total_parts; + rpc_uint8 part; + rpc_uint16 part_len; + struct { + u_int data_ptr_len; + char *data_ptr_val; + } data_ptr; +}; +typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type; + +struct rpc_loc_predicted_orbits_data_validity_report_s_type { + rpc_uint64 start_time_utc; + rpc_uint16 valid_duration_hrs; +}; +typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type; + +struct rpc_loc_predicted_orbits_auto_download_config_s_type { + rpc_boolean enable; + u_char auto_check_every_hrs; +}; +typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type; + +struct rpc_loc_assist_data_time_s_type { + rpc_uint64 time_utc; + rpc_uint32 uncertainty; +}; +typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type; + +typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; + +struct rpc_loc_assist_data_pos_s_type { + rpc_loc_assist_pos_valid_mask_type valid_mask; + rpc_uint64 timestamp_utc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float hor_unc_circular; + float vert_unc; + u_char confidence_horizontal; + u_char confidence_vertical; + rpc_int32 timestamp_age; +}; +typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type; + +enum rpc_loc_server_open_status_e_type { + RPC_LOC_SERVER_OPEN_SUCCESS = 1, + RPC_LOC_SERVER_OPEN_FAIL = 2, + RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type; + +struct rpc_loc_server_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + char apn_name[100]; +}; +typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type; + +enum rpc_loc_server_close_status_e_type { + RPC_LOC_SERVER_CLOSE_SUCCESS = 1, + RPC_LOC_SERVER_CLOSE_FAIL = 2, + RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type; + +struct rpc_loc_server_close_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_close_status_e_type close_status; +}; +typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type; + +struct rpc_loc_wiper_fix_time_s_type { + rpc_uint32 slow_clock_count; +}; +typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type; + +struct rpc_loc_wiper_fix_pos_s_type { + rpc_int32 lat; + rpc_int32 lon; + rpc_uint16 HEPE; + rpc_uint8 num_of_aps_used; + rpc_uint8 fix_error_code; +}; +typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type; + +struct rpc_loc_wiper_ap_info_s_type { + char mac_addr[6]; + rpc_int32 rssi; + rpc_uint16 channel; + rpc_uint8 ap_qualifier; +}; +typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type; + +struct rpc_loc_wiper_ap_set_s_type { + rpc_uint8 num_of_aps; + rpc_loc_wiper_ap_info_s_type ap_info[50]; +}; +typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type; + +struct rpc_loc_wiper_position_report_s_type { + rpc_uint8 wiper_valid_info_flag; + rpc_loc_wiper_fix_time_s_type wiper_fix_time; + rpc_loc_wiper_fix_pos_s_type wiper_fix_position; + rpc_loc_wiper_ap_set_s_type wiper_ap_set; +}; +typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type; + +enum rpc_loc_wiper_status_e_type { + RPC_LOC_WIPER_STATUS_AVAILABLE = 1, + RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2, + RPC_LOC_WIPER_STATUS_E_SIZE = 268435456, +}; +typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type; + +enum rpc_loc_fs_operation_e_type { + RPC_LOC_FS_CREATE_WRITE_FILE = 1, + RPC_LOC_FS_APPEND_FILE = 2, + RPC_LOC_FS_DELETE_FILE = 3, + RPC_LOC_FS_READ_FILE = 4, + RPC_LOC_FS_MAX = 268435456, +}; +typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type; + +struct rpc_loc_efs_data_s_type { + char filename[64]; + rpc_loc_fs_operation_e_type operation; + rpc_uint32 total_size; + struct { + u_int data_ptr_len; + char *data_ptr_val; + } data_ptr; + rpc_uint32 part_len; + rpc_uint8 part; + rpc_uint8 total_parts; + rpc_uint32 reserved; +}; +typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type; + +enum rpc_loc_lock_e_type { + RPC_LOC_LOCK_NONE = 1, + RPC_LOC_LOCK_MI = 2, + RPC_LOC_LOCK_MT = 3, + RPC_LOC_LOCK_ALL = 4, + RPC_LOC_LOCK_MAX = 268435456, +}; +typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type; + +typedef rpc_uint32 rpc_loc_nmea_sentence_type; + +typedef rpc_uint32 rpc_loc_assist_data_type; + +struct rpc_loc_assist_data_delete_s_type { + rpc_loc_assist_data_type type; + rpc_uint32 reserved[8]; +}; +typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type; + +struct rpc_loc_ioctl_data_u_type { + rpc_loc_ioctl_e_type disc; + union { + rpc_loc_fix_criteria_s_type fix_criteria; + rpc_loc_user_verify_s_type user_verify_resp; + rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; + rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; + rpc_loc_assist_data_time_s_type assistance_data_time; + rpc_loc_assist_data_pos_s_type assistance_data_position; + rpc_loc_server_open_status_s_type conn_open_status; + rpc_loc_server_close_status_s_type conn_close_status; + rpc_loc_wiper_position_report_s_type wiper_pos; + rpc_loc_wiper_status_e_type wiper_status; + rpc_loc_lock_e_type engine_lock; + rpc_boolean sbas_mode; + rpc_loc_nmea_sentence_type nmea_types; + rpc_boolean on_demand_lpm; + rpc_loc_server_info_s_type server_addr; + rpc_loc_assist_data_delete_s_type assist_data_delete; + rpc_loc_efs_data_s_type efs_data; + } rpc_loc_ioctl_data_u_type_u; +}; +typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type; + +struct rpc_loc_ioctl_callback_data_u_type { + rpc_loc_ioctl_e_type disc; + union { + rpc_loc_api_version_s_type api_version; + rpc_loc_fix_criteria_s_type fix_criteria; + rpc_loc_lock_e_type engine_lock; + rpc_boolean sbas_mode; + rpc_loc_nmea_sentence_type nmea_types; + rpc_boolean on_demand_lpm; + rpc_loc_server_info_s_type server_addr; + rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; + rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; + } rpc_loc_ioctl_callback_data_u_type_u; +}; +typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type; + +struct rpc_loc_ioctl_callback_s_type { + rpc_loc_ioctl_e_type type; + rpc_int32 status; + rpc_loc_ioctl_callback_data_u_type data; +}; +typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type; + +struct rpc_loc_event_payload_u_type { + u_quad_t disc; + union { + rpc_loc_parsed_position_s_type parsed_location_report; + rpc_loc_gnss_info_s_type gnss_report; + rpc_loc_nmea_report_s_type nmea_report; + rpc_loc_ni_event_s_type ni_request; + rpc_loc_assist_data_request_s_type assist_data_request; + rpc_loc_server_request_s_type loc_server_request; + rpc_loc_ioctl_callback_s_type ioctl_report; + rpc_loc_status_event_s_type status_report; + rpc_loc_qwip_request_s_type qwip_request; + rpc_loc_reserved_payload_s_type reserved; + } rpc_loc_event_payload_u_type_u; +}; +typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type; + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*); +extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*); +extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*); +extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*); +extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*); +extern bool_t xdr_rpc_byte (XDR *, rpc_byte*); +extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*); +extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*); +extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*); +extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*); +extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*); +extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*); +extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*); +extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*); +extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*); +extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*); +extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*); +extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*); +extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*); +extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*); +extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*); +extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*); +extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*); +extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*); +extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*); +extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*); +extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*); +extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*); +extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*); +extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*); +extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*); +extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*); +extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*); +extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*); +extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*); +extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*); +extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*); +extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*); +extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*); +extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*); +extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*); +extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*); +extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*); +extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*); +extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers); +extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers); +extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*); +extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*); +extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*); +extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*); +extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*); +extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*); +extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*); +extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*); +extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*); +extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*); +extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*); +extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*); +extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*); +extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*); +extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*); +extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*); +extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*); +extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*); +extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*); +extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*); +extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*); +extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*); +extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*); +extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*); +extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*); +extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*); +extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*); +extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*); +extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*); +extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*); +extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*); +extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*); +extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*); +extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*); +extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*); +extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*); +extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*); +extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*); +extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*); +extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*); +extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*); +extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*); +extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*); +extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*); + +#else /* K&R C */ +extern bool_t xdr_rpc_boolean (); +extern bool_t xdr_rpc_uint32 (); +extern bool_t xdr_rpc_uint16 (); +extern bool_t xdr_rpc_uint8 (); +extern bool_t xdr_rpc_int32 (); +extern bool_t xdr_rpc_byte (); +extern bool_t xdr_rpc_uint64 (); +extern bool_t xdr_rpc_loc_client_handle_type (); +extern bool_t xdr_rpc_loc_event_mask_type (); +extern bool_t xdr_rpc_loc_position_valid_mask_type (); +extern bool_t xdr_rpc_loc_pos_technology_mask_type (); +extern bool_t xdr_rpc_loc_session_status_e_type (); +extern bool_t xdr_rpc_loc_calendar_time_s_type (); +extern bool_t xdr_rpc_loc_parsed_position_s_type (); +extern bool_t xdr_rpc_loc_sv_system_e_type (); +extern bool_t xdr_rpc_loc_sv_status_e_type (); +extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (); +extern bool_t xdr_rpc_loc_sv_info_s_type (); +extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (); +extern bool_t xdr_rpc_loc_gnss_info_s_type (); +extern bool_t xdr_rpc_loc_nmea_report_s_type (); +extern bool_t xdr_rpc_loc_status_event_e_type (); +extern bool_t xdr_rpc_loc_engine_state_e_type (); +extern bool_t xdr_rpc_loc_fix_session_state_e_type (); +extern bool_t xdr_rpc_loc_status_event_payload_u_type (); +extern bool_t xdr_rpc_loc_status_event_s_type (); +extern bool_t xdr_rpc_loc_server_addr_e_type (); +extern bool_t xdr_rpc_loc_server_addr_ipv4_type (); +extern bool_t xdr_rpc_loc_server_addr_url_type (); +extern bool_t xdr_rpc_loc_server_addr_u_type (); +extern bool_t xdr_rpc_loc_server_info_s_type (); +extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (); +extern bool_t xdr_rpc_loc_ni_event_e_type (); +extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (); +extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (); +extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (); +extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (); +extern bool_t xdr_rpc_loc_ni_location_type_e_type (); +extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (); +extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (); +extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (); +extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (); +extern bool_t xdr_rpc_loc_ni_event_payload_u_type (); +extern bool_t xdr_rpc_loc_ni_event_s_type (); +extern bool_t xdr_rpc_loc_assist_data_request_e_type (); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (); +extern bool_t xdr_rpc_loc_time_download_source_s_type (); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (); +extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (); +extern bool_t xdr_rpc_loc_assist_data_request_s_type (); +extern bool_t xdr_rpc_loc_server_connection_handle (); +extern bool_t xdr_rpc_loc_server_protocol_e_type (); +extern bool_t xdr_rpc_loc_server_request_e_type (); +extern bool_t xdr_rpc_loc_server_open_req_s_type (); +extern bool_t xdr_rpc_loc_server_close_req_s_type (); +extern bool_t xdr_rpc_loc_server_request_u_type (); +extern bool_t xdr_rpc_loc_server_request_s_type (); +extern bool_t xdr_rpc_loc_qwip_request_e_type (); +extern bool_t xdr_rpc_loc_qwip_request_s_type (); +extern bool_t xdr_rpc_loc_reserved_payload_s_type (); +extern bool_t xdr_rpc_loc_ioctl_e_type (); +extern bool_t xdr_rpc_loc_api_version_s_type (); +extern bool_t xdr_rpc_loc_fix_recurrence_e_type (); +extern bool_t xdr_rpc_loc_operation_mode_e_type (); +extern bool_t xdr_rpc_loc_notify_e_type (); +extern bool_t xdr_rpc_loc_fix_criteria_s_type (); +extern bool_t xdr_rpc_loc_ni_user_resp_e_type (); +extern bool_t xdr_rpc_loc_user_verify_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (); +extern bool_t xdr_rpc_loc_assist_data_time_s_type (); +extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (); +extern bool_t xdr_rpc_loc_assist_data_pos_s_type (); +extern bool_t xdr_rpc_loc_server_open_status_e_type (); +extern bool_t xdr_rpc_loc_server_open_status_s_type (); +extern bool_t xdr_rpc_loc_server_close_status_e_type (); +extern bool_t xdr_rpc_loc_server_close_status_s_type (); +extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (); +extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (); +extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (); +extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (); +extern bool_t xdr_rpc_loc_wiper_position_report_s_type (); +extern bool_t xdr_rpc_loc_wiper_status_e_type (); +extern bool_t xdr_rpc_loc_fs_operation_e_type (); +extern bool_t xdr_rpc_loc_efs_data_s_type (); +extern bool_t xdr_rpc_loc_lock_e_type (); +extern bool_t xdr_rpc_loc_nmea_sentence_type (); +extern bool_t xdr_rpc_loc_assist_data_type (); +extern bool_t xdr_rpc_loc_assist_data_delete_s_type (); +extern bool_t xdr_rpc_loc_ioctl_data_u_type (); +extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (); +extern bool_t xdr_rpc_loc_ioctl_callback_s_type (); +extern bool_t xdr_rpc_loc_event_payload_u_type (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_COMMON_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h new file mode 100644 index 00000000..e62eb367 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h @@ -0,0 +1,188 @@ +/****************************************************************************** + @file: loc_api_fixup.h + @brief: Loc API Android RPC amendment header + + DESCRIPTION + Loc API Android RPC amendment header + + INITIALIZATION AND SEQUENCING REQUIREMENTS + + ----------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ----------------------------------------------------------------------------- + ******************************************************************************/ + +#ifndef LOC_API_FIXUP_H +#define LOC_API_FIXUP_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef NULLPROC +#define NULLPROC 0 +#endif /* NULLPROC */ + +#ifdef ADD_XDR_FLOAT + +extern bool_t xdr_float (XDR *__xdrs, float *__fp); +extern bool_t xdr_double (XDR *__xdrs, double *__dp); + +#endif /* ADD_XDR_FLOAT */ + +#ifdef ADD_XDR_BOOL +extern bool_t xdr_bool(XDR *__xdrs, int *__bp); +#endif /* ADD_XDR_BOOL */ + +#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1 +#define RPC_LOC_API_MINOR_VERSION_NUMBER 0 + +// Return value for loc_open in case of failure. +#define RPC_LOC_CLIENT_HANDLE_INVALID -1 + +// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl +// These are also the status for the ioctl callback +#define RPC_LOC_API_SUCCESS 0 +#define RPC_LOC_API_GENERAL_FAILURE 1 +#define RPC_LOC_API_UNSUPPORTED 2 +#define RPC_LOC_API_INVALID_HANDLE 4 +#define RPC_LOC_API_INVALID_PARAMETER 5 +#define RPC_LOC_API_ENGINE_BUSY 6 +#define RPC_LOC_API_PHONE_OFFLINE 7 +#define RPC_LOC_API_TIMEOUT 8 + +// Special return value for loc api calls in case of RCP failure +#define RPC_LOC_API_RPC_FAILURE (-1234) + +#define RPC_LOC_API_MAX_SV_COUNT 80 +#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200 + +// Maximum server address that will be used in location API +#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256 +#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3 +#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3 + +#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type +#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report +#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate +#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate +#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request +#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request +#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server +#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl +#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state + + +#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001 +#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002 +#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004 +#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008 +#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010 +#define RPC_LOC_POS_VALID_LATITUDE 0x00000020 +#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040 +#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080 +#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100 +#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200 +#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400 +#define RPC_LOC_POS_VALID_HEADING 0x00000800 +#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000 +#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000 +#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000 +#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000 +#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000 +#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000 +#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000 +#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000 + +#define RPC_LOC_POS_TECH_SATELLITE 0x00000001 +#define RPC_LOC_POS_TECH_CELLID 0x00000002 +#define RPC_LOC_POS_TECH_WIFI 0x00000004 + +#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001 +#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002 +#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004 +#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008 +#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010 +#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020 +#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040 +#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080 +#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100 + +#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001 +#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002 +#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004 +#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008 +#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010 +#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020 + +#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200 +#define RPC_LOC_NI_SUPL_HASH_LENGTH 8 +#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4 +#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64 +#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20 +#define RPC_LOC_NI_CODEWORD_LENGTH 20 + +#define RPC_LOC_NI_SUPL_QOP_VALID 0x01 +#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02 +#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04 +#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08 + +#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008 +#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010 +#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020 +#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040 +#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080 +#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100 + +#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001 +#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002 +#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004 +#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008 +#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010 +#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020 +#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040 +#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080 +#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100 + +#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF + +#define RPC_LOC_NMEA_MASK_ALL 0xffff +#define RPC_LOC_NMEA_MASK_GGA 0x0001 +#define RPC_LOC_NMEA_MASK_RMC 0x0002 +#define RPC_LOC_NMEA_MASK_GSV 0x0004 +#define RPC_LOC_NMEA_MASK_GSA 0x0008 +#define RPC_LOC_NMEA_MASK_VTG 0x0010 + +/* flags for notification */ +#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001 +#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002 +#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010 +#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020 +#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040 +#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080 +#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100 + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_FIXUP_H */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h new file mode 100644 index 00000000..92d4e150 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h @@ -0,0 +1,34 @@ +/* ------------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ------------------------------------------------------------------------------- + */ + +#ifndef LOC_APICB_APPINIT_H +#define LOC_APICB_APPINIT_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Initialization function for callbacks */ +extern int loc_apicb_app_init(); +extern void loc_apicb_app_deinit(); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_APICB_APPINIT_H */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api.h b/loc_api/libloc_api-rpc/inc-3200/loc_api.h new file mode 100644 index 00000000..8998aca4 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-3200/loc_api.h @@ -0,0 +1,198 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_H_RPCGEN +#define _LOC_API_H_RPCGEN + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct { + u_int rpc_loc_api_api_versions_return_type_len; + rpc_uint32 *rpc_loc_api_api_versions_return_type_val; +} rpc_loc_api_api_versions_return_type; + +typedef rpc_uint32 rpc_loc_event_cb_f_type; + +struct rpc_loc_open_args { + rpc_loc_event_mask_type event_reg_mask; + rpc_loc_event_cb_f_type event_callback; +}; +typedef struct rpc_loc_open_args rpc_loc_open_args; + +struct rpc_loc_close_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_close_args rpc_loc_close_args; + +struct rpc_loc_start_fix_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args; + +struct rpc_loc_stop_fix_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args; + +struct rpc_loc_ioctl_args { + rpc_loc_client_handle_type handle; + rpc_loc_ioctl_e_type ioctl_type; + rpc_loc_ioctl_data_u_type *ioctl_data; +}; +typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args; + +struct rpc_loc_api_api_version_s_args { + rpc_boolean len_not_null; +}; +typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args; + +struct rpc_loc_api_rpc_glue_code_info_remote_rets { + rpc_uint32 toolvers; + rpc_uint32 features; + rpc_uint32 proghash; + rpc_uint32 cbproghash; +}; +typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets; + +struct rpc_loc_open_rets { + rpc_loc_client_handle_type loc_open_result; +}; +typedef struct rpc_loc_open_rets rpc_loc_open_rets; + +struct rpc_loc_close_rets { + rpc_int32 loc_close_result; +}; +typedef struct rpc_loc_close_rets rpc_loc_close_rets; + +struct rpc_loc_start_fix_rets { + rpc_int32 loc_start_fix_result; +}; +typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets; + +struct rpc_loc_stop_fix_rets { + rpc_int32 loc_stop_fix_result; +}; +typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets; + +struct rpc_loc_ioctl_rets { + rpc_int32 loc_ioctl_result; +}; +typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets; + +struct rpc_loc_api_api_versions_rets { + rpc_loc_api_api_versions_return_type loc_api_api_versions_result; + rpc_uint32 *len; +}; +typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets; +#define LOC_APIVERS 0x00010001 + +#define LOC_APIPROG 0x3000008c +#define LOC_APIVERS_0001 0x00010001 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_api_null 0 +extern enum clnt_stat rpc_loc_api_null_0x00010001(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00010001_svc(void *, void *, struct svc_req *); +#define rpc_loc_api_rpc_glue_code_info_remote 1 +extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *); +extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *); +#define rpc_loc_open 2 +extern enum clnt_stat rpc_loc_open_0x00010001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *); +extern bool_t rpc_loc_open_0x00010001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *); +#define rpc_loc_close 3 +extern enum clnt_stat rpc_loc_close_0x00010001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *); +extern bool_t rpc_loc_close_0x00010001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *); +#define rpc_loc_start_fix 4 +extern enum clnt_stat rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *); +extern bool_t rpc_loc_start_fix_0x00010001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *); +#define rpc_loc_stop_fix 5 +extern enum clnt_stat rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *); +extern bool_t rpc_loc_stop_fix_0x00010001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *); +#define rpc_loc_ioctl 6 +extern enum clnt_stat rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *); +extern bool_t rpc_loc_ioctl_0x00010001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *); +#define rpc_loc_api_api_versions 0xFFFFFFFF +extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(void *, rpc_loc_api_api_versions_rets *, CLIENT *); +extern bool_t rpc_loc_api_api_versions_0x00010001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *); +extern int loc_apiprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_api_null 0 +extern enum clnt_stat rpc_loc_api_null_0x00010001(); +extern bool_t rpc_loc_api_null_0x00010001_svc(); +#define rpc_loc_api_rpc_glue_code_info_remote 1 +extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(); +extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(); +#define rpc_loc_open 2 +extern enum clnt_stat rpc_loc_open_0x00010001(); +extern bool_t rpc_loc_open_0x00010001_svc(); +#define rpc_loc_close 3 +extern enum clnt_stat rpc_loc_close_0x00010001(); +extern bool_t rpc_loc_close_0x00010001_svc(); +#define rpc_loc_start_fix 4 +extern enum clnt_stat rpc_loc_start_fix_0x00010001(); +extern bool_t rpc_loc_start_fix_0x00010001_svc(); +#define rpc_loc_stop_fix 5 +extern enum clnt_stat rpc_loc_stop_fix_0x00010001(); +extern bool_t rpc_loc_stop_fix_0x00010001_svc(); +#define rpc_loc_ioctl 6 +extern enum clnt_stat rpc_loc_ioctl_0x00010001(); +extern bool_t rpc_loc_ioctl_0x00010001_svc(); +#define rpc_loc_api_api_versions 0xFFFFFFFF +extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(); +extern bool_t rpc_loc_api_api_versions_0x00010001_svc(); +extern int loc_apiprog_0x00010001_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*); +extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*); +extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*); +extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*); +extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*); +extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*); +extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*); +extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*); +extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*); +extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*); +extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*); +extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*); +extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*); +extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*); +extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_api_api_versions_return_type (); +extern bool_t xdr_rpc_loc_event_cb_f_type (); +extern bool_t xdr_rpc_loc_open_args (); +extern bool_t xdr_rpc_loc_close_args (); +extern bool_t xdr_rpc_loc_start_fix_args (); +extern bool_t xdr_rpc_loc_stop_fix_args (); +extern bool_t xdr_rpc_loc_ioctl_args (); +extern bool_t xdr_rpc_loc_api_api_version_s_args (); +extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (); +extern bool_t xdr_rpc_loc_open_rets (); +extern bool_t xdr_rpc_loc_close_rets (); +extern bool_t xdr_rpc_loc_start_fix_rets (); +extern bool_t xdr_rpc_loc_stop_fix_rets (); +extern bool_t xdr_rpc_loc_ioctl_rets (); +extern bool_t xdr_rpc_loc_api_api_versions_rets (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h new file mode 100644 index 00000000..4f2f8f91 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h @@ -0,0 +1,64 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_CB_H_RPCGEN +#define _LOC_API_CB_H_RPCGEN + +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +struct rpc_loc_event_cb_f_type_args { + rpc_uint32 cb_id; + rpc_loc_client_handle_type loc_handle; + rpc_loc_event_mask_type loc_event; + rpc_loc_event_payload_u_type *loc_event_payload; +}; +typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args; + +struct rpc_loc_event_cb_f_type_rets { + rpc_int32 loc_event_cb_f_type_result; +}; +typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets; +#define LOC_APICBVERS 0x00010001 + +#define LOC_APICBPROG 0x3100008c +#define LOC_APICBVERS_0001 0x00010001 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_event_cb_f_type 1 +extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *); +extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *); +extern int loc_apicbprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_event_cb_f_type 1 +extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(); +extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(); +extern int loc_apicbprog_0x00010001_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*); +extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_event_cb_f_type_args (); +extern bool_t xdr_rpc_loc_event_cb_f_type_rets (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_CB_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h new file mode 100644 index 00000000..04be079f --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h @@ -0,0 +1,1031 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_COMMON_H_RPCGEN +#define _LOC_API_COMMON_H_RPCGEN + +#include +#include "loc_api_fixup.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 +#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 +#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 +#define RPC_LOC_EVENT_RESERVED 0x8000000000000000 +#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 +#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 +#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 +#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 +#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 +#define RPC_LOC_OPEN_VERSION 0x00010001 +#define RPC_LOC_CLOSE_VERSION 0x00010001 +#define RPC_LOC_START_FIX_VERSION 0x00010001 +#define RPC_LOC_STOP_FIX_VERSION 0x00010001 +#define RPC_LOC_IOCTL_VERSION 0x00010001 +#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00010001 +#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0 +#define RPC_LOC_API_API_MAJOR_NUM 0x0001 + +typedef bool_t rpc_boolean; + +typedef u_long rpc_uint32; + +typedef u_short rpc_uint16; + +typedef u_char rpc_uint8; + +typedef long rpc_int32; + +typedef u_char rpc_byte; + +typedef u_quad_t rpc_uint64; + +typedef rpc_int32 rpc_loc_client_handle_type; + +typedef rpc_uint64 rpc_loc_event_mask_type; + +typedef rpc_uint64 rpc_loc_position_valid_mask_type; + +typedef rpc_uint32 rpc_loc_pos_technology_mask_type; + +enum rpc_loc_session_status_e_type { + RPC_LOC_SESS_STATUS_SUCCESS = 0, + RPC_LOC_SESS_STATUS_IN_PROGESS = 1, + RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, + RPC_LOC_SESS_STATUS_TIMEOUT = 3, + RPC_LOC_SESS_STATUS_USER_END = 4, + RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, + RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, + RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, + RPC_LOC_SESS_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type; + +struct rpc_loc_calendar_time_s_type { + rpc_uint16 year; + u_char month; + u_char day_of_week; + u_char day; + u_char hour; + u_char minute; + u_char second; + rpc_uint16 millisecond; +}; +typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type; + +struct rpc_loc_parsed_position_s_type { + rpc_loc_position_valid_mask_type valid_mask; + rpc_loc_session_status_e_type session_status; + rpc_loc_calendar_time_s_type timestamp_calendar; + rpc_uint64 timestamp_utc; + rpc_uint8 leap_seconds; + float time_unc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float speed_horizontal; + float speed_vertical; + float heading; + float hor_unc_circular; + float hor_unc_ellipse_semi_major; + float hor_unc_ellipse_semi_minor; + float hor_unc_ellipse_orient_azimuth; + float vert_unc; + float speed_unc; + float heading_unc; + u_char confidence_horizontal; + u_char confidence_vertical; + float magnetic_deviation; + rpc_loc_pos_technology_mask_type technology_mask; +}; +typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type; + +enum rpc_loc_sv_system_e_type { + RPC_LOC_SV_SYSTEM_GPS = 1, + RPC_LOC_SV_SYSTEM_GALILEO = 2, + RPC_LOC_SV_SYSTEM_SBAS = 3, + RPC_LOC_SV_SYSTEM_COMPASS = 4, + RPC_LOC_SV_SYSTEM_GLONASS = 5, + RPC_LOC_SV_SYSTEM_MAX = 268435456, +}; +typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type; + +enum rpc_loc_sv_status_e_type { + RPC_LOC_SV_STATUS_IDLE = 1, + RPC_LOC_SV_STATUS_SEARCH = 2, + RPC_LOC_SV_STATUS_TRACK = 3, + RPC_LOC_SV_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type; + +typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; + +struct rpc_loc_sv_info_s_type { + rpc_loc_sv_info_valid_mask_type valid_mask; + rpc_loc_sv_system_e_type system; + rpc_uint8 prn; + rpc_uint8 health_status; + rpc_loc_sv_status_e_type process_status; + rpc_boolean has_eph; + rpc_boolean has_alm; + float elevation; + float azimuth; + float snr; +}; +typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type; + +typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; + +struct rpc_loc_gnss_info_s_type { + rpc_loc_gnss_info_valid_mask_type valid_mask; + float position_dop; + float horizontal_dop; + float vertical_dop; + rpc_boolean altitude_assumed; + rpc_uint16 sv_count; + struct { + u_int sv_list_len; + rpc_loc_sv_info_s_type *sv_list_val; + } sv_list; +}; +typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type; + +struct rpc_loc_nmea_report_s_type { + rpc_uint16 length; + struct { + u_int nmea_sentences_len; + char *nmea_sentences_val; + } nmea_sentences; +}; +typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type; + +enum rpc_loc_status_event_e_type { + RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, + RPC_LOC_STATUS_EVENT_MAX = 268435456, +}; +typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type; + +enum rpc_loc_engine_state_e_type { + RPC_LOC_ENGINE_STATE_ON = 1, + RPC_LOC_ENGINE_STATE_OFF = 2, + RPC_LOC_ENGINE_STATE_MAX = 268435456, +}; +typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type; + +struct rpc_loc_status_event_payload_u_type { + rpc_loc_status_event_e_type disc; + union { + rpc_loc_engine_state_e_type engine_state; + } rpc_loc_status_event_payload_u_type_u; +}; +typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type; + +struct rpc_loc_status_event_s_type { + rpc_loc_status_event_e_type event; + rpc_loc_status_event_payload_u_type payload; +}; +typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type; + +enum rpc_loc_server_addr_e_type { + RPC_LOC_SERVER_ADDR_IPV4 = 1, + RPC_LOC_SERVER_ADDR_URL = 2, + RPC_LOC_SERVER_ADDR_MAX = 268435456, +}; +typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type; + +struct rpc_loc_server_addr_ipv4_type { + rpc_uint32 addr; + rpc_uint16 port; +}; +typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type; + +struct rpc_loc_server_addr_url_type { + rpc_uint16 length; + struct { + u_int addr_len; + char *addr_val; + } addr; +}; +typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type; + +struct rpc_loc_server_addr_u_type { + rpc_loc_server_addr_e_type disc; + union { + rpc_loc_server_addr_ipv4_type ipv4; + rpc_loc_server_addr_url_type url; + } rpc_loc_server_addr_u_type_u; +}; +typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type; + +struct rpc_loc_server_info_s_type { + rpc_loc_server_addr_e_type addr_type; + rpc_loc_server_addr_u_type addr_info; +}; +typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type; + +enum rpc_loc_ni_notify_verify_e_type { + RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, + RPC_LOC_NI_USER_NOTIFY_ONLY = 2, + RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, + RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, + RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, + RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type; + +enum rpc_loc_ni_event_e_type { + RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, + RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, + RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, + RPC_LOC_NI_EVENT_MAX = 268435456, +}; +typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type; + +enum rpc_loc_ni_datacoding_scheme_e_type { + RPC_LOC_NI_PRESUPL_ISO646IRV = 0, + RPC_LOC_NI_PRESUPL_ISO8859 = 1, + RPC_LOC_NI_PRESUPL_UTF8 = 2, + RPC_LOC_NI_PRESUPL_UTF16 = 3, + RPC_LOC_NI_PRESUPL_UCS2 = 4, + RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, + RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, + RPC_LOC_NI_PRESUPL_JIS = 7, + RPC_LOC_NI_PRESUPL_EUC = 8, + RPC_LOC_NI_PRESUPL_GB2312 = 9, + RPC_LOC_NI_PRESUPL_CNS11643 = 10, + RPC_LOC_NI_PRESUPL_KSC1001 = 11, + RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, + RPC_LOC_NI_SS_GERMAN = 12, + RPC_LOC_NI_SS_ENGLISH = 13, + RPC_LOC_NI_SS_ITALIAN = 14, + RPC_LOC_NI_SS_FRENCH = 15, + RPC_LOC_NI_SS_SPANISH = 16, + RPC_LOC_NI_SS_DUTCH = 17, + RPC_LOC_NI_SS_SWEDISH = 18, + RPC_LOC_NI_SS_DANISH = 19, + RPC_LOC_NI_SS_PORTUGUESE = 20, + RPC_LOC_NI_SS_FINNISH = 21, + RPC_LOC_NI_SS_NORWEGIAN = 22, + RPC_LOC_NI_SS_GREEK = 23, + RPC_LOC_NI_SS_TURKISH = 24, + RPC_LOC_NI_SS_HUNGARIAN = 25, + RPC_LOC_NI_SS_POLISH = 26, + RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, + RPC_LOC_NI_SUPL_UTF8 = 28, + RPC_LOC_NI_SUPL_UCS2 = 29, + RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, + RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647, +}; +typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type; + +enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { + RPC_LOC_NI_VX_OCTET = 0, + RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, + RPC_LOC_NI_VX_ASCII = 2, + RPC_LOC_NI_VX_IA5 = 3, + RPC_LOC_NI_VX_UNICODE = 4, + RPC_LOC_NI_VX_SHIFT_JIS = 5, + RPC_LOC_NI_VX_KOREAN = 6, + RPC_LOC_NI_VX_LATIN_HEBREW = 7, + RPC_LOC_NI_VX_LATIN = 8, + RPC_LOC_NI_VX_GSM = 9, + RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type; + +enum rpc_loc_ni_vx_pos_mode_e_type { + RPC_LOC_VX_MS_ASSISTED_ONLY = 1, + RPC_LOC_VX_MS_BASED_ONLY = 2, + RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, + RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, + RPC_LOC_VX_POS_MODE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type; + +struct rpc_loc_ni_vx_requester_id_s_type { + u_char requester_id_length; + char requester_id[200]; +}; +typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type; + +struct rpc_loc_ni_vx_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + u_char pos_qos_incl; + u_char pos_qos; + rpc_uint32 num_fixes; + rpc_uint32 tbf; + rpc_loc_ni_vx_pos_mode_e_type pos_mode; + rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; + rpc_loc_ni_vx_requester_id_s_type requester_id; + rpc_uint16 user_resp_timer_val; +}; +typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type; + +enum rpc_loc_ni_supl_pos_method_e_type { + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, + RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, + RPC_LOC_NI_POSMETHOD_AFLT = 6, + RPC_LOC_NI_POSMETHOD_ECID = 7, + RPC_LOC_NI_POSMETHOD_EOTD = 8, + RPC_LOC_NI_POSMETHOD_OTDOA = 9, + RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, + RPC_LOC_NI_POSMETHOD_MAX = 268435456, +}; +typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type; + +struct rpc_loc_ni_supl_slp_session_id_s_type { + u_char presence; + char session_id[4]; + rpc_loc_server_info_s_type slp_address; +}; +typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type; + +struct rpc_loc_ni_requestor_id_s_type { + u_char data_coding_scheme; + struct { + u_int requestor_id_string_len; + char *requestor_id_string_val; + } requestor_id_string; + u_char string_len; +}; +typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type; + +struct rpc_loc_ni_supl_client_name_s_type { + u_char data_coding_scheme; + struct { + u_int client_name_string_len; + char *client_name_string_val; + } client_name_string; + u_char string_len; +}; +typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type; + +struct rpc_loc_ni_supl_qop_s_type { + u_char bit_mask; + u_char horacc; + u_char veracc; + u_char maxLocAge; + u_char delay; +}; +typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type; + +struct rpc_loc_ni_supl_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + rpc_uint16 flags; + rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; + char supl_hash[8]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_supl_pos_method_e_type pos_method; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_supl_client_name_s_type client_name; + rpc_loc_ni_supl_qop_s_type supl_qop; + rpc_uint16 user_response_timer; +}; +typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type; + +struct rpc_loc_ni_ext_client_address_s_type { + u_char ext_client_address_len; + struct { + u_int ext_client_address_len; + char *ext_client_address_val; + } ext_client_address; +}; +typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type; + +enum rpc_loc_ni_location_type_e_type { + RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, + RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, + RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, + RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type; + +struct rpc_loc_ni_deferred_location_s_type { + u_char unused_bits; + u_char ms_available; +}; +typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type; + +struct rpc_loc_ni_codeword_string_s_type { + u_char data_coding_scheme; + struct { + u_int lcs_codeword_string_len; + char *lcs_codeword_string_val; + } lcs_codeword_string; + u_char string_len; +}; +typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type; + +struct rpc_loc_ni_service_type_id_s_type { + u_char lcs_service_type_id; +}; +typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type; + +struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + u_char invoke_id; + rpc_uint16 flags; + u_char notification_length; + struct { + u_int notification_text_len; + char *notification_text_val; + } notification_text; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_ext_client_address_s_type ext_client_address_data; + rpc_loc_ni_location_type_e_type location_type; + rpc_loc_ni_deferred_location_s_type deferred_location; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_codeword_string_s_type codeword_string; + rpc_loc_ni_service_type_id_s_type service_type_id; + rpc_uint16 user_response_timer; +}; +typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type; + +struct rpc_loc_ni_event_payload_u_type { + rpc_loc_ni_event_e_type disc; + union { + rpc_loc_ni_vx_notify_verify_req_s_type vx_req; + rpc_loc_ni_supl_notify_verify_req_s_type supl_req; + rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; + } rpc_loc_ni_event_payload_u_type_u; +}; +typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type; + +struct rpc_loc_ni_event_s_type { + rpc_loc_ni_event_e_type event; + rpc_loc_ni_event_payload_u_type payload; +}; +typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type; + +enum rpc_loc_assist_data_request_e_type { + RPC_LOC_ASSIST_DATA_TIME_REQ = 1, + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, + RPC_LOC_ASSIST_DATA_MAX = 268435456, +}; +typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type; + +typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr; + +typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; + +struct rpc_loc_time_download_source_s_type { + rpc_uint32 delay_threshold; + rpc_struct_loc_time_download_source_s_type_servers servers; +}; +typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type; + +typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; + +typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; + +struct rpc_loc_predicted_orbits_data_source_s_type { + rpc_uint32 max_file_size; + rpc_uint32 max_part_size; + rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; +}; +typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type; + +struct rpc_loc_assist_data_request_payload_u_type { + rpc_loc_assist_data_request_e_type disc; + union { + rpc_loc_time_download_source_s_type time_download; + rpc_loc_predicted_orbits_data_source_s_type data_download; + } rpc_loc_assist_data_request_payload_u_type_u; +}; +typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type; + +struct rpc_loc_assist_data_request_s_type { + rpc_loc_assist_data_request_e_type event; + rpc_loc_assist_data_request_payload_u_type payload; +}; +typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type; + +typedef rpc_uint32 rpc_loc_server_connection_handle; + +enum rpc_loc_server_protocol_e_type { + RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, + RPC_LOC_SERVER_PROTOCOL_SUPL = 1, + RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, + RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, + RPC_LOC_SERVER_PROTOCOL_MAX = 16777216, +}; +typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type; + +enum rpc_loc_server_request_e_type { + RPC_LOC_SERVER_REQUEST_OPEN = 1, + RPC_LOC_SERVER_REQUEST_CLOSE = 2, + RPC_LOC_SERVER_REQUEST_MAX = 268435456, +}; +typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type; + +struct rpc_loc_server_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; +}; +typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type; + +struct rpc_loc_server_close_req_s_type { + rpc_loc_server_connection_handle conn_handle; +}; +typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type; + +struct rpc_loc_server_request_u_type { + rpc_loc_server_request_e_type disc; + union { + rpc_loc_server_open_req_s_type open_req; + rpc_loc_server_close_req_s_type close_req; + } rpc_loc_server_request_u_type_u; +}; +typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type; + +struct rpc_loc_server_request_s_type { + rpc_loc_server_request_e_type event; + rpc_loc_server_request_u_type payload; +}; +typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type; + +struct rpc_loc_reserved_payload_s_type { + rpc_uint16 data_size; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type; + +enum rpc_loc_ioctl_e_type { + RPC_LOC_IOCTL_GET_API_VERSION = 1, + RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, + RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, + RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, + RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, + RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, + RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, + RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, + RPC_LOC_IOCTL_INJECT_POSITION = 407, + RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, + RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, + RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, + RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, + RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, + RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, + RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, + RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, + RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, + RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, + RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, + RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, + RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, + RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, + RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, + RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, + RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, + RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, + RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, + RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, + RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, + RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824, +}; +typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type; + +struct rpc_loc_api_version_s_type { + u_char major; + u_char minor; +}; +typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type; + +enum rpc_loc_fix_recurrence_e_type { + RPC_LOC_PERIODIC_FIX = 1, + RPC_LOC_SINGLE_FIX = 2, + RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type; + +enum rpc_loc_operation_mode_e_type { + RPC_LOC_OPER_MODE_DEFAULT = 1, + RPC_LOC_OPER_MODE_MSB = 2, + RPC_LOC_OPER_MODE_MSA = 3, + RPC_LOC_OPER_MODE_STANDALONE = 4, + RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, + RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, + RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, + RPC_LOC_OPER_MODE_MAX = 268435456, +}; +typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type; + +enum rpc_loc_notify_e_type { + RPC_LOC_NOTIFY_ON_INTERVAL = 1, + RPC_LOC_NOTIFY_ON_DISTANCE = 2, + RPC_LOC_NOTIFY_ON_ANY = 3, + RPC_LOC_NOTIFY_ON_ALL = 4, + RPC_LOC_NOTIFY_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type; + +struct rpc_loc_fix_criteria_s_type { + rpc_uint32 valid_mask; + rpc_loc_fix_recurrence_e_type recurrence_type; + rpc_loc_operation_mode_e_type preferred_operation_mode; + rpc_uint32 preferred_accuracy; + rpc_uint32 preferred_response_time; + rpc_boolean intermediate_pos_report_enabled; + rpc_loc_notify_e_type notify_type; + rpc_uint32 min_interval; + float min_distance; + rpc_uint32 min_dist_sample_interval; +}; +typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type; + +enum rpc_loc_ni_user_resp_e_type { + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456, +}; +typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type; + +struct rpc_loc_user_verify_s_type { + rpc_loc_ni_user_resp_e_type user_resp; + rpc_loc_ni_event_s_type ni_event_pass_back; +}; +typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type; + +enum rpc_loc_predicted_orbits_data_format_e_type { + RPC_LOC_PREDICTED_ORBITS_XTRA = 0, + RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456, +}; +typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type; + +struct rpc_loc_predicted_orbits_data_s_type { + rpc_loc_predicted_orbits_data_format_e_type format_type; + rpc_uint32 total_size; + rpc_uint8 total_parts; + rpc_uint8 part; + rpc_uint16 part_len; + struct { + u_int data_ptr_len; + char *data_ptr_val; + } data_ptr; +}; +typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type; + +struct rpc_loc_predicted_orbits_data_validity_report_s_type { + rpc_uint64 start_time_utc; + rpc_uint16 valid_duration_hrs; +}; +typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type; + +struct rpc_loc_predicted_orbits_auto_download_config_s_type { + rpc_boolean enable; + u_char auto_check_every_hrs; +}; +typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type; + +struct rpc_loc_assist_data_time_s_type { + rpc_uint64 time_utc; + rpc_uint32 uncertainty; +}; +typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type; + +typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; + +struct rpc_loc_assist_data_pos_s_type { + rpc_loc_assist_pos_valid_mask_type valid_mask; + rpc_uint64 timestamp_utc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float hor_unc_circular; + float vert_unc; + u_char confidence_horizontal; + u_char confidence_vertical; +}; +typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type; + +enum rpc_loc_server_open_status_e_type { + RPC_LOC_SERVER_OPEN_SUCCESS = 1, + RPC_LOC_SERVER_OPEN_FAIL = 2, + RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type; + +struct rpc_loc_server_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + char *apn_name; +}; +typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type; + +enum rpc_loc_server_close_status_e_type { + RPC_LOC_SERVER_CLOSE_SUCCESS = 1, + RPC_LOC_SERVER_CLOSE_FAIL = 2, + RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type; + +struct rpc_loc_server_close_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_close_status_e_type close_status; +}; +typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type; + +enum rpc_loc_lock_e_type { + RPC_LOC_LOCK_NONE = 1, + RPC_LOC_LOCK_MI = 2, + RPC_LOC_LOCK_MT = 3, + RPC_LOC_LOCK_ALL = 4, + RPC_LOC_LOCK_MAX = 268435456, +}; +typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type; + +typedef rpc_uint32 rpc_loc_nmea_sentence_type; + +typedef rpc_uint32 rpc_loc_assist_data_type; + +struct rpc_loc_assist_data_delete_s_type { + rpc_loc_assist_data_type type; + rpc_uint32 reserved[8]; +}; +typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type; + +struct rpc_loc_ioctl_data_u_type { + rpc_loc_ioctl_e_type disc; + union { + rpc_loc_fix_criteria_s_type fix_criteria; + rpc_loc_user_verify_s_type user_verify_resp; + rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; + rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; + rpc_loc_assist_data_time_s_type assistance_data_time; + rpc_loc_assist_data_pos_s_type assistance_data_position; + rpc_loc_server_open_status_s_type conn_open_status; + rpc_loc_server_close_status_s_type conn_close_status; + rpc_loc_lock_e_type engine_lock; + rpc_boolean sbas_mode; + rpc_loc_nmea_sentence_type nmea_types; + rpc_boolean on_demand_lpm; + rpc_loc_server_info_s_type server_addr; + rpc_loc_assist_data_delete_s_type assist_data_delete; + } rpc_loc_ioctl_data_u_type_u; +}; +typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type; + +struct rpc_loc_ioctl_callback_data_u_type { + rpc_loc_ioctl_e_type disc; + union { + rpc_loc_api_version_s_type api_version; + rpc_loc_fix_criteria_s_type fix_criteria; + rpc_loc_lock_e_type engine_lock; + rpc_boolean sbas_mode; + rpc_loc_nmea_sentence_type nmea_types; + rpc_boolean on_demand_lpm; + rpc_loc_server_info_s_type server_addr; + rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; + rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; + } rpc_loc_ioctl_callback_data_u_type_u; +}; +typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type; + +struct rpc_loc_ioctl_callback_s_type { + rpc_loc_ioctl_e_type type; + rpc_int32 status; + rpc_loc_ioctl_callback_data_u_type data; +}; +typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type; + +struct rpc_loc_event_payload_u_type { + u_quad_t disc; + union { + rpc_loc_parsed_position_s_type parsed_location_report; + rpc_loc_gnss_info_s_type gnss_report; + rpc_loc_nmea_report_s_type nmea_report; + rpc_loc_ni_event_s_type ni_request; + rpc_loc_assist_data_request_s_type assist_data_request; + rpc_loc_server_request_s_type loc_server_request; + rpc_loc_ioctl_callback_s_type ioctl_report; + rpc_loc_status_event_s_type status_report; + rpc_loc_reserved_payload_s_type reserved; + } rpc_loc_event_payload_u_type_u; +}; +typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type; +#define RPC_LOC_API_NULL_VERSION 0x00010001 +#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00010001 + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*); +extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*); +extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*); +extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*); +extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*); +extern bool_t xdr_rpc_byte (XDR *, rpc_byte*); +extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*); +extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*); +extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*); +extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*); +extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*); +extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*); +extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*); +extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*); +extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*); +extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*); +extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*); +extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*); +extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*); +extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*); +extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*); +extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*); +extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*); +extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*); +extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*); +extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*); +extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*); +extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*); +extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*); +extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*); +extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*); +extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*); +extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*); +extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*); +extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*); +extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*); +extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*); +extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*); +extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*); +extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*); +extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*); +extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*); +extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers); +extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers); +extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*); +extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*); +extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*); +extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*); +extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*); +extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*); +extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*); +extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*); +extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*); +extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*); +extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*); +extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*); +extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*); +extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*); +extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*); +extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*); +extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*); +extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*); +extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*); +extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*); +extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*); +extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*); +extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*); +extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*); +extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*); +extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*); +extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*); +extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*); +extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*); +extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*); +extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*); +extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*); +extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*); +extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*); + +#else /* K&R C */ +extern bool_t xdr_rpc_boolean (); +extern bool_t xdr_rpc_uint32 (); +extern bool_t xdr_rpc_uint16 (); +extern bool_t xdr_rpc_uint8 (); +extern bool_t xdr_rpc_int32 (); +extern bool_t xdr_rpc_byte (); +extern bool_t xdr_rpc_uint64 (); +extern bool_t xdr_rpc_loc_client_handle_type (); +extern bool_t xdr_rpc_loc_event_mask_type (); +extern bool_t xdr_rpc_loc_position_valid_mask_type (); +extern bool_t xdr_rpc_loc_pos_technology_mask_type (); +extern bool_t xdr_rpc_loc_session_status_e_type (); +extern bool_t xdr_rpc_loc_calendar_time_s_type (); +extern bool_t xdr_rpc_loc_parsed_position_s_type (); +extern bool_t xdr_rpc_loc_sv_system_e_type (); +extern bool_t xdr_rpc_loc_sv_status_e_type (); +extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (); +extern bool_t xdr_rpc_loc_sv_info_s_type (); +extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (); +extern bool_t xdr_rpc_loc_gnss_info_s_type (); +extern bool_t xdr_rpc_loc_nmea_report_s_type (); +extern bool_t xdr_rpc_loc_status_event_e_type (); +extern bool_t xdr_rpc_loc_engine_state_e_type (); +extern bool_t xdr_rpc_loc_status_event_payload_u_type (); +extern bool_t xdr_rpc_loc_status_event_s_type (); +extern bool_t xdr_rpc_loc_server_addr_e_type (); +extern bool_t xdr_rpc_loc_server_addr_ipv4_type (); +extern bool_t xdr_rpc_loc_server_addr_url_type (); +extern bool_t xdr_rpc_loc_server_addr_u_type (); +extern bool_t xdr_rpc_loc_server_info_s_type (); +extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (); +extern bool_t xdr_rpc_loc_ni_event_e_type (); +extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (); +extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (); +extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (); +extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (); +extern bool_t xdr_rpc_loc_ni_location_type_e_type (); +extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (); +extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (); +extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (); +extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_event_payload_u_type (); +extern bool_t xdr_rpc_loc_ni_event_s_type (); +extern bool_t xdr_rpc_loc_assist_data_request_e_type (); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (); +extern bool_t xdr_rpc_loc_time_download_source_s_type (); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (); +extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (); +extern bool_t xdr_rpc_loc_assist_data_request_s_type (); +extern bool_t xdr_rpc_loc_server_connection_handle (); +extern bool_t xdr_rpc_loc_server_protocol_e_type (); +extern bool_t xdr_rpc_loc_server_request_e_type (); +extern bool_t xdr_rpc_loc_server_open_req_s_type (); +extern bool_t xdr_rpc_loc_server_close_req_s_type (); +extern bool_t xdr_rpc_loc_server_request_u_type (); +extern bool_t xdr_rpc_loc_server_request_s_type (); +extern bool_t xdr_rpc_loc_reserved_payload_s_type (); +extern bool_t xdr_rpc_loc_ioctl_e_type (); +extern bool_t xdr_rpc_loc_api_version_s_type (); +extern bool_t xdr_rpc_loc_fix_recurrence_e_type (); +extern bool_t xdr_rpc_loc_operation_mode_e_type (); +extern bool_t xdr_rpc_loc_notify_e_type (); +extern bool_t xdr_rpc_loc_fix_criteria_s_type (); +extern bool_t xdr_rpc_loc_ni_user_resp_e_type (); +extern bool_t xdr_rpc_loc_user_verify_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (); +extern bool_t xdr_rpc_loc_assist_data_time_s_type (); +extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (); +extern bool_t xdr_rpc_loc_assist_data_pos_s_type (); +extern bool_t xdr_rpc_loc_server_open_status_e_type (); +extern bool_t xdr_rpc_loc_server_open_status_s_type (); +extern bool_t xdr_rpc_loc_server_close_status_e_type (); +extern bool_t xdr_rpc_loc_server_close_status_s_type (); +extern bool_t xdr_rpc_loc_lock_e_type (); +extern bool_t xdr_rpc_loc_nmea_sentence_type (); +extern bool_t xdr_rpc_loc_assist_data_type (); +extern bool_t xdr_rpc_loc_assist_data_delete_s_type (); +extern bool_t xdr_rpc_loc_ioctl_data_u_type (); +extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (); +extern bool_t xdr_rpc_loc_ioctl_callback_s_type (); +extern bool_t xdr_rpc_loc_event_payload_u_type (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_COMMON_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h new file mode 100644 index 00000000..e62eb367 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h @@ -0,0 +1,188 @@ +/****************************************************************************** + @file: loc_api_fixup.h + @brief: Loc API Android RPC amendment header + + DESCRIPTION + Loc API Android RPC amendment header + + INITIALIZATION AND SEQUENCING REQUIREMENTS + + ----------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ----------------------------------------------------------------------------- + ******************************************************************************/ + +#ifndef LOC_API_FIXUP_H +#define LOC_API_FIXUP_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef NULLPROC +#define NULLPROC 0 +#endif /* NULLPROC */ + +#ifdef ADD_XDR_FLOAT + +extern bool_t xdr_float (XDR *__xdrs, float *__fp); +extern bool_t xdr_double (XDR *__xdrs, double *__dp); + +#endif /* ADD_XDR_FLOAT */ + +#ifdef ADD_XDR_BOOL +extern bool_t xdr_bool(XDR *__xdrs, int *__bp); +#endif /* ADD_XDR_BOOL */ + +#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1 +#define RPC_LOC_API_MINOR_VERSION_NUMBER 0 + +// Return value for loc_open in case of failure. +#define RPC_LOC_CLIENT_HANDLE_INVALID -1 + +// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl +// These are also the status for the ioctl callback +#define RPC_LOC_API_SUCCESS 0 +#define RPC_LOC_API_GENERAL_FAILURE 1 +#define RPC_LOC_API_UNSUPPORTED 2 +#define RPC_LOC_API_INVALID_HANDLE 4 +#define RPC_LOC_API_INVALID_PARAMETER 5 +#define RPC_LOC_API_ENGINE_BUSY 6 +#define RPC_LOC_API_PHONE_OFFLINE 7 +#define RPC_LOC_API_TIMEOUT 8 + +// Special return value for loc api calls in case of RCP failure +#define RPC_LOC_API_RPC_FAILURE (-1234) + +#define RPC_LOC_API_MAX_SV_COUNT 80 +#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200 + +// Maximum server address that will be used in location API +#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256 +#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3 +#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3 + +#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type +#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report +#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate +#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate +#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request +#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request +#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server +#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl +#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state + + +#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001 +#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002 +#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004 +#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008 +#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010 +#define RPC_LOC_POS_VALID_LATITUDE 0x00000020 +#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040 +#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080 +#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100 +#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200 +#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400 +#define RPC_LOC_POS_VALID_HEADING 0x00000800 +#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000 +#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000 +#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000 +#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000 +#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000 +#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000 +#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000 +#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000 + +#define RPC_LOC_POS_TECH_SATELLITE 0x00000001 +#define RPC_LOC_POS_TECH_CELLID 0x00000002 +#define RPC_LOC_POS_TECH_WIFI 0x00000004 + +#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001 +#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002 +#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004 +#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008 +#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010 +#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020 +#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040 +#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080 +#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100 + +#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001 +#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002 +#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004 +#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008 +#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010 +#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020 + +#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200 +#define RPC_LOC_NI_SUPL_HASH_LENGTH 8 +#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4 +#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64 +#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20 +#define RPC_LOC_NI_CODEWORD_LENGTH 20 + +#define RPC_LOC_NI_SUPL_QOP_VALID 0x01 +#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02 +#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04 +#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08 + +#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008 +#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010 +#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020 +#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040 +#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080 +#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100 + +#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001 +#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002 +#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004 +#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008 +#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010 +#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020 +#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040 +#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080 +#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100 + +#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF + +#define RPC_LOC_NMEA_MASK_ALL 0xffff +#define RPC_LOC_NMEA_MASK_GGA 0x0001 +#define RPC_LOC_NMEA_MASK_RMC 0x0002 +#define RPC_LOC_NMEA_MASK_GSV 0x0004 +#define RPC_LOC_NMEA_MASK_GSA 0x0008 +#define RPC_LOC_NMEA_MASK_VTG 0x0010 + +/* flags for notification */ +#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001 +#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002 +#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010 +#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020 +#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040 +#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080 +#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100 + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_FIXUP_H */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h new file mode 100644 index 00000000..92d4e150 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h @@ -0,0 +1,34 @@ +/* ------------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ------------------------------------------------------------------------------- + */ + +#ifndef LOC_APICB_APPINIT_H +#define LOC_APICB_APPINIT_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Initialization function for callbacks */ +extern int loc_apicb_app_init(); +extern void loc_apicb_app_deinit(); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_APICB_APPINIT_H */ diff --git a/loc_api/libloc_api-rpc/inc/debug.h b/loc_api/libloc_api-rpc/inc/debug.h new file mode 100644 index 00000000..a71b23a0 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc/debug.h @@ -0,0 +1,57 @@ +/* +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef DEBUG_H +#define DEBUG_H + +#include + +#define LOG_TAG "libgps-rpc" +#include + +#define PRINT(x...) do { \ + fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \ + fprintf(stdout, ##x); \ + LOGD(x); \ + } while(0) + +#ifdef DEBUG +#define D PRINT +#else +#define D(x...) do { } while(0) +#endif + +#ifdef VERBOSE +#define V PRINT +#else +#define V(x...) do { } while(0) +#endif + +#define E(x...) do { \ + fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \ + fprintf(stderr, ##x); \ + LOGE(x); \ + } while(0) + +#define FAILIF(cond, msg...) do { \ + if (__builtin_expect (cond, 0)) { \ + fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \ + fprintf(stderr, ##msg); \ + LOGE(##msg); \ + } \ + } while(0) + +#endif/*DEBUG_H*/ diff --git a/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h b/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h new file mode 100644 index 00000000..ef972bd6 --- /dev/null +++ b/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h @@ -0,0 +1,100 @@ +/****************************************************************************** + @file: loc_api_rpc_glue.h + @brief: Loc API Android glue code header + + DESCRIPTION + Loc API Android glue code header + + INITIALIZATION AND SEQUENCING REQUIREMENTS + + ----------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ----------------------------------------------------------------------------- + ******************************************************************************/ + +/*===================================================================== + EDIT HISTORY FOR MODULE + + This section contains comments describing changes made to the module. + Notice that changes are listed in reverse chronological order. + +when who what, where, why +-------- --- ------------------------------------------------------- +03/17/09 dx Initial version + +$Id: //source/qcom/qct/modem/gps/cgps/dev/locationmiddleware/locapi/app-linux/source/test/loc_api_test/loc_api_cb_log.h#4 $ +======================================================================*/ + +#ifndef LOC_API_RPC_GLUE_H +#define LOC_API_RPC_GLUE_H + +/* Include RPC headers */ +#include "loc_api_common.h" +#include "loc_api.h" +#include "loc_api_cb.h" +#include "loc_api_fixup.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Boolean */ +/* Other data types in comdef.h are defined in rpc stubs, so fix it here */ +typedef unsigned char boolean; +#define TRUE 1 +#define FALSE 0 + +extern int loc_api_glue_init(void); +extern int loc_api_null(void); + +typedef int32 (loc_event_cb_f_type)( + rpc_loc_client_handle_type loc_handle, /* handle of the client */ + rpc_loc_event_mask_type loc_event, /* event mask */ + const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ +); + +extern rpc_loc_client_handle_type loc_open( + rpc_loc_event_mask_type event_reg_mask, + loc_event_cb_f_type *event_callback +); + +extern int32 loc_close +( + rpc_loc_client_handle_type handle +); + +extern int32 loc_start_fix +( + rpc_loc_client_handle_type handle +); + +extern int32 loc_stop_fix +( + rpc_loc_client_handle_type handle +); + +extern int32 loc_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data +); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_RPC_GLUE_H */ diff --git a/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c new file mode 100644 index 00000000..7fcfd6cb --- /dev/null +++ b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c @@ -0,0 +1,61 @@ +/* ------------------------------------------------------------------------------- +Copyright (c) 2009, QUALCOMM USA, INC. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + ------------------------------------------------------------------------------- + */ +#include "rpc/rpc.h" +#include "loc_api_common.h" +#include "loc_api.h" +#include "loc_api_cb.h" +#include "loc_api_fixup.h" + +#include "loc_apicb_appinit.h" + +#define RPC_FUNC_VERSION_BASE(a,b) a ## b +#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b) + +static SVCXPRT* svrPort = NULL; + +extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp); + +int loc_apicb_app_init(void) +{ + /* Register a callback server to use the loc_apicbprog_* function */ + if (svrPort == NULL) { + svrPort = svcrtr_create(); + } + if (!svrPort) return -1; + + xprt_register(svrPort); + if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0)) + { + return 0; + } + else + { + return -1; + } +} + +void loc_apicb_app_deinit(void) +{ + if (svrPort == NULL) + { + return; + } + xprt_unregister(svrPort); + svc_destroy(svrPort); + //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001); + svrPort = NULL; +} diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index 62905e8c..a1488a02 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -41,8 +41,7 @@ LOCAL_CFLAGS += \ LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core \ - hardware/qcom/gps/loc_api/libloc_api_50001 \ - $(TARGET_OUT_HEADERS)/libflp + hardware/qcom/gps/loc_api/libloc_api_50001 LOCAL_COPY_HEADERS_TO:= libloc_eng/ LOCAL_COPY_HEADERS:= \ @@ -77,9 +76,6 @@ LOCAL_SHARED_LIBRARIES := \ libgps.utils \ libdl -ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false) -endif - LOCAL_SRC_FILES += \ loc.cpp \ gps.c @@ -95,11 +91,10 @@ endif ## Includes LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ - $(TARGET_OUT_HEADERS)/libloc_core \ - $(TARGET_OUT_HEADERS)/libflp + $(TARGET_OUT_HEADERS)/libloc_core LOCAL_PRELINK_MODULE := false -LOCAL_MODULE_RELATIVE_PATH := hw +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw include $(BUILD_SHARED_LIBRARY) diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 1d1a59ed..0b17b2c3 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,17 +29,10 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_EngAdapter" -#include -#include -#include -#include #include #include "loc_eng_msg.h" #include "loc_log.h" -#define CHIPSET_SERIAL_NUMBER_MAX_LEN 16 -#define USER_AGENT_MAX_LEN 512 - using namespace loc_core; LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) : @@ -62,22 +55,17 @@ void LocInternalAdapter::getZppInt() { LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner, ContextBase* context, - LocThread::tCreate tCreator) : + MsgTask::tCreate tCreator) : LocAdapterBase(mask, //Get the AFW context if VzW context has not already been intialized in //loc_ext context == NULL? LocDualContext::getLocFgContext(tCreator, - NULL, - LocDualContext::mLocationHalName, - false) + LocDualContext::mLocationHalName) :context), mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)), mUlp(new UlpProxyBase()), mNavigating(false), - mSupportsAgpsRequests(false), - mSupportsPositionInjection(false), - mSupportsTimeInjection(false), - mPowerVote(0) + mAgpsEnabled(false), mCPIEnabled(false) { memset(&mFixCriteria, 0, sizeof(mFixCriteria)); mFixCriteria.mode = LOC_POSITION_MODE_INVALID; @@ -91,173 +79,6 @@ LocEngAdapter::~LocEngAdapter() LOC_LOGV("LocEngAdapter deleted"); } -void LocEngAdapter::setXtraUserAgent() { - struct LocSetXtraUserAgent : public LocMsg { - const ContextBase* const mContext; - inline LocSetXtraUserAgent(ContextBase* context) : - LocMsg(), mContext(context) { - } - virtual void proc() const { - char release[PROPERTY_VALUE_MAX]; - char manufacture[PROPERTY_VALUE_MAX]; - char model[PROPERTY_VALUE_MAX]; - char board[PROPERTY_VALUE_MAX]; - char brand[PROPERTY_VALUE_MAX]; - char chipsetsn[CHIPSET_SERIAL_NUMBER_MAX_LEN]; - char userAgent[USER_AGENT_MAX_LEN]; - const char defVal[] = "-"; - - property_get("ro.build.version.release", release, defVal); - property_get("ro.product.manufacturer", manufacture, defVal); - property_get("ro.product.model", model, defVal); - property_get("ro.product.board", board, defVal); - property_get("ro.product.brand", brand, defVal); - getChipsetSerialNo(chipsetsn, sizeof(chipsetsn), defVal); - - encodeInPlace(release, PROPERTY_VALUE_MAX); - encodeInPlace(manufacture, PROPERTY_VALUE_MAX); - encodeInPlace(model, PROPERTY_VALUE_MAX); - encodeInPlace(board, PROPERTY_VALUE_MAX); - encodeInPlace(brand, PROPERTY_VALUE_MAX); - - snprintf(userAgent, sizeof(userAgent), "A/%s/%s/%s/%s/-/QCX3/s%u/-/%s/-/%s/-/-/-", - release, manufacture, model, board, - mContext->getIzatDevId(), chipsetsn, brand); - - for (int i = 0; i < sizeof(userAgent) && userAgent[i]; i++) { - if (' ' == userAgent[i]) userAgent[i] = '#'; - } - - saveUserAgentString(userAgent, strlen(userAgent)); - LOC_LOGV("%s] UserAgent %s", __func__, userAgent); - } - - void saveUserAgentString(const char* data, const int len) const { - const char XTRA_FOLDER[] = "/data/misc/location/xtra"; - const char USER_AGENT_FILE[] = "/data/misc/location/xtra/useragent.txt"; - - if (data == NULL || len < 1) { - LOC_LOGE("%s:%d]: invalid input data = %p len = %d", __func__, __LINE__, data, len); - return; - } - - struct stat s; - int err = stat(XTRA_FOLDER, &s); - if (err < 0) { - if (ENOENT == errno) { - if (mkdir(XTRA_FOLDER, 0700) < 0) { - LOC_LOGE("%s:%d]: make XTRA_FOLDER failed", __func__, __LINE__); - return; - } - } else { - LOC_LOGE("%s:%d]: XTRA_FOLDER invalid", __func__, __LINE__); - return; - } - } - - FILE* file = fopen(USER_AGENT_FILE, "wt"); - if (file == NULL) { - LOC_LOGE("%s:%d]: open USER_AGENT_FILE failed", __func__, __LINE__); - return; - } - - size_t written = fwrite(data, 1, len, file); - fclose(file); - file = NULL; - - // set file permission - chmod(USER_AGENT_FILE, 0600); - - if (written != len) { - LOC_LOGE("%s:%d]: write USER_AGENT_FILE failed", __func__, __LINE__); - } - } - - void getChipsetSerialNo(char buf[], int buflen, const char def[]) const { - const char SOC_SERIAL_NUMBER[] = "/sys/devices/soc0/serial_number"; - - FILE* file = fopen(SOC_SERIAL_NUMBER, "rt"); - if (file == NULL) { - // use default upon unreadable file - strlcpy(buf, def, buflen); - - } else { - size_t size = fread(buf, 1, buflen - 1, file); - if (size == 0) { - // use default upon empty file - strlcpy(buf, def, buflen); - - } else { - buf[size] = '\0'; - } - - fclose(file); - - // remove trailing spaces - size_t len = strlen(buf); - while (--len >= 0 && isspace(buf[len])) { - buf[len] = '\0'; - } - } - - return; - } - - /** - * encode the given string value such that all separator characters ('/','+','|','%') - * in the string are repaced by their corresponding encodings (%2F","%2B","%7C", "%25") - */ - static void encodeInPlace(char value[], const int size) { - char buffer[size]; - - struct ENCODE { - const char ch; - const char *code; - }; - - const ENCODE encodings[] = { {'/', "%2F"}, {'+', "%2B"}, {'|', "%7C",}, {'%', "%25"} }; - const int nencodings = (int)sizeof(encodings) / sizeof(encodings[0]); - - int inpos = 0, outpos = 0; - while(value[inpos] != '\0' && outpos < size - 1) { - // check if escaped character - int escchar = 0; - while(escchar < nencodings && encodings[escchar].ch != value[inpos]) { - escchar++; - } - - if (escchar == nencodings) { - // non escaped character - buffer[outpos++] = value[inpos++]; - continue; - } - - // escaped character - int codepos = 0; - #define NUM_CHARS_IN_CODE 3 - - if (outpos + NUM_CHARS_IN_CODE >= size) { - // skip last character if there is insufficient space - break; - } - - while(outpos < size - 1 && codepos < NUM_CHARS_IN_CODE) { - buffer[outpos++] = encodings[escchar].code[codepos++]; - } - inpos++; - } - - // copy to ouput - value[outpos] = '\0'; - while(--outpos >= 0) { - value[outpos] = buffer[outpos]; - } - } - }; - - sendMsg(new LocSetXtraUserAgent(mContext)); -} - void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) { struct LocSetUlpProxy : public LocMsg { LocAdapterBase* mAdapter; @@ -302,48 +123,6 @@ void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp) mUlp = ulp; } -int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask) -{ - struct LocEngAdapterGpsLock : public LocMsg { - LocEngAdapter* mAdapter; - LOC_GPS_LOCK_MASK mLockMask; - inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) : - LocMsg(), mAdapter(adapter), mLockMask(lockMask) - { - locallog(); - } - inline virtual void proc() const { - mAdapter->setGpsLock(mLockMask); - } - inline void locallog() const { - LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask); - } - inline virtual void log() const { - locallog(); - } - }; - sendMsg(new LocEngAdapterGpsLock(this, lockMask)); - return 0; -} - -void LocEngAdapter::requestPowerVote() -{ - if (getPowerVoteRight()) { - /* Power voting without engine lock: - * 101: vote down, 102-104 - vote up - * These codes are used not to confuse with actual engine lock - * functionality, that can't be used in SSR scenario, as it - * conflicts with initialization sequence. - */ - bool powerUp = getPowerVote(); - LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp); - setGpsLock(powerUp ? 103 : 101); - } - - delete mUlp; - mUlp = ulp; -} - void LocInternalAdapter::reportPosition(UlpLocation &location, GpsLocationExtended &locationExtended, void* locationExt, @@ -378,14 +157,14 @@ void LocEngAdapter::reportPosition(UlpLocation &location, } } -void LocInternalAdapter::reportSv(GnssSvStatus &svStatus, +void LocInternalAdapter::reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt){ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus, locationExtended, svExt)); } -void LocEngAdapter::reportSv(GnssSvStatus &svStatus, +void LocEngAdapter::reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { @@ -431,84 +210,84 @@ bool LocEngAdapter::reportXtraServer(const char* url1, const char* url3, const int maxlength) { - if (mSupportsAgpsRequests) { + if (mAgpsEnabled) { sendMsg(new LocEngReportXtraServer(mOwner, url1, url2, url3, maxlength)); } - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type) { - if (mSupportsAgpsRequests) { + if (mAgpsEnabled) { sendMsg(new LocEngRequestATL(mOwner, connHandle, agps_type)); } - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::releaseATL(int connHandle) { - if (mSupportsAgpsRequests) { + if (mAgpsEnabled) { sendMsg(new LocEngReleaseATL(mOwner, connHandle)); } - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::requestXtraData() { - if (mSupportsAgpsRequests) { + if (mAgpsEnabled) { sendMsg(new LocEngRequestXtra(mOwner)); } - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::requestTime() { - if (mSupportsAgpsRequests) { + if (mAgpsEnabled) { sendMsg(new LocEngRequestTime(mOwner)); } - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data) { - if (mSupportsAgpsRequests) { + if (mAgpsEnabled) { notif.size = sizeof(notif); notif.timeout = LOC_NI_NO_RESPONSE_TIME; sendMsg(new LocEngRequestNi(mOwner, notif, data)); } - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::requestSuplES(int connHandle) { - if (mSupportsAgpsRequests) + if (mAgpsEnabled) sendMsg(new LocEngRequestSuplEs(mOwner, connHandle)); - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::reportDataCallOpened() { - if(mSupportsAgpsRequests) + if(mAgpsEnabled) sendMsg(new LocEngSuplEsOpened(mOwner)); - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline bool LocEngAdapter::reportDataCallClosed() { - if(mSupportsAgpsRequests) + if(mAgpsEnabled) sendMsg(new LocEngSuplEsClosed(mOwner)); - return mSupportsAgpsRequests; + return mAgpsEnabled; } inline @@ -522,80 +301,3 @@ void LocEngAdapter::handleEngineUpEvent() { sendMsg(new LocEngUp(mOwner)); } - -enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time, - int64_t timeReference, - int uncertainty) -{ - loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS; - - LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d", - __func__, __LINE__, mSupportsTimeInjection); - - if (mSupportsTimeInjection) { - LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__); - result = mLocApi->setTime(time, timeReference, uncertainty); - } else { - mSupportsTimeInjection = true; - } - return result; -} - -enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check) -{ - enum loc_api_adapter_err ret; - ENTRY_LOG(); - enum xtra_version_check eCheck; - switch (check) { - case 0: - eCheck = DISABLED; - break; - case 1: - eCheck = AUTO; - break; - case 2: - eCheck = XTRA2; - break; - case 3: - eCheck = XTRA3; - break; - default: - eCheck = DISABLED; - } - ret = mLocApi->setXtraVersionCheck(eCheck); - EXIT_LOG(%d, ret); - return ret; -} - -void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData) -{ - sendMsg(new LocEngReportGpsMeasurement(mOwner, - gpsMeasurementData)); -} - -/* - Update Registration Mask - */ -void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled) -{ - LOC_LOGD("entering %s", __func__); - int result = LOC_API_ADAPTER_ERR_FAILURE; - result = mLocApi->updateRegistrationMask(event, isEnabled); - if (result == LOC_API_ADAPTER_ERR_SUCCESS) { - LOC_LOGD("%s] update registration mask succeed.", __func__); - } else { - LOC_LOGE("%s] update registration mask failed.", __func__); - } -} - -/* - Set Gnss Constellation Config - */ -bool LocEngAdapter::gnssConstellationConfig() -{ - LOC_LOGD("entering %s", __func__); - bool result = false; - result = mLocApi->gnssConstellationConfig(); - return result; -} diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 72b780d1..ea04f077 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -54,7 +54,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GnssSvStatus &svStatus, + virtual void reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -73,37 +73,25 @@ class LocEngAdapter : public LocAdapterBase { UlpProxyBase* mUlp; LocPosMode mFixCriteria; bool mNavigating; - // mPowerVote is encoded as - // mPowerVote & 0x20 -- powerVoteRight - // mPowerVote & 0x10 -- power On / Off - unsigned int mPowerVote; - static const unsigned int POWER_VOTE_RIGHT = 0x20; - static const unsigned int POWER_VOTE_VALUE = 0x10; public: - bool mSupportsAgpsRequests; - bool mSupportsPositionInjection; - bool mSupportsTimeInjection; + bool mAgpsEnabled; + bool mCPIEnabled; LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, - void* owner, ContextBase* context, - LocThread::tCreate tCreator); + void* owner,ContextBase* context, + MsgTask::tCreate tCreator); virtual ~LocEngAdapter(); virtual void setUlpProxy(UlpProxyBase* ulp); - void setXtraUserAgent(); inline void requestUlp(unsigned long capabilities) { mContext->requestUlp(mInternalAdapter, capabilities); } inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; } inline UlpProxyBase* getUlpProxy() { return mUlp; } inline void* getOwner() { return mOwner; } - inline bool hasAgpsExtendedCapabilities() { - return mContext->hasAgpsExtendedCapabilities(); - } - inline bool hasCPIExtendedCapabilities() { - return mContext->hasCPIExtendedCapabilities(); - } + inline bool hasAgpsExt() { return mContext->hasAgpsExt(); } + inline bool hasCPIExt() { return mContext->hasCPIExt(); } inline const MsgTask* getMsgTask() { return mMsgTask; } inline enum loc_api_adapter_err @@ -136,6 +124,11 @@ public: { return mLocApi->injectPosition(latitude, longitude, accuracy); } + inline enum loc_api_adapter_err + setTime(GpsUtcTime time, int64_t timeReference, int uncertainty) + { + return mLocApi->setTime(time, timeReference, uncertainty); + } inline enum loc_api_adapter_err setXtraData(char* data, int length) { @@ -191,9 +184,9 @@ public: return mLocApi->setLPPConfig(profile); } inline enum loc_api_adapter_err - setSensorControlConfig(int sensorUsage, int sensorProvider) + setSensorControlConfig(int sensorUsage) { - return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider); + return mLocApi->setSensorControlConfig(sensorUsage); } inline enum loc_api_adapter_err setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk, @@ -249,18 +242,9 @@ public: inline enum loc_api_adapter_err getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask) { - return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask); - } - enum loc_api_adapter_err setTime(GpsUtcTime time, - int64_t timeReference, - int uncertainty); - enum loc_api_adapter_err setXtraVersionCheck(int check); - inline virtual void installAGpsCert(const DerEncodedCertificate* pData, - size_t length, - uint32_t slotBitMask) - { - mLocApi->installAGpsCert(pData, length, slotBitMask); + return mLocApi->getZppFix(zppLoc, tech_mask); } + virtual void handleEngineDownEvent(); virtual void handleEngineUpEvent(); virtual void reportPosition(UlpLocation &location, @@ -268,7 +252,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GnssSvStatus &svStatus, + virtual void reportSv(GpsSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -283,7 +267,6 @@ public: virtual bool requestSuplES(int connHandle); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); - virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData); inline const LocPosMode& getPositionMode() const {return mFixCriteria;} @@ -291,40 +274,16 @@ public: { return mNavigating; } void setInSession(bool inSession); - // Permit/prohibit power voting - inline void setPowerVoteRight(bool powerVoteRight) { - mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) : - (mPowerVote & ~POWER_VOTE_RIGHT); - } - inline bool getPowerVoteRight() const { - return (mPowerVote & POWER_VOTE_RIGHT) != 0 ; - } - // Set the power voting up/down and do actual operation if permitted - inline void setPowerVote(bool powerOn) { - mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) : - (mPowerVote & ~POWER_VOTE_VALUE); - requestPowerVote(); - mContext->modemPowerVote(powerOn); - } - inline bool getPowerVote() const { - return (mPowerVote & POWER_VOTE_VALUE) != 0 ; - } - // Do power voting according to last settings if permitted - void requestPowerVote(); - /*Values for lock 1 = Do not lock any position sessions 2 = Lock MI position sessions 3 = Lock MT position sessions 4 = Lock all position sessions */ - inline int setGpsLock(LOC_GPS_LOCK_MASK lock) + inline int setGpsLock(unsigned int lock) { return mLocApi->setGpsLock(lock); } - - int setGpsLockMsg(LOC_GPS_LOCK_MASK lock); - /* Returns Current value of GPS lock on success @@ -334,17 +293,6 @@ public: { return mLocApi->getGpsLock(); } - - /* - Update Registration Mask - */ - void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled); - - /* - Set Gnss Constellation Config - */ - bool gnssConstellationConfig(); }; #endif //LOC_API_ENG_ADAPTER_H diff --git a/loc_api/libloc_api_50001/gps.c b/loc_api/libloc_api_50001/gps.c index 29f20f42..46596aa4 100644 --- a/loc_api/libloc_api_50001/gps.c +++ b/loc_api/libloc_api_50001/gps.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011,2015 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 7411dc5a..83249f40 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -47,8 +47,6 @@ using namespace loc_core; -#define LOC_PM_CLIENT_NAME "GPS" - //Globals defns static gps_location_callback gps_loc_cb = NULL; static gps_sv_status_callback gps_sv_cb = NULL; @@ -70,6 +68,7 @@ static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence re uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); static const void* loc_get_extension(const char* name); + // Defines the GpsInterface in gps.h static const GpsInterface sLocEngInterface = { @@ -91,7 +90,6 @@ static int loc_agps_open(const char* apn); static int loc_agps_closed(); static int loc_agps_open_failed(); static int loc_agps_set_server(AGpsType type, const char *hostname, int port); -static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType); static const AGpsInterface sLocEngAGpsInterface = { @@ -100,8 +98,7 @@ static const AGpsInterface sLocEngAGpsInterface = loc_agps_open, loc_agps_closed, loc_agps_open_failed, - loc_agps_set_server, - loc_agps_open_with_apniptype + loc_agps_set_server }; static int loc_xtra_init(GpsXtraCallbacks* callbacks); @@ -117,23 +114,13 @@ static const GpsXtraInterface sLocEngXTRAInterface = static void loc_ni_init(GpsNiCallbacks *callbacks); static void loc_ni_respond(int notif_id, GpsUserResponseType user_response); -static const GpsNiInterface sLocEngNiInterface = +const GpsNiInterface sLocEngNiInterface = { sizeof(GpsNiInterface), loc_ni_init, loc_ni_respond, }; -static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks); -static void loc_gps_measurement_close(); - -static const GpsMeasurementInterface sLocEngGpsMeasurementInterface = -{ - sizeof(GpsMeasurementInterface), - loc_gps_measurement_init, - loc_gps_measurement_close -}; - static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ); static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct); static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid); @@ -152,29 +139,9 @@ static const AGpsRilInterface sLocEngAGpsRilInterface = loc_agps_ril_update_network_availability }; -static int loc_agps_install_certificates(const DerEncodedCertificate* certificates, - size_t length); -static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints, - size_t length); - -static const SuplCertificateInterface sLocEngAGpsCertInterface = -{ - sizeof(SuplCertificateInterface), - loc_agps_install_certificates, - loc_agps_revoke_certificates -}; - -static void loc_configuration_update(const char* config_data, int32_t length); - -static const GnssConfigurationInterface sLocEngConfigInterface = -{ - sizeof(GnssConfigurationInterface), - loc_configuration_update -}; - static loc_eng_data_s_type loc_afw_data; static int gss_fd = -1; -static int sGnssType = GNSS_UNKNOWN; + /*=========================================================================== FUNCTION gps_get_hardware_interface @@ -227,11 +194,10 @@ extern "C" const GpsInterface* get_gps_interface() target = loc_get_target(); LOC_LOGD("Target name check returned %s", loc_get_target_name(target)); - sGnssType = getTargetGnssType(target); - switch (sGnssType) + int gnssType = getTargetGnssType(target); + switch (gnssType) { case GNSS_GSS: - case GNSS_AUTO: //APQ8064 gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); gss_fd = open("/dev/gss", O_RDONLY); @@ -304,31 +270,16 @@ static int loc_init(GpsCallbacks* callbacks) callbacks->create_thread_cb, /* create_thread_cb */ NULL, /* location_ext_parser */ NULL, /* sv_ext_parser */ - callbacks->request_utc_time_cb, /* request_utc_time_cb */ - }; + callbacks->request_utc_time_cb /* request_utc_time_cb */}; gps_loc_cb = callbacks->location_cb; gps_sv_cb = callbacks->sv_status_cb; retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL); - loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities(); - loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities(); - loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities(); - loc_afw_data.adapter->setGpsLockMsg(0); - loc_afw_data.adapter->requestUlp(getCarrierCapabilities()); - loc_afw_data.adapter->setXtraUserAgent(); + loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES); + loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt(); + loc_afw_data.adapter->mCPIEnabled = !loc_afw_data.adapter->hasCPIExt(); - if(retVal) { - LOC_LOGE("loc_eng_init() fail!"); - goto err; - } - - loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530); - loc_afw_data.adapter->setPowerVote(true); - - LOC_LOGD("loc_eng_init() success!"); - -err: EXIT_LOG(%d, retVal); return retVal; } @@ -352,14 +303,19 @@ SIDE EFFECTS static void loc_cleanup() { ENTRY_LOG(); - - loc_afw_data.adapter->setPowerVote(false); - loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK); - loc_eng_cleanup(loc_afw_data); gps_loc_cb = NULL; gps_sv_cb = NULL; +/* + if (gss_fd >= 0) + { + close(gss_fd); + gss_fd = -1; + LOC_LOGD("GSS shutdown.\n"); + } +*/ + EXIT_LOG(%s, VOID_RET); } @@ -506,11 +462,33 @@ SIDE EFFECTS ===========================================================================*/ static int loc_inject_location(double latitude, double longitude, float accuracy) { + static bool initialized = false; + static bool enable_cpi = true; + accuracy = 1000; ENTRY_LOG(); - int ret_val = 0; - ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy); + if(!initialized) + { + char value[PROPERTY_VALUE_MAX]; + memset(value, 0, sizeof(value)); + (void)platform_lib_abstraction_property_get("persist.gps.qc_nlp_in_use", value, "0"); + if(0 == strcmp(value, "1")) + { + enable_cpi = false; + LOC_LOGI("GPS HAL coarse position injection disabled"); + } + else + { + LOC_LOGI("GPS HAL coarse position injection enabled"); + } + initialized = true; + } + int ret_val = 0; + if(enable_cpi) + { + ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy); + } EXIT_LOG(%d, ret_val); return ret_val; } @@ -566,7 +544,7 @@ const GpsGeofencingInterface* get_geofence_interface(void) } dlerror(); /* Clear any existing error */ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface"); - if ((error = dlerror()) != NULL || NULL == get_gps_geofence_interface) { + if ((error = dlerror()) != NULL) { LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error); goto exit; } @@ -626,18 +604,6 @@ const void* loc_get_extension(const char* name) ret_val = get_geofence_interface(); } } - else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0) - { - ret_val = &sLocEngAGpsCertInterface; - } - else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0) - { - ret_val = &sLocEngConfigInterface; - } - else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0) - { - ret_val = &sLocEngGpsMeasurementInterface; - } else { LOC_LOGE ("get_extension: Invalid interface passed in\n"); @@ -697,50 +663,6 @@ static int loc_agps_open(const char* apn) return ret_val; } -/*=========================================================================== -FUNCTION loc_agps_open_with_apniptype - -DESCRIPTION - This function is called when on-demand data connection opening is successful. -It should inform ARM 9 about the data open result. - -DEPENDENCIES - NONE - -RETURN VALUE - 0 - -SIDE EFFECTS - N/A - -===========================================================================*/ -static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType) -{ - ENTRY_LOG(); - AGpsType agpsType = AGPS_TYPE_SUPL; - AGpsBearerType bearerType; - - switch (apnIpType) { - case APN_IP_IPV4: - bearerType = AGPS_APN_BEARER_IPV4; - break; - case APN_IP_IPV6: - bearerType = AGPS_APN_BEARER_IPV6; - break; - case APN_IP_IPV4V6: - bearerType = AGPS_APN_BEARER_IPV4V6; - break; - default: - bearerType = AGPS_APN_BEARER_INVALID; - break; - } - - int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType); - - EXIT_LOG(%d, ret_val); - return ret_val; -} - /*=========================================================================== FUNCTION loc_agps_closed @@ -853,10 +775,7 @@ SIDE EFFECTS static int loc_xtra_init(GpsXtraCallbacks* callbacks) { ENTRY_LOG(); - GpsXtraExtCallbacks extCallbacks; - memset(&extCallbacks, 0, sizeof(extCallbacks)); - extCallbacks.download_request_cb = callbacks->download_request_cb; - int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks); + int ret_val = loc_eng_xtra_init(loc_afw_data, (GpsXtraExtCallbacks*)callbacks); EXIT_LOG(%d, ret_val); return ret_val; @@ -892,56 +811,6 @@ static int loc_xtra_inject_data(char* data, int length) return ret_val; } -/*=========================================================================== -FUNCTION loc_gps_measurement_init - -DESCRIPTION - This function initializes the gps measurement interface - -DEPENDENCIES - NONE - -RETURN VALUE - None - -SIDE EFFECTS - N/A - -===========================================================================*/ -static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks) -{ - ENTRY_LOG(); - int ret_val = loc_eng_gps_measurement_init(loc_afw_data, - callbacks); - - EXIT_LOG(%d, ret_val); - return ret_val; -} - -/*=========================================================================== -FUNCTION loc_gps_measurement_close - -DESCRIPTION - This function closes the gps measurement interface - -DEPENDENCIES - NONE - -RETURN VALUE - None - -SIDE EFFECTS - N/A - -===========================================================================*/ -static void loc_gps_measurement_close() -{ - ENTRY_LOG(); - loc_eng_gps_measurement_close(loc_afw_data); - - EXIT_LOG(%s, VOID_RET); -} - /*=========================================================================== FUNCTION loc_ni_init @@ -1019,40 +888,6 @@ static void loc_agps_ril_update_network_availability(int available, const char* EXIT_LOG(%s, VOID_RET); } -static int loc_agps_install_certificates(const DerEncodedCertificate* certificates, - size_t length) -{ - ENTRY_LOG(); - int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length); - EXIT_LOG(%d, ret_val); - return ret_val; -} -static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints, - size_t length) -{ - ENTRY_LOG(); - LOC_LOGE("%s:%d]: agps_revoke_certificates not supported"); - int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC; - EXIT_LOG(%d, ret_val); - return ret_val; -} - -static void loc_configuration_update(const char* config_data, int32_t length) -{ - ENTRY_LOG(); - loc_eng_configuration_update(loc_afw_data, config_data, length); - switch (sGnssType) - { - case GNSS_GSS: - case GNSS_AUTO: - case GNSS_QCA1530: - //APQ - gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); - break; - } - EXIT_LOG(%s, VOID_RET); -} - static void local_loc_cb(UlpLocation* location, void* locExt) { ENTRY_LOG(); @@ -1075,4 +910,3 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt) } EXIT_LOG(%s, VOID_RET); } - diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h index 41b968c4..8f41659a 100644 --- a/loc_api/libloc_api_50001/loc.h +++ b/loc_api/libloc_api_50001/loc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index de72aa8d..19c54a0f 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -87,27 +87,13 @@ loc_gps_cfg_s_type gps_conf; loc_sap_cfg_s_type sap_conf; /* Parameter spec table */ -static const loc_param_s_type gps_conf_table[] = +static loc_param_s_type loc_parameter_table[] = { - {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'}, - {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'}, - {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, - {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, - {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'}, - {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'}, {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'}, {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'}, {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'}, + {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'}, {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'}, - {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'}, - {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'}, - {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'}, - {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'}, - {"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'}, -}; - -static const loc_param_s_type sap_conf_table[] = -{ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'}, {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, @@ -124,29 +110,23 @@ static const loc_param_s_type sap_conf_table[] = {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'}, {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'}, {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'}, - {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'} + {"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'}, + {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, + {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, + {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'}, + {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'}, + {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'} }; static void loc_default_parameters(void) { - /*Defaults for gps.conf*/ + /* defaults */ gps_conf.INTERMEDIATE_POS = 0; gps_conf.ACCURACY_THRES = 0; gps_conf.NMEA_PROVIDER = 0; - gps_conf.GPS_LOCK = 0; gps_conf.SUPL_VER = 0x10000; - gps_conf.SUPL_MODE = 0x3; gps_conf.CAPABILITIES = 0x7; - /* LTE Positioning Profile configuration is disable by default*/ - gps_conf.LPP_PROFILE = 0; - /*By default no positioning protocol is selected on A-GLONASS system*/ - gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0; - /*XTRA version check is disabled by default*/ - gps_conf.XTRA_VERSION_CHECK=0; - /*Use emergency PDN by default*/ - gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1; - /*Defaults for sap.conf*/ sap_conf.GYRO_BIAS_RANDOM_WALK = 0; sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2; sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5; @@ -159,22 +139,25 @@ static void loc_default_parameters(void) sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */ sap_conf.SENSOR_USAGE = 0; /* Enabled */ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/ + /* Values MUST be set by OEMs in configuration for sensor-assisted navigation to work. There are NO default values */ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0; sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0; sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0; sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0; + sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0; sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; - /* default provider is SSC */ - sap_conf.SENSOR_PROVIDER = 1; - /* None of the 10 slots for agps certificates are writable by default */ - gps_conf.AGPS_CERT_WRITABLE_MASK = 0; + /* LTE Positioning Profile configuration is disable by default*/ + gps_conf.LPP_PROFILE = 0; + + /*By default no positioning protocol is selected on A-GLONASS system*/ + gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0; } // 2nd half of init(), singled out for @@ -198,6 +181,7 @@ static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ; static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data); static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data); static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data); + static void deleteAidingData(loc_eng_data_s_type &logEng); static AgpsStateMachine* getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType); @@ -216,6 +200,7 @@ static void* noProc(void* data) return NULL; } + /********************************************************************* * definitions of the static messages used in the file *********************************************************************/ @@ -336,6 +321,7 @@ void LocEngGetZpp::send() const { mAdapter->sendMsg(this); } +// case LOC_ENG_MSG_SET_TIME: struct LocEngSetTime : public LocMsg { LocEngAdapter* mAdapter; const GpsUtcTime mTime; @@ -484,24 +470,6 @@ struct LocEngSuplVer : public LocMsg { } }; -struct LocEngSuplMode : public LocMsg { - UlpProxyBase* mUlp; - - inline LocEngSuplMode(UlpProxyBase* ulp) : - LocMsg(), mUlp(ulp) - { - locallog(); - } - inline virtual void proc() const { - mUlp->setCapabilities(getCarrierCapabilities()); - } - inline void locallog() const { - } - inline virtual void log() const { - locallog(); - } -}; - // case LOC_ENG_MSG_LPP_CONFIG: struct LocEngLppConfig : public LocMsg { LocEngAdapter* mAdapter; @@ -527,20 +495,18 @@ struct LocEngLppConfig : public LocMsg { struct LocEngSensorControlConfig : public LocMsg { LocEngAdapter* mAdapter; const int mSensorsDisabled; - const int mSensorProvider; inline LocEngSensorControlConfig(LocEngAdapter* adapter, - int sensorsDisabled, int sensorProvider) : - LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled), - mSensorProvider(sensorProvider) + int sensorsDisabled) : + LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled) { locallog(); } inline virtual void proc() const { - mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider); + mAdapter->setSensorControlConfig(mSensorsDisabled); } inline void locallog() const { - LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d", - mSensorsDisabled, mSensorProvider); + LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d", + mSensorsDisabled); } inline virtual void log() const { locallog(); @@ -784,13 +750,8 @@ void LocEngReportPosition::proc() const { locEng->adapter->setInSession(false); } - LOC_LOGV("LocEngReportPosition::proc() - generateNmea: %d, position source: %d, " - "engine_status: %d, isInSession: %d", - locEng->generateNmea, mLocation.position_source, - locEng->engine_status, locEng->adapter->isInSession()); - if (locEng->generateNmea && - locEng->adapter->isInSession()) + mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS) { unsigned char generate_nmea = reported && (mStatus != LOC_SESS_FAILURE); @@ -809,7 +770,16 @@ void LocEngReportPosition::proc() const { } } void LocEngReportPosition::locallog() const { - LOC_LOGV("LocEngReportPosition"); + LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n " + "altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n " + "timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Session" + " status: %d\n Technology mask: %u", + mLocation.gpsLocation.flags, mLocation.position_source, + mLocation.gpsLocation.latitude, mLocation.gpsLocation.longitude, + mLocation.gpsLocation.altitude, mLocation.gpsLocation.speed, + mLocation.gpsLocation.bearing, mLocation.gpsLocation.accuracy, + mLocation.gpsLocation.timestamp, mLocation.rawDataSize, + mLocation.rawData, mStatus, mTechMask); } void LocEngReportPosition::log() const { locallog(); @@ -821,7 +791,7 @@ void LocEngReportPosition::send() const { // case LOC_ENG_MSG_REPORT_SV: LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter, - GnssSvStatus &sv, + GpsSvStatus &sv, GpsLocationExtended &locExtended, void* svExt) : LocMsg(), mAdapter(adapter), mSvStatus(sv), @@ -850,7 +820,19 @@ void LocEngReportSv::proc() const { } } void LocEngReportSv::locallog() const { - LOC_LOGV("%s:%d] LocEngReportSv",__func__, __LINE__); + LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n " + "used in fix mask: %x\n sv: prn snr " + "elevation azimuth", + mSvStatus.num_svs, mSvStatus.ephemeris_mask, + mSvStatus.almanac_mask, mSvStatus.used_in_fix_mask); + for (int i = 0; i < mSvStatus.num_svs && i < GPS_MAX_SVS; i++) { + LOC_LOGV(" %d: %d %f %f %f\n ", + i, + mSvStatus.sv_list[i].prn, + mSvStatus.sv_list[i].snr, + mSvStatus.sv_list[i].elevation, + mSvStatus.sv_list[i].azimuth); + } } inline void LocEngReportSv::log() const { locallog(); @@ -1087,17 +1069,7 @@ void LocEngRequestSuplEs::proc() const { AgpsStateMachine* sm = locEng->ds_nif; DSSubscriber s(sm, mID); sm->subscribeRsrc((Subscriber*)&s); - } - else if (locEng->agnss_nif) { - AgpsStateMachine *sm = locEng->agnss_nif; - ATLSubscriber s(mID, - sm, - locEng->adapter, - false); - sm->subscribeRsrc((Subscriber*)&s); - LOC_LOGD("%s:%d]: Using regular ATL for SUPL ES", __func__, __LINE__); - } - else { + } else { locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1); } } @@ -1343,33 +1315,6 @@ struct LocEngEnableData : public LocMsg { // case LOC_ENG_MSG_INJECT_XTRA_DATA: // loc_eng_xtra.cpp -// case LOC_ENG_MSG_SET_CAPABILITIES: -struct LocEngSetCapabilities : public LocMsg { - loc_eng_data_s_type* mLocEng; - inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) : - LocMsg(), mLocEng(locEng) - { - locallog(); - } - inline virtual void proc() const { - if (NULL != mLocEng->set_capabilities_cb) { - LOC_LOGV("calling set_capabilities_cb 0x%x", - gps_conf.CAPABILITIES); - mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES); - } else { - LOC_LOGV("set_capabilities_cb is NULL.\n"); - } - } - inline void locallog() const - { - LOC_LOGV("LocEngSetCapabilities"); - } - inline virtual void log() const - { - locallog(); - } -}; - // case LOC_ENG_MSG_LOC_INIT: struct LocEngInit : public LocMsg { loc_eng_data_s_type* mLocEng; @@ -1380,8 +1325,6 @@ struct LocEngInit : public LocMsg { } inline virtual void proc() const { loc_eng_reinit(*mLocEng); - // set the capabilities - mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng)); } inline void locallog() const { @@ -1424,7 +1367,7 @@ struct LocEngAtlOpenSuccess : public LocMsg { mStateMachine->onRsrcEvent(RSRC_GRANTED); } inline void locallog() const { - LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n" + LOC_LOGV("LocEngAtlClosed agps type: %s\n apn: %s\n" " bearer type: %s", loc_get_agps_type_name(mStateMachine->getType()), mAPN, @@ -1525,144 +1468,6 @@ struct LocEngDataClientInit : public LocMsg { } }; -struct LocEngInstallAGpsCert : public LocMsg { - LocEngAdapter* mpAdapter; - const size_t mNumberOfCerts; - const uint32_t mSlotBitMask; - DerEncodedCertificate* mpData; - inline LocEngInstallAGpsCert(LocEngAdapter* adapter, - const DerEncodedCertificate* pData, - size_t numberOfCerts, - uint32_t slotBitMask) : - LocMsg(), mpAdapter(adapter), - mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask), - mpData(new DerEncodedCertificate[mNumberOfCerts]) - { - for (int i=0; i < mNumberOfCerts; i++) { - mpData[i].data = new u_char[pData[i].length]; - if (mpData[i].data) { - memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length); - mpData[i].length = pData[i].length; - } else { - LOC_LOGE("malloc failed for cert#%d", i); - break; - } - } - locallog(); - } - inline ~LocEngInstallAGpsCert() - { - for (int i=0; i < mNumberOfCerts; i++) { - if (mpData[i].data) { - delete[] mpData[i].data; - } - } - delete[] mpData; - } - inline virtual void proc() const { - mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask); - } - inline void locallog() const { - LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u", - mNumberOfCerts, mSlotBitMask); - } - inline virtual void log() const { - locallog(); - } -}; - -struct LocEngUpdateRegistrationMask : public LocMsg { - loc_eng_data_s_type* mLocEng; - LOC_API_ADAPTER_EVENT_MASK_T mMask; - loc_registration_mask_status mIsEnabled; - inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng, - LOC_API_ADAPTER_EVENT_MASK_T mask, - loc_registration_mask_status isEnabled) : - LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) { - locallog(); - } - inline virtual void proc() const { - loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng; - locEng->adapter->updateRegistrationMask(mMask, - mIsEnabled); - } - void locallog() const { - LOC_LOGV("LocEngUpdateRegistrationMask\n"); - } - virtual void log() const { - locallog(); - } -}; - -struct LocEngGnssConstellationConfig : public LocMsg { - LocEngAdapter* mAdapter; - inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) : - LocMsg(), mAdapter(adapter) { - locallog(); - } - inline virtual void proc() const { - if (mAdapter->gnssConstellationConfig()) { - LOC_LOGV("Modem supports GNSS measurements\n"); - gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS; - } else { - LOC_LOGV("Modem does not support GNSS measurements\n"); - } - } - void locallog() const { - LOC_LOGV("LocEngGnssConstellationConfig\n"); - } - virtual void log() const { - locallog(); - } -}; - -// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT: -LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng, - GpsData &gpsData) : - LocMsg(), mLocEng(locEng), mGpsData(gpsData) -{ - locallog(); -} -void LocEngReportGpsMeasurement::proc() const { - loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng; - if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) - { - if (locEng->gps_measurement_cb != NULL) { - locEng->gps_measurement_cb((GpsData*)&(mGpsData)); - } - } -} -void LocEngReportGpsMeasurement::locallog() const { - IF_LOC_LOGV { - LOC_LOGV("%s:%d]: Received in GPS HAL." - "GNSS Measurements count: %d \n", - __func__, __LINE__, mGpsData.measurement_count); - for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) { - LOC_LOGV(" GNSS measurement data in GPS HAL: \n" - " GPS_HAL => Measurement ID | prn | time_offset_ns | state |" - " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |" - " pseudorange_rate_uncertainty_mps |" - " accumulated_delta_range_state | flags \n" - " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n", - i, - mGpsData.measurements[i].prn, - mGpsData.measurements[i].time_offset_ns, - mGpsData.measurements[i].state, - mGpsData.measurements[i].received_gps_tow_ns, - mGpsData.measurements[i].c_n0_dbhz, - mGpsData.measurements[i].pseudorange_rate_mps, - mGpsData.measurements[i].pseudorange_rate_uncertainty_mps, - mGpsData.measurements[i].accumulated_delta_range_state, - mGpsData.measurements[i].flags); - } - LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n" - " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type, - mGpsData.clock.time_ns); - } -} -inline void LocEngReportGpsMeasurement::log() const { - locallog(); -} /********************************************************************* * Initialization checking macros @@ -1677,24 +1482,6 @@ inline void LocEngReportGpsMeasurement::log() const { } #define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret) -uint32_t getCarrierCapabilities() { - #define carrierMSA (uint32_t)0x2 - #define carrierMSB (uint32_t)0x1 - #define gpsConfMSA (uint32_t)0x4 - #define gpsConfMSB (uint32_t)0x2 - uint32_t capabilities = gps_conf.CAPABILITIES; - if ((gps_conf.SUPL_MODE & carrierMSA) != carrierMSA) { - capabilities &= ~gpsConfMSA; - } - if ((gps_conf.SUPL_MODE & carrierMSB) != carrierMSB) { - capabilities &= ~gpsConfMSB; - } - - LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x", - gps_conf.CAPABILITIES, gps_conf.SUPL_MODE, capabilities); - return capabilities; -} - /*=========================================================================== FUNCTION loc_eng_init @@ -1731,12 +1518,15 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, memset(&loc_eng_data, 0, sizeof (loc_eng_data)); + if (NULL != callbacks->set_capabilities_cb) { + callbacks->set_capabilities_cb(gps_conf.CAPABILITIES); + } + // Save callbacks loc_eng_data.location_cb = callbacks->location_cb; loc_eng_data.sv_status_cb = callbacks->sv_status_cb; loc_eng_data.status_cb = callbacks->status_cb; loc_eng_data.nmea_cb = callbacks->nmea_cb; - loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb; loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb; loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb; loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb; @@ -1745,6 +1535,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ? callbacks->sv_ext_parser : noProc; loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS; + // initial states taken care of by the memset above // loc_eng_data.engine_status -- GPS_STATUS_NONE; // loc_eng_data.fix_session_status -- GPS_STATUS_NONE; @@ -1762,7 +1553,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.adapter = new LocEngAdapter(event, &loc_eng_data, context, - (LocThread::tCreate)callbacks->create_thread_cb); + (MsgTask::tCreate)callbacks->create_thread_cb); LOC_LOGD("loc_eng_init created client, id = %p\n", loc_eng_data.adapter); @@ -1776,51 +1567,51 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data) { ENTRY_LOG(); int ret_val = LOC_API_ADAPTER_ERR_SUCCESS; - LocEngAdapter* adapter = loc_eng_data.adapter; - adapter->sendMsg(new LocEngGnssConstellationConfig(adapter)); - adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER)); - adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE)); - adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE, - sap_conf.SENSOR_PROVIDER)); - adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); + if (LOC_API_ADAPTER_ERR_SUCCESS == ret_val) { + LOC_LOGD("loc_eng_reinit reinit() successful"); - /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */ - if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID || - sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) { - adapter->sendMsg(new LocEngSensorProperties(adapter, - sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, - sap_conf.GYRO_BIAS_RANDOM_WALK, - sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, - sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, - sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, - sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY)); + LocEngAdapter* adapter = loc_eng_data.adapter; + adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER)); + adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE)); + adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE)); + adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); + + /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */ + if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID || + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) + { + adapter->sendMsg(new LocEngSensorProperties(adapter, + sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, + sap_conf.GYRO_BIAS_RANDOM_WALK, + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY)); + } + + adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter, + sap_conf.SENSOR_CONTROL_MODE, + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, + sap_conf.SENSOR_ALGORITHM_CONFIG_MASK)); + + adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0))); } - adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter, - sap_conf.SENSOR_CONTROL_MODE, - sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, - sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, - sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, - sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, - sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, - sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, - sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, - sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, - sap_conf.SENSOR_ALGORITHM_CONFIG_MASK)); - - adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0))); - - loc_eng_xtra_version_check(loc_eng_data, gps_conf.XTRA_VERSION_CHECK); - - LOC_LOGD("loc_eng_reinit reinit() successful"); EXIT_LOG(%d, ret_val); return ret_val; } @@ -1920,11 +1711,10 @@ static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data) ret_val = loc_eng_data.adapter->startFix(); if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS || - ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN || - ret_val == LOC_API_ADAPTER_ERR_PHONE_OFFLINE || - ret_val == LOC_API_ADAPTER_ERR_INTERNAL) + ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN) { loc_eng_data.adapter->setInSession(TRUE); + loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_BEGIN); } } @@ -1970,6 +1760,11 @@ static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data) if (loc_eng_data.adapter->isInSession()) { ret_val = loc_eng_data.adapter->stopFix(); + if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS) + { + loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END); + } + loc_eng_data.adapter->setInSession(FALSE); } @@ -2022,12 +1817,14 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); - // The position mode for AUTO/GSS/QCA1530 can only be standalone - if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) && - !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) && - (params.mode != LOC_POSITION_MODE_STANDALONE)) { + int gnssType = getTargetGnssType(loc_get_target()); + + // The position mode for GSS/QCA1530 can only be standalone + bool is1530 = gnssType == GNSS_QCA1530; + bool isAPQ = gnssType == GNSS_GSS; + if ((isAPQ || is1530) && params.mode != LOC_POSITION_MODE_STANDALONE) { params.mode = LOC_POSITION_MODE_STANDALONE; - LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530."); + LOC_LOGD("Position mode changed to standalone for target with GSS/qca1530."); } if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params)) @@ -2093,7 +1890,7 @@ int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); LocEngAdapter* adapter = loc_eng_data.adapter; - if(adapter->mSupportsPositionInjection) + if(!adapter->mCPIEnabled) { adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude, accuracy)); @@ -2299,17 +2096,18 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call AGPS_TYPE_WIFI, true); - if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || - (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) { + int gnssType = getTargetGnssType(loc_get_target()); + bool isAPQ = (gnssType == GNSS_GSS); + bool is1530 = (gnssType == GNSS_QCA1530); + if (!isAPQ && !is1530) { loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps, (void *)loc_eng_data.agps_status_cb, AGPS_TYPE_SUPL, false); - if (adapter->mSupportsAgpsRequests) { - if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) { - loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); - } + if (adapter->mAgpsEnabled) { + loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); + loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb, NULL, NULL, &loc_eng_data); } @@ -2341,9 +2139,7 @@ getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) { break; } case AGPS_TYPE_SUPL_ES: { - locEng.ds_nif ? - stateMachine = locEng.ds_nif: - stateMachine = locEng.agnss_nif; + stateMachine = locEng.ds_nif; break; } default: @@ -2523,14 +2319,7 @@ static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data, if (LOC_AGPS_SUPL_SERVER == type) { char url[MAX_URL_LEN]; - unsigned int len = 0; - const char nohost[] = "NONE"; - if (hostname == NULL || - strncasecmp(nohost, hostname, sizeof(nohost)) == 0) { - url[0] = NULL; - } else { - len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port); - } + unsigned int len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port); if (sizeof(url) > len) { adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len)); @@ -2580,29 +2369,29 @@ int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG_CALLFLOW(); int ret_val = 0; - LOC_LOGV("save the address, type: %d, hostname: %s, port: %d", - (int) type, hostname, port); - switch (type) - { - case LOC_AGPS_SUPL_SERVER: - strlcpy(loc_eng_data.supl_host_buf, hostname, - sizeof(loc_eng_data.supl_host_buf)); - loc_eng_data.supl_port_buf = port; - loc_eng_data.supl_host_set = 1; - break; - case LOC_AGPS_CDMA_PDE_SERVER: - strlcpy(loc_eng_data.c2k_host_buf, hostname, - sizeof(loc_eng_data.c2k_host_buf)); - loc_eng_data.c2k_port_buf = port; - loc_eng_data.c2k_host_set = 1; - break; - default: - LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type); - } - if (NULL != loc_eng_data.adapter) { ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port); + } else { + LOC_LOGW("set_server called before init. save the address, type: %d, hostname: %s, port: %d", + (int) type, hostname, port); + switch (type) + { + case LOC_AGPS_SUPL_SERVER: + strlcpy(loc_eng_data.supl_host_buf, hostname, + sizeof(loc_eng_data.supl_host_buf)); + loc_eng_data.supl_port_buf = port; + loc_eng_data.supl_host_set = 1; + break; + case LOC_AGPS_CDMA_PDE_SERVER: + strlcpy(loc_eng_data.c2k_host_buf, hostname, + sizeof(loc_eng_data.c2k_host_buf)); + loc_eng_data.c2k_port_buf = port; + loc_eng_data.c2k_host_set = 1; + break; + default: + LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type); + } } EXIT_LOG(%d, ret_val); @@ -2649,93 +2438,6 @@ void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_d EXIT_LOG(%s, VOID_RET); } -int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data, - const DerEncodedCertificate* certificates, - size_t numberOfCerts) -{ - ENTRY_LOG_CALLFLOW(); - int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS; - - uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK; - uint32_t slotCount = 0; - for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) { - slotBitMaskCounter &= slotBitMaskCounter - 1; - } - LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u", - slotBitMask, slotCount, numberOfCerts); - - LocEngAdapter* adapter = loc_eng_data.adapter; - - if (numberOfCerts == 0) { - LOC_LOGE("No certs to install, since numberOfCerts is zero"); - ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS; - } else if (!adapter) { - LOC_LOGE("adapter is null!"); - ret_val = AGPS_CERTIFICATE_ERROR_GENERIC; - } else if (slotCount < numberOfCerts) { - LOC_LOGE("Not enough cert slots (%u) to install %u certs!", - slotCount, numberOfCerts); - ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES; - } else { - for (int i=0; i < numberOfCerts; ++i) - { - if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) { - LOC_LOGE("cert#(%u) length of %u is too big! greater than %u", - certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH); - ret_val = AGPS_CERTIFICATE_ERROR_GENERIC; - break; - } - } - - if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) { - adapter->sendMsg(new LocEngInstallAGpsCert(adapter, - certificates, - numberOfCerts, - slotBitMask)); - } - } - - EXIT_LOG(%d, ret_val); - return ret_val; -} - -void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, - const char* config_data, int32_t length) -{ - ENTRY_LOG_CALLFLOW(); - - if (config_data && length > 0) { - loc_gps_cfg_s_type gps_conf_tmp = gps_conf; - UTIL_UPDATE_CONF(config_data, length, gps_conf_table); - LocEngAdapter* adapter = loc_eng_data.adapter; - - // it is possible that HAL is not init'ed at this time - if (adapter) { - if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) { - adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER)); - } - if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) { - adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE)); - } - if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) { - adapter->sendMsg(new LocEngAGlonassProtocol(adapter, - gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); - } - if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) { - adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy())); - } - } - - gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER; - gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE; - gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT; - gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK; - gps_conf = gps_conf_tmp; - } - - EXIT_LOG(%s, VOID_RET); -} - /*=========================================================================== FUNCTION loc_eng_report_status @@ -2835,8 +2537,6 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ENTRY_LOG(); loc_eng_reinit(loc_eng_data); - loc_eng_data.adapter->requestPowerVote(); - if (loc_eng_data.agps_status_cb != NULL) { if (loc_eng_data.agnss_nif) loc_eng_data.agnss_nif->dropAllSubscribers(); @@ -2846,11 +2546,14 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) loc_eng_agps_reinit(loc_eng_data); } + loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_ON); + // modem is back up. If we crashed in the middle of navigating, we restart. if (loc_eng_data.adapter->isInSession()) { // This sets the copy in adapter to modem + loc_eng_data.adapter->setPositionMode(NULL); loc_eng_data.adapter->setInSession(false); - loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter)); + loc_eng_start_handler(loc_eng_data); } EXIT_LOG(%s, VOID_RET); } @@ -2880,8 +2583,8 @@ int loc_eng_read_config(void) loc_default_parameters(); // We only want to parse the conf file once. This is a good place to ensure that. // In fact one day the conf file should go into context. - UTIL_READ_CONF(GPS_CONF_FILE, gps_conf_table); - UTIL_READ_CONF(SAP_CONF_FILE, sap_conf_table); + UTIL_READ_CONF(GPS_CONF_FILE, loc_parameter_table); + UTIL_READ_CONF(SAP_CONF_FILE, loc_parameter_table); configAlreadyRead = true; } else { LOC_LOGV("GPS Config file has already been read\n"); @@ -2890,80 +2593,3 @@ int loc_eng_read_config(void) EXIT_LOG(%d, 0); return 0; } - -/*=========================================================================== -FUNCTION loc_eng_gps_measurement_init - -DESCRIPTION - Initialize gps measurement module. - -DEPENDENCIES - N/A - -RETURN VALUE - 0: success - -SIDE EFFECTS - N/A - -===========================================================================*/ -int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data, - GpsMeasurementCallbacks* callbacks) -{ - ENTRY_LOG_CALLFLOW(); - - STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb), - "gps measurement already initialized", - return GPS_MEASUREMENT_ERROR_ALREADY_INIT); - STATE_CHECK((callbacks != NULL), - "callbacks can not be NULL", - return GPS_MEASUREMENT_ERROR_GENERIC); - STATE_CHECK(loc_eng_data.adapter, - "GpsInterface must be initialized first", - return GPS_MEASUREMENT_ERROR_GENERIC); - - // updated the mask - LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; - loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask( - &loc_eng_data, - event, - LOC_REGISTRATION_MASK_ENABLED)); - // set up the callback - loc_eng_data.gps_measurement_cb = callbacks->measurement_callback; - LOC_LOGD ("%s, event masks updated successfully", __func__); - - return GPS_MEASUREMENT_OPERATION_SUCCESS; -} - -/*=========================================================================== -FUNCTION loc_eng_gps_measurement_close - -DESCRIPTION - Close gps measurement module. - -DEPENDENCIES - N/A - -RETURN VALUE - N/A - -SIDE EFFECTS - N/A - -===========================================================================*/ -void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data) -{ - ENTRY_LOG_CALLFLOW(); - - INIT_CHECK(loc_eng_data.adapter, return); - - // updated the mask - LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; - loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask( - &loc_eng_data, - event, - LOC_REGISTRATION_MASK_DISABLED)); - // set up the callback - loc_eng_data.gps_measurement_cb = NULL; - EXIT_LOG(%d, 0); -} diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 92814f8d..c1dc8af5 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -89,11 +89,9 @@ typedef struct loc_eng_data_s agps_status_extended agps_status_cb; gps_nmea_callback nmea_cb; gps_ni_notify_callback ni_notify_cb; - gps_set_capabilities set_capabilities_cb; gps_acquire_wakelock acquire_wakelock_cb; gps_release_wakelock release_wakelock_cb; gps_request_utc_time request_utc_time_cb; - gps_measurement_callback gps_measurement_cb; boolean intermediateFix; AGpsStatusValue agps_status; loc_eng_xtra_data_s_type xtra_module_data; @@ -139,50 +137,36 @@ typedef struct loc_eng_data_s } loc_eng_data_s_type; /* GPS.conf support */ -/* NOTE: the implementaiton of the parser casts number - fields to 32 bit. To ensure all 'n' fields working, - they must all be 32 bit fields. */ typedef struct loc_gps_cfg_s { - uint32_t INTERMEDIATE_POS; - uint32_t ACCURACY_THRES; - uint32_t SUPL_VER; - uint32_t SUPL_MODE; - uint32_t CAPABILITIES; - uint32_t LPP_PROFILE; - uint32_t XTRA_VERSION_CHECK; - char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH]; - char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH]; - char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH]; - uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL; - uint32_t NMEA_PROVIDER; - uint32_t GPS_LOCK; - uint32_t A_GLONASS_POS_PROTOCOL_SELECT; - uint32_t AGPS_CERT_WRITABLE_MASK; + unsigned long INTERMEDIATE_POS; + unsigned long ACCURACY_THRES; + unsigned long SUPL_VER; + unsigned long CAPABILITIES; + unsigned long QUIPC_ENABLED; + unsigned long LPP_PROFILE; + uint8_t NMEA_PROVIDER; + unsigned long A_GLONASS_POS_PROTOCOL_SELECT; + char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH]; } loc_gps_cfg_s_type; -/* 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; + unsigned long SENSOR_ACCEL_BATCHES_PER_SEC; + unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH; + unsigned long SENSOR_GYRO_BATCHES_PER_SEC; + unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH; + unsigned long SENSOR_ACCEL_BATCHES_PER_SEC_HIGH; + unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH; + unsigned long SENSOR_GYRO_BATCHES_PER_SEC_HIGH; + unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH; + unsigned long SENSOR_CONTROL_MODE; + unsigned long SENSOR_USAGE; + unsigned long SENSOR_ALGORITHM_CONFIG_MASK; uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID; double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY; uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID; @@ -191,16 +175,11 @@ typedef struct double RATE_RANDOM_WALK_SPECTRAL_DENSITY; uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID; double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY; - uint32_t SENSOR_PROVIDER; } loc_sap_cfg_s_type; extern loc_gps_cfg_s_type gps_conf; extern loc_sap_cfg_s_type sap_conf; - -uint32_t getCarrierCapabilities(); - -//loc_eng functions int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, LOC_API_ADAPTER_EVENT_MASK_T event, @@ -220,33 +199,35 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data, LocPosMode ¶ms); const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data, const char* name); -int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, - LocServerType type, const char *hostname, int port); -void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data); -int loc_eng_read_config(void); - -//loc_eng_agps functions void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks); int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType, const char* apn, AGpsBearerType bearerType); int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType); int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType); + +int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, + LocServerType type, const char *hostname, int port); + + void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data, int avaiable, const char* apn); -int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data, - const DerEncodedCertificate* certificates, - size_t length); -//loc_eng_xtra functions -int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, + +bool loc_eng_inject_raw_command(loc_eng_data_s_type &loc_eng_data, + char* command, int length); + + +void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data); + +int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, GpsXtraExtCallbacks* callbacks); -int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, - char* data, int length); -int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data); -void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, int check); -//loc_eng_ni functions +int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, + char* data, int length); + +int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data); + extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks); extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data, @@ -255,12 +236,7 @@ extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, const GpsNiNotification *notif, const void* passThrough); extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data); - -void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, - const char* config_data, int32_t length); -int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data, - GpsMeasurementCallbacks* callbacks); -void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data); +int loc_eng_read_config(void); #ifdef __cplusplus } diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp index 43af70fe..cf9fe82d 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.cpp +++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp @@ -761,11 +761,11 @@ int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const if (s == NULL) { nifRequest.ipv4_addr = INADDR_NONE; - memset(&nifRequest.addr, 0, sizeof(nifRequest.addr)); + nifRequest.ipv6_addr[0] = 0; nifRequest.ssid[0] = '\0'; nifRequest.password[0] = '\0'; } else { - s->setIPAddresses(nifRequest.addr); + s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr); s->setWifiInfo(nifRequest.ssid, nifRequest.password); } diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h index 8b8f9f44..d68970f3 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/loc_api/libloc_api_50001/loc_eng_agps.h @@ -280,7 +280,6 @@ struct Subscriber { inline virtual ~Subscriber() {} virtual void setIPAddresses(uint32_t &v4, char* v6) = 0; - virtual void setIPAddresses(struct sockaddr_storage& addr) = 0; inline virtual void setWifiInfo(char* ssid, char* password) { ssid[0] = 0; password[0] = 0; } @@ -321,9 +320,6 @@ struct BITSubscriber : public Subscriber { inline virtual void setIPAddresses(uint32_t &v4, char* v6) { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); } - inline virtual void setIPAddresses(struct sockaddr_storage& addr) - { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ } - virtual Subscriber* clone() { return new BITSubscriber(mStateMachine, ID, mIPv6Addr); @@ -348,9 +344,6 @@ struct ATLSubscriber : public Subscriber { inline virtual void setIPAddresses(uint32_t &v4, char* v6) { v4 = INADDR_NONE; v6[0] = 0; } - inline virtual void setIPAddresses(struct sockaddr_storage& addr) - { addr.ss_family = AF_INET6; } - inline virtual Subscriber* clone() { return new ATLSubscriber(ID, mStateMachine, mLocAdapter, @@ -383,9 +376,6 @@ struct WIFISubscriber : public Subscriber { inline virtual void setIPAddresses(uint32_t &v4, char* v6) {} - inline virtual void setIPAddresses(struct sockaddr_storage& addr) - { addr.ss_family = AF_INET6; } - inline virtual void setWifiInfo(char* ssid, char* password) { if (NULL != mSSID) @@ -419,8 +409,6 @@ struct DSSubscriber : public Subscriber { mIsInactive = false; } inline virtual void setIPAddresses(uint32_t &v4, char* v6) {} - inline virtual void setIPAddresses(struct sockaddr_storage& addr) - { addr.ss_family = AF_INET6; } virtual Subscriber* clone() {return new DSSubscriber(mStateMachine, ID);} virtual bool notifyRsrcStatus(Notification ¬ification); diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp index 5510fc5c..d24e0c9d 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp @@ -136,7 +136,7 @@ static int loc_api_server_proc(void *context) free(p_cmsgbuf); LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__); usleep(1000); - return -1; + return 0; } LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type); diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn.h index 1d8c1428..c7c100b2 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn.h +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,11 +33,11 @@ #ifdef _ANDROID_ -#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q" -#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q" -#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q" -#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q" -#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q" +#define GPSONE_LOC_API_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_q" +#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_resp_q" +#define QUIPC_CTRL_Q_PATH "/data/misc/gpsone_d/quipc_ctrl_q" +#define MSAPM_CTRL_Q_PATH "/data/misc/gpsone_d/msapm_ctrl_q" +#define MSAPU_CTRL_Q_PATH "/data/misc/gpsone_d/msapu_ctrl_q" #else diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index 3a1a86b9..9a8b0e4d 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -105,11 +105,11 @@ struct LocEngReportPosition : public LocMsg { struct LocEngReportSv : public LocMsg { LocAdapterBase* mAdapter; - const GnssSvStatus mSvStatus; + const GpsSvStatus mSvStatus; const GpsLocationExtended mLocationExtended; const void* mSvExt; LocEngReportSv(LocAdapterBase* adapter, - GnssSvStatus &sv, + GpsSvStatus &sv, GpsLocationExtended &locExtended, void* svExtended); virtual void proc() const; @@ -289,16 +289,6 @@ struct LocEngGetZpp : public LocMsg { void send() const; }; -struct LocEngReportGpsMeasurement : public LocMsg { - void* mLocEng; - const GpsData mGpsData; - LocEngReportGpsMeasurement(void* locEng, - GpsData &gpsData); - virtual void proc() const; - void locallog() const; - virtual void log() const; -}; - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index 3b20bbbc..cc894481 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -115,45 +115,28 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG(); char lcs_addr[32]; // Decoded LCS address for UMTS CP NI loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data; - loc_eng_ni_session_s_type* pSession = NULL; if (NULL == loc_eng_data.ni_notify_cb) { EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet."); return; } - if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) { - if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { - LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d", - notif->ni_type); - if (NULL != passThrough) { - free((void*)passThrough); - } - } else { - pSession = &loc_eng_ni_data_p->sessionEs; - } - } else { - if (NULL != loc_eng_ni_data_p->session.rawRequest || - NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { - LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d", - notif->ni_type); - if (NULL != passThrough) { - free((void*)passThrough); - } - } else { - pSession = &loc_eng_ni_data_p->session; + /* If busy, use default or deny */ + if (NULL != loc_eng_ni_data_p->rawRequest) + { + /* XXX Consider sending a NO RESPONSE reply or queue the request */ + LOC_LOGW("loc_eng_ni_request_handler, notification in progress, new NI request ignored, type: %d", + notif->ni_type); + if (NULL != passThrough) { + free((void*)passThrough); } } - - - if (pSession) { + else { /* Save request */ - pSession->rawRequest = (void*)passThrough; - pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter; - pSession->adapter = loc_eng_data.adapter; + loc_eng_ni_data_p->rawRequest = (void*)passThrough; /* Fill in notification */ - ((GpsNiNotification*)notif)->notification_id = pSession->reqID; + ((GpsNiNotification*)notif)->notification_id = loc_eng_ni_data_p->reqID; if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE) { @@ -172,16 +155,16 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, /* For robustness, spawn a thread at this point to timeout to clear up the notification status, even though * the OEM layer in java does not do so. **/ - pSession->respTimeLeft = 5 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME); - LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft); + loc_eng_ni_data_p->respTimeLeft = 5 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME); + LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data_p->respTimeLeft); int rc = 0; - rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession); + rc = pthread_create(&loc_eng_ni_data_p->thread, NULL, ni_thread_proc, &loc_eng_data); if (rc) { LOC_LOGE("Loc NI thread is not created.\n"); } - rc = pthread_detach(pSession->thread); + rc = pthread_detach(loc_eng_ni_data_p->thread); if (rc) { LOC_LOGE("Loc NI thread is not detached.\n"); @@ -202,63 +185,61 @@ static void* ni_thread_proc(void *args) { ENTRY_LOG(); - loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args; + loc_eng_data_s_type* loc_eng_data_p = (loc_eng_data_s_type*)args; + loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data_p->loc_eng_ni_data; int rc = 0; /* return code from pthread calls */ struct timeval present_time; struct timespec expire_time; LOC_LOGD("Starting Loc NI thread...\n"); - pthread_mutex_lock(&pSession->tLock); + pthread_mutex_lock(&loc_eng_ni_data_p->tLock); /* Calculate absolute expire time */ gettimeofday(&present_time, NULL); - expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft; + expire_time.tv_sec = present_time.tv_sec + loc_eng_ni_data_p->respTimeLeft; expire_time.tv_nsec = present_time.tv_usec * 1000; LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n", - (long) expire_time.tv_sec, pSession->respTimeLeft ); + (long) expire_time.tv_sec, loc_eng_ni_data_p->respTimeLeft ); - while (!pSession->respRecvd) + while (!loc_eng_ni_data_p->respRecvd) { - rc = pthread_cond_timedwait(&pSession->tCond, - &pSession->tLock, + rc = pthread_cond_timedwait(&loc_eng_ni_data_p->tCond, + &loc_eng_ni_data_p->tLock, &expire_time); if (rc == ETIMEDOUT) { - pSession->resp = GPS_NI_RESPONSE_NORESP; + loc_eng_ni_data_p->resp = GPS_NI_RESPONSE_NORESP; LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc ); break; } } LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from " "pthread_cond_timedwait = %d\n",rc ); - pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/ - - LOC_LOGD("pSession->resp is %d\n",pSession->resp); + loc_eng_ni_data_p->respRecvd = FALSE; /* Reset the user response flag for the next session*/ LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() - LocEngAdapter* adapter = pSession->adapter; + LocEngAdapter* adapter = loc_eng_data_p->adapter; LocEngInformNiResponse *msg = NULL; - if (NULL != pSession->rawRequest) { - if (pSession->resp != GPS_NI_RESPONSE_IGNORE) { - LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n"); + if (NULL != loc_eng_ni_data_p->rawRequest) { + if (loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE) { + LOC_LOGD("loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE \n"); msg = new LocEngInformNiResponse(adapter, - pSession->resp, - pSession->rawRequest); + loc_eng_ni_data_p->resp, + loc_eng_ni_data_p->rawRequest); } else { LOC_LOGD("this is the ignore reply for SUPL ES\n"); - free(pSession->rawRequest); } - pSession->rawRequest = NULL; + loc_eng_ni_data_p->rawRequest = NULL; } - pthread_mutex_unlock(&pSession->tLock); + pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); - pSession->respTimeLeft = 0; - pSession->reqID = 0; + loc_eng_ni_data_p->respTimeLeft = 0; + loc_eng_ni_data_p->reqID++; if (NULL != msg) { LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n"); @@ -280,28 +261,16 @@ void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data) } // only if modem has requested but then died. - if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { - free(loc_eng_ni_data_p->sessionEs.rawRequest); - loc_eng_ni_data_p->sessionEs.rawRequest = NULL; + if (NULL != loc_eng_ni_data_p->rawRequest) { + free(loc_eng_ni_data_p->rawRequest); + loc_eng_ni_data_p->rawRequest = NULL; - pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock); + pthread_mutex_lock(&loc_eng_ni_data_p->tLock); // the goal is to wake up ni_thread_proc // and let it exit. - loc_eng_ni_data_p->sessionEs.respRecvd = TRUE; - pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond); - pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock); - } - - if (NULL != loc_eng_ni_data_p->session.rawRequest) { - free(loc_eng_ni_data_p->session.rawRequest); - loc_eng_ni_data_p->session.rawRequest = NULL; - - pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock); - // the goal is to wake up ni_thread_proc - // and let it exit. - loc_eng_ni_data_p->session.respRecvd = TRUE; - pthread_cond_signal(&loc_eng_ni_data_p->session.tCond); - pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock); + loc_eng_ni_data_p->respRecvd = TRUE; + pthread_cond_signal(&loc_eng_ni_data_p->tCond); + pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); } EXIT_LOG(%s, VOID_RET); @@ -335,19 +304,12 @@ void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callb EXIT_LOG(%s, "loc_eng_ni_init: already inited."); } else { loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data; - loc_eng_ni_data_p->sessionEs.respTimeLeft = 0; - loc_eng_ni_data_p->sessionEs.respRecvd = FALSE; - loc_eng_ni_data_p->sessionEs.rawRequest = NULL; - loc_eng_ni_data_p->sessionEs.reqID = 0; - pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL); - pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL); - - loc_eng_ni_data_p->session.respTimeLeft = 0; - loc_eng_ni_data_p->session.respRecvd = FALSE; - loc_eng_ni_data_p->session.rawRequest = NULL; - loc_eng_ni_data_p->session.reqID = 0; - pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL); - pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL); + loc_eng_ni_data_p->respTimeLeft = 0; + loc_eng_ni_data_p->respRecvd = FALSE; + loc_eng_ni_data_p->rawRequest = NULL; + loc_eng_ni_data_p->reqID = 0; + pthread_cond_init(&loc_eng_ni_data_p->tCond, NULL); + pthread_mutex_init(&loc_eng_ni_data_p->tLock, NULL); loc_eng_data.ni_notify_cb = callbacks->notify_cb; EXIT_LOG(%s, VOID_RET); @@ -375,40 +337,25 @@ void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data, { ENTRY_LOG_CALLFLOW(); loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data; - loc_eng_ni_session_s_type* pSession = NULL; if (NULL == loc_eng_data.ni_notify_cb) { EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet."); return; } - if (notif_id == loc_eng_ni_data_p->sessionEs.reqID && - NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { - pSession = &loc_eng_ni_data_p->sessionEs; - // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted - if (user_response == GPS_NI_RESPONSE_ACCEPT && - NULL != loc_eng_ni_data_p->session.rawRequest) { - pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock); - loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE; - loc_eng_ni_data_p->session.respRecvd = TRUE; - pthread_cond_signal(&loc_eng_ni_data_p->session.tCond); - pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock); - } - } else if (notif_id == loc_eng_ni_data_p->session.reqID && - NULL != loc_eng_ni_data_p->session.rawRequest) { - pSession = &loc_eng_ni_data_p->session; - } - - if (pSession) { + if (notif_id == loc_eng_ni_data_p->reqID && + NULL != loc_eng_ni_data_p->rawRequest) + { LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id); - pthread_mutex_lock(&pSession->tLock); - pSession->resp = user_response; - pSession->respRecvd = TRUE; - pthread_cond_signal(&pSession->tCond); - pthread_mutex_unlock(&pSession->tLock); + pthread_mutex_lock(&loc_eng_ni_data_p->tLock); + loc_eng_ni_data_p->resp = user_response; + loc_eng_ni_data_p->respRecvd = TRUE; + pthread_cond_signal(&loc_eng_ni_data_p->tCond); + pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); } else { - LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id); + LOC_LOGE("loc_eng_ni_respond: reqID %d and notif_id %d mismatch or rawRequest %p, response: %d", + loc_eng_ni_data_p->reqID, notif_id, loc_eng_ni_data_p->rawRequest, user_response); } EXIT_LOG(%s, VOID_RET); diff --git a/loc_api/libloc_api_50001/loc_eng_ni.h b/loc_api/libloc_api_50001/loc_eng_ni.h index 068f5cdd..8c076041 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.h +++ b/loc_api/libloc_api_50001/loc_eng_ni.h @@ -31,7 +31,6 @@ #define LOC_ENG_NI_H #include -#include #define LOC_NI_NO_RESPONSE_TIME 20 /* secs */ #define LOC_NI_NOTIF_KEY_ADDRESS "Address" @@ -46,13 +45,6 @@ typedef struct { GpsUserResponseType resp; pthread_cond_t tCond; pthread_mutex_t tLock; - LocEngAdapter* adapter; -} loc_eng_ni_session_s_type; - -typedef struct { - loc_eng_ni_session_s_type session; /* SUPL NI Session */ - loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */ - int reqIDCounter; } loc_eng_ni_data_s_type; diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 2a23db32..6c9356e4 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -119,17 +119,13 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, unsigned char generate_nmea) { ENTRY_LOG(); - time_t utcTime(location.gpsLocation.timestamp/1000); - tm * pTm = gmtime(&utcTime); - if (NULL == pTm) { - LOC_LOGE("gmtime failed"); - return; - } char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0}; char* pMarker = sentence; int lengthRemaining = sizeof(sentence); int length = 0; + time_t utcTime(location.gpsLocation.timestamp/1000); + tm * pTm = gmtime(&utcTime); int utcYear = pTm->tm_year % 100; // 2 digit year int utcMonth = pTm->tm_mon + 1; // tm_mon starts at zero int utcDay = pTm->tm_mday; @@ -605,7 +601,7 @@ SIDE EFFECTS ===========================================================================*/ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, - const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended) + const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended) { ENTRY_LOG(); @@ -791,24 +787,46 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, }//if - // cache the used in fix mask, as it will be needed to send $GPGSA - // during the position report - loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask; + if (svStatus.used_in_fix_mask == 0) + { // No sv used, so there will be no position report, so send + // blank NMEA sentences + strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence)); + length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); + loc_eng_nmea_send(sentence, length, loc_eng_data_p); - // For RPC, the DOP are sent during sv report, so cache them - // now to be sent during position report. - // For QMI, the DOP will be in position report. - if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) - { - loc_eng_data_p->pdop = locationExtended.pdop; - loc_eng_data_p->hdop = locationExtended.hdop; - loc_eng_data_p->vdop = locationExtended.vdop; + strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence)); + length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); + loc_eng_nmea_send(sentence, length, loc_eng_data_p); + + strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence)); + length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); + loc_eng_nmea_send(sentence, length, loc_eng_data_p); + + strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence)); + length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); + loc_eng_nmea_send(sentence, length, loc_eng_data_p); } else - { - loc_eng_data_p->pdop = 0; - loc_eng_data_p->hdop = 0; - loc_eng_data_p->vdop = 0; + { // cache the used in fix mask, as it will be needed to send $GPGSA + // during the position report + loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask; + + // For RPC, the DOP are sent during sv report, so cache them + // now to be sent during position report. + // For QMI, the DOP will be in position report. + if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) + { + loc_eng_data_p->pdop = locationExtended.pdop; + loc_eng_data_p->hdop = locationExtended.hdop; + loc_eng_data_p->vdop = locationExtended.vdop; + } + else + { + loc_eng_data_p->pdop = 0; + loc_eng_data_p->hdop = 0; + loc_eng_data_p->vdop = 0; + } + } EXIT_LOG(%d, 0); diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.h b/loc_api/libloc_api_50001/loc_eng_nmea.h index 066943aa..40c6dbbd 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.h +++ b/loc_api/libloc_api_50001/loc_eng_nmea.h @@ -31,13 +31,12 @@ #define LOC_ENG_NMEA_H #include -#include #define NMEA_SENTENCE_MAX_LENGTH 200 void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p); int loc_eng_nmea_put_checksum(char *pNmea, int maxSize); -void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended); +void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended); void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea); #endif // LOC_ENG_NMEA_H diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/loc_api/libloc_api_50001/loc_eng_xtra.cpp index 9207564b..1459c4c7 100644 --- a/loc_api/libloc_api_50001/loc_eng_xtra.cpp +++ b/loc_api/libloc_api_50001/loc_eng_xtra.cpp @@ -81,25 +81,6 @@ struct LocEngInjectXtraData : public LocMsg { } }; -struct LocEngSetXtraVersionCheck : public LocMsg { - LocEngAdapter *mAdapter; - int mCheck; - inline LocEngSetXtraVersionCheck(LocEngAdapter* adapter, - int check): - mAdapter(adapter), mCheck(check) {} - inline virtual void proc() const { - locallog(); - mAdapter->setXtraVersionCheck(mCheck); - } - inline void locallog() const { - LOC_LOGD("%s:%d]: mCheck: %d", - __func__, __LINE__, mCheck); - } - inline virtual void log() const { - locallog(); - } -}; - /*=========================================================================== FUNCTION loc_eng_xtra_init @@ -121,7 +102,6 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, { int ret_val = -1; loc_eng_xtra_data_s_type *xtra_module_data_ptr; - ENTRY_LOG(); if(callbacks == NULL) { LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL"); @@ -132,7 +112,6 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, ret_val = 0; } - EXIT_LOG(%d, ret_val); return ret_val; } @@ -146,7 +125,8 @@ DEPENDENCIES N/A RETURN VALUE - 0 + 0: success + >0: failure SIDE EFFECTS N/A @@ -155,10 +135,9 @@ SIDE EFFECTS int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, char* data, int length) { - ENTRY_LOG(); LocEngAdapter* adapter = loc_eng_data.adapter; adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length)); - EXIT_LOG(%d, 0); + return 0; } /*=========================================================================== @@ -171,7 +150,7 @@ DEPENDENCIES N/A RETURN VALUE - 0 + length of server string SIDE EFFECTS N/A @@ -179,34 +158,9 @@ SIDE EFFECTS ===========================================================================*/ int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data) { - ENTRY_LOG(); LocEngAdapter* adapter = loc_eng_data.adapter; adapter->sendMsg(new LocEngRequestXtraServer(adapter)); - EXIT_LOG(%d, 0); + return 0; -} -/*=========================================================================== -FUNCTION loc_eng_xtra_version_check - -DESCRIPTION - Injects the enable/disable value for checking XTRA version - that is specified in gps.conf - -DEPENDENCIES - N/A - -RETURN VALUE - none - -SIDE EFFECTS - N/A - -===========================================================================*/ -void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, - int check) -{ - ENTRY_LOG(); - LocEngAdapter *adapter = loc_eng_data.adapter; - adapter->sendMsg(new LocEngSetXtraVersionCheck(adapter, check)); - EXIT_LOG(%d, 0); + } diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h index 205c9fff..f78303c9 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014 The Linux Foundation. All rights reserved. +/* Copyright (c) 2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -82,8 +82,6 @@ extern const char FROM_MODEM[]; extern const char TO_AFW[]; extern const char EXIT_TAG[]; extern const char ENTRY_TAG[]; -extern const char EXIT_ERROR_TAG[]; - /*============================================================================= * * MODULE EXPORTED FUNCTIONS @@ -99,47 +97,37 @@ char* get_timestamp(char* str, unsigned long buf_size); if that value remains unchanged, it means gps.conf did not provide a value and we default to the initial value to use Android's logging levels*/ -#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) - -#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) - -#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) - -#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) - -#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) - #define LOC_LOGE(...) \ -IF_LOC_LOGE { ALOGE("E/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/" __VA_ARGS__); } +if ((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("W/"__VA_ARGS__); } #define LOC_LOGW(...) \ -IF_LOC_LOGW { ALOGE("W/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); } +if ((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/"__VA_ARGS__); } #define LOC_LOGI(...) \ -IF_LOC_LOGI { ALOGE("I/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); } +if ((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("I/"__VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/"__VA_ARGS__); } #define LOC_LOGD(...) \ -IF_LOC_LOGD { ALOGE("D/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); } +if ((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("D/"__VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/"__VA_ARGS__); } #define LOC_LOGV(...) \ -IF_LOC_LOGV { ALOGE("V/" __VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } +if ((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("V/"__VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); } #else /* DEBUG_DMN_LOC_API */ -#define LOC_LOGE(...) ALOGE("E/" __VA_ARGS__) +#define LOC_LOGE(...) ALOGE("E/"__VA_ARGS__) -#define LOC_LOGW(...) ALOGW("W/" __VA_ARGS__) +#define LOC_LOGW(...) ALOGW("W/"__VA_ARGS__) -#define LOC_LOGI(...) ALOGI("I/" __VA_ARGS__) +#define LOC_LOGI(...) ALOGI("I/"__VA_ARGS__) -#define LOC_LOGD(...) ALOGD("D/" __VA_ARGS__) +#define LOC_LOGD(...) ALOGD("D/"__VA_ARGS__) -#define LOC_LOGV(...) ALOGV("V/" __VA_ARGS__) +#define LOC_LOGV(...) ALOGV("V/"__VA_ARGS__) #endif /* DEBUG_DMN_LOC_API */ @@ -160,18 +148,12 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } } \ } while(0) + #define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL) #define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL) -#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL) #define ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "") #define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL) -#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \ - if (VAL != 0) { \ - LOG_E(EXIT_ERROR_TAG, __func__, SPEC, VAL); \ - } else { \ - LOG_V(EXIT_TAG, __func__, SPEC, VAL); \ - } // Used for logging callflow from Android Framework diff --git a/utils/Android.mk b/utils/Android.mk index 37512a58..24ab8a13 100644 --- a/utils/Android.mk +++ b/utils/Android.mk @@ -18,27 +18,19 @@ LOCAL_SRC_FILES += \ msg_q.c \ linked_list.c \ loc_target.cpp \ - platform_lib_abstractions/elapsed_millis_since_boot.cpp \ - LocHeap.cpp \ - LocTimer.cpp \ - LocThread.cpp \ - MsgTask.cpp \ - loc_misc_utils.cpp + loc_timer.c \ + ../platform_lib_abstractions/elapsed_millis_since_boot.cpp + LOCAL_CFLAGS += \ -fno-short-enums \ - -D_ANDROID_ \ - -std=c++11 - -ifeq ($(TARGET_BUILD_VARIANT),user) - LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER -endif + -D_ANDROID_ LOCAL_LDFLAGS += -Wl,--export-dynamic ## Includes LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/platform_lib_abstractions + $(LOCAL_PATH)/../platform_lib_abstractions LOCAL_COPY_HEADERS_TO:= gps.utils/ LOCAL_COPY_HEADERS:= \ @@ -47,25 +39,20 @@ LOCAL_COPY_HEADERS:= \ log_util.h \ linked_list.h \ msg_q.h \ - MsgTask.h \ - LocHeap.h \ - LocThread.h \ - LocTimer.h \ loc_target.h \ loc_timer.h \ - LocSharedLock.h \ - platform_lib_abstractions/platform_lib_includes.h \ - platform_lib_abstractions/platform_lib_time.h \ - platform_lib_abstractions/platform_lib_macros.h \ - loc_misc_utils.h + ../platform_lib_abstractions/platform_lib_includes.h \ + ../platform_lib_abstractions/platform_lib_time.h \ + ../platform_lib_abstractions/platform_lib_macros.h + LOCAL_MODULE := libgps.utils -LOCAL_CLANG := false LOCAL_MODULE_TAGS := optional LOCAL_PRELINK_MODULE := false +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) include $(BUILD_SHARED_LIBRARY) endif # not BUILD_TINY_ANDROID endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE diff --git a/utils/LocHeap.cpp b/utils/LocHeap.cpp deleted file mode 100644 index d667f14f..00000000 --- a/utils/LocHeap.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#include - -class LocHeapNode { - friend class LocHeap; - - // size of of the subtree, excluding self, 1 if no subtree - int mSize; - LocHeapNode* mLeft; - LocHeapNode* mRight; - LocRankable* mData; -public: - inline LocHeapNode(LocRankable& data) : - mSize(1), mLeft(NULL), mRight(NULL), mData(&data) {} - ~LocHeapNode(); - - // this only swaps the data of the two nodes, so no - // detach / re-attached is necessary - void swap(LocHeapNode& node); - - LocRankable* detachData(); - - // push a node into the tree stucture, keeping sorted by rank - void push(LocHeapNode& node); - - // pop the head node out of the tree stucture. keeping sorted by rank - static LocHeapNode* pop(LocHeapNode*& top); - - // remove a specific node from the tree - // returns the pointer to the node removed, which would be either the - // same as input (if successfully removed); or NULL (if failed). - static LocHeapNode* remove(LocHeapNode*& top, LocRankable& data); - - // convenience method to compare data ranking - inline bool outRanks(LocHeapNode& node) { return mData->outRanks(*node.mData); } - inline bool outRanks(LocRankable& data) { return mData->outRanks(data); } - - // checks if mSize is correct, AND this node is the highest ranking - // of the entire subtree - bool checkNodes(); - - inline int getSize() { return mSize; } -}; - -inline -LocHeapNode::~LocHeapNode() { - if (mLeft) { - delete mLeft; - mLeft = NULL; - } - if (mRight) { - delete mRight; - mRight = NULL; - } - if (mData) { - mData = NULL; - } -} - -inline -void LocHeapNode::swap(LocHeapNode& node) { - LocRankable* tmpData = node.mData; - node.mData = mData; - mData = tmpData; -} - -inline -LocRankable* LocHeapNode::detachData() { - LocRankable* data = mData; - mData = NULL; - return data; -} - -// push keeps the tree sorted by rank, it also tries to balance the -// tree by adding the new node to the smaller of the subtrees. -// The pointer to the tree and internal links never change. If the -// mData of tree top ranks lower than that of the incoming node, -// mData will be swapped with that of the incoming node to ensure -// ranking, no restructuring the container nodes. -void LocHeapNode::push(LocHeapNode& node) { - // ensure the current node ranks higher than in the incoming one - if (node.outRanks(*this)) { - swap(node); - } - - // now drop the new node (ensured lower than *this) into a subtree - if (NULL == mLeft) { - mLeft = &node; - } else if (NULL == mRight) { - mRight = &node; - } else if (mLeft->mSize <= mRight->mSize) { - mLeft->push(node); - } else { - mRight->push(node); - } - mSize++; -} - -// pop keeps the tree sorted by rank, but it does not try to balance -// the tree. It recursively swaps with the higher ranked top of the -// subtrees. -// The return is a popped out node from leaf level, that has the data -// swapped all the way down from the top. The pinter to the tree and -// internal links will not be changed or restructured, except for the -// node that is popped out. -// If the return pointer == this, this the last node in the tree. -LocHeapNode* LocHeapNode::pop(LocHeapNode*& top) { - // we know the top has the highest ranking at this point, else - // the tree is broken. This top will be popped out. But we need - // a node from the left or right child, whichever ranks higher, - // to replace the current top. This then will need to be done - // recursively to the leaf level. So we swap the mData of the - // current top node all the way down to the leaf level. - LocHeapNode* poppedNode = top; - // top is losing a node in its subtree - top->mSize--; - if (top->mLeft || top->mRight) { - // if mLeft is NULL, mRight for sure is NOT NULL, take that; - // else if mRight is NULL, mLeft for sure is NOT, take that; - // else we take the address of whatever has higher ranking mData - LocHeapNode*& subTop = (NULL == top->mLeft) ? top->mRight : - ((NULL == top->mRight) ? top->mLeft : - (top->mLeft->outRanks(*(top->mRight)) ? top->mLeft : top->mRight)); - // swap mData, the tree top gets updated with the new data. - top->swap(*subTop); - // pop out from the subtree - poppedNode = pop(subTop); - } else { - // if the top has only single node - // detach the poppedNode from the tree - // subTop is the reference of ether mLeft or mRight - // NOT a local stack pointer. so it MUST be NULL'ed here. - top = NULL; - } - - return poppedNode; -} - -// navigating through the tree and find the node that hass the input -// data. Since this is a heap, we do recursive linear search. -// returns the pointer to the node removed, which would be either the -// same as input (if successfully removed); or NULL (if failed). -LocHeapNode* LocHeapNode::remove(LocHeapNode*& top, LocRankable& data) { - LocHeapNode* removedNode = NULL; - // this is the node, by address - if (&data == (LocRankable*)(top->mData)) { - // pop this node out - removedNode = pop(top); - } else if (!data.outRanks(*top->mData)) { - // subtrees might have this node - if (top->mLeft) { - removedNode = remove(top->mLeft, data); - } - // if we did not find in mLeft, and mRight is not empty - if (!removedNode && top->mRight) { - removedNode = remove(top->mRight, data); - } - - // top lost a node in its subtree - if (removedNode) { - top->mSize--; - } - } - - return removedNode; -} - -// checks if mSize is correct, AND this node is the highest ranking -// of the entire subtree -bool LocHeapNode::checkNodes() { - // size of the current subtree - int totalSize = mSize; - if (mLeft) { - // check the consistency of left subtree - if (mLeft->outRanks(*this) || !mLeft->checkNodes()) { - return false; - } - // subtract the size of left subtree (with subtree head) - totalSize -= mLeft->mSize; - } - - if (mRight) { - // check the consistency of right subtree - if (mRight->outRanks(*this) || !mRight->checkNodes()) { - return false; - } - // subtract the size of right subtree (with subtree head) - totalSize -= mRight->mSize; - } - - // for the tree nodes to consistent, totalSize must be 1 now - return totalSize == 1; -} - -LocHeap::~LocHeap() { - if (mTree) { - delete mTree; - } -} - -void LocHeap::push(LocRankable& node) { - LocHeapNode* heapNode = new LocHeapNode(node); - if (!mTree) { - mTree = heapNode; - } else { - mTree->push(*heapNode); - } -} - -LocRankable* LocHeap::peek() { - LocRankable* top = NULL; - if (mTree) { - top = mTree->mData; - } - return top; -} - -LocRankable* LocHeap::pop() { - LocRankable* locNode = NULL; - if (mTree) { - // mTree may become NULL after this call - LocHeapNode* heapNode = LocHeapNode::pop(mTree); - locNode = heapNode->detachData(); - delete heapNode; - } - return locNode; -} - -LocRankable* LocHeap::remove(LocRankable& rankable) { - LocRankable* locNode = NULL; - if (mTree) { - // mTree may become NULL after this call - LocHeapNode* heapNode = LocHeapNode::remove(mTree, rankable); - if (heapNode) { - locNode = heapNode->detachData(); - delete heapNode; - } - } - return locNode; -} - -#ifdef __LOC_UNIT_TEST__ -bool LocHeap::checkTree() { - return ((NULL == mTree) || mTree->checkNodes()); -} -uint32_t LocHeap::getTreeSize() { - return (NULL == mTree) ? 0 : mTree->getSize(); -} -#endif - -#ifdef __LOC_DEBUG__ - -#include -#include -#include - -class LocHeapDebug : public LocHeap { -public: - bool checkTree() { - return ((NULL == mTree) || mTree->checkNodes()); - } - - uint32_t getTreeSize() { - return (NULL == mTree) ? 0 : (mTree->getSize()); - } -}; - -class LocHeapDebugData : public LocRankable { - const int mID; -public: - LocHeapDebugData(int id) : mID(id) {} - inline virtual int ranks(LocRankable& rankable) { - LocHeapDebugData* testData = dynamic_cast(&rankable); - return testData->mID - mID; - } -}; - -// For Linux command line testing: -// compilation: g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../vendor/qcom/proprietary/gps-internal/unit-tests/fakes_for_host -I../../../../system/core/include LocHeap.cpp -// test: valgrind --leak-check=full ./a.out 100 -int main(int argc, char** argv) { - srand(time(NULL)); - int tries = atoi(argv[1]); - int checks = tries >> 3; - LocHeapDebug heap; - int treeSize = 0; - - for (int i = 0; i < tries; i++) { - if (i % checks == 0 && !heap.checkTree()) { - printf("tree check failed before %dth op\n", i); - } - int r = rand(); - - if (r & 1) { - LocHeapDebugData* data = new LocHeapDebugData(r >> 1); - heap.push(dynamic_cast(*data)); - treeSize++; - } else { - LocRankable* rankable = heap.pop(); - if (rankable) { - delete rankable; - } - treeSize ? treeSize-- : 0; - } - - printf("%s: %d == %d\n", (r&1)?"push":"pop", treeSize, heap.getTreeSize()); - if (treeSize != heap.getTreeSize()) { - printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - tries = i+1; - break; - } - } - - if (!heap.checkTree()) { - printf("!!!!!!!!!!tree check failed at the end after %d ops!!!!!!!\n", tries); - } else { - printf("success!\n"); - } - - for (LocRankable* data = heap.pop(); NULL != data; data = heap.pop()) { - delete data; - } - - return 0; -} - -#endif diff --git a/utils/LocHeap.h b/utils/LocHeap.h deleted file mode 100644 index b491948a..00000000 --- a/utils/LocHeap.h +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef __LOC_HEAP__ -#define __LOC_HEAP__ - -#include -#include - -// abstract class to be implemented by client to provide a rankable class -class LocRankable { -public: - virtual inline ~LocRankable() {} - - // method to rank objects of such type for sorting purposes. - // The pointer of the input node would be stored in the heap. - // >0 if ranks higher than the input; - // ==0 if equally ranks with the input; - // <0 if ranks lower than the input - virtual int ranks(LocRankable& rankable) = 0; - - // convenient method to rank objects of such type for sorting purposes. - inline bool outRanks(LocRankable& rankable) { return ranks(rankable) > 0; } -}; - -// opaque class to provide service implementation. -class LocHeapNode; - -// a heap whose left and right children are not sorted. It is sorted only vertically, -// i.e. parent always ranks higher than children, if they exist. Ranking algorithm is -// implemented in Rankable. The reason that there is no sort between children is to -// help beter balance the tree with lower cost. When a node is pushed to the tree, -// it is guaranteed that the subtree that is smaller gets to have the new node. -class LocHeap { -protected: - LocHeapNode* mTree; -public: - inline LocHeap() : mTree(NULL) {} - ~LocHeap(); - - // push keeps the tree sorted by rank, it also tries to balance the - // tree by adding the new node to the smaller of the subtrees. - // node is reference to an obj that is managed by client, that client - // creates and destroyes. The destroy should happen after the - // node is popped out from the heap. - void push(LocRankable& node); - - // Peeks the node data on tree top, which has currently the highest ranking - // There is no change the tree structure with this operation - // Returns NULL if the tree is empty, otherwise pointer to the node data of - // the tree top. - LocRankable* peek(); - - // pop keeps the tree sorted by rank, but it does not try to balance - // the tree. - // Return - pointer to the node popped out, or NULL if heap is already empty - LocRankable* pop(); - - // navigating through the tree and find the node that ranks the same - // as the input data, then remove it from the tree. Rank is implemented - // by rankable obj. - // returns the pointer to the node removed; or NULL (if failed). - LocRankable* remove(LocRankable& rankable); - -#ifdef __LOC_UNIT_TEST__ - bool checkTree(); - uint32_t getTreeSize(); -#endif -}; - -#endif //__LOC_HEAP__ diff --git a/utils/LocSharedLock.h b/utils/LocSharedLock.h deleted file mode 100644 index 7fe62376..00000000 --- a/utils/LocSharedLock.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef __LOC_SHARED_LOCK__ -#define __LOC_SHARED_LOCK__ - -#include -#include -#include - -// This is a utility created for use cases such that there are more than -// one client who need to share the same lock, but it is not predictable -// which of these clients is to last to go away. This shared lock deletes -// itself when the last client calls its drop() method. To add a cient, -// this share lock's share() method has to be called, so that the obj -// can maintain an accurate client count. -class LocSharedLock { - volatile int32_t mRef; - pthread_mutex_t mMutex; - inline ~LocSharedLock() { pthread_mutex_destroy(&mMutex); } -public: - // first client to create this LockSharedLock - inline LocSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); } - // following client(s) are to *share()* this lock created by the first client - inline LocSharedLock* share() { android_atomic_inc(&mRef); return this; } - // whe a client no longer needs this shared lock, drop() shall be called. - inline void drop() { if (1 == android_atomic_dec(&mRef)) delete this; } - // locking the lock to enter critical section - inline void lock() { pthread_mutex_lock(&mMutex); } - // unlocking the lock to leave the critical section - inline void unlock() { pthread_mutex_unlock(&mMutex); } -}; - -#endif //__LOC_SHARED_LOCK__ diff --git a/utils/LocThread.cpp b/utils/LocThread.cpp deleted file mode 100644 index 19bf101a..00000000 --- a/utils/LocThread.cpp +++ /dev/null @@ -1,264 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#include -#include -#include - -class LocThreadDelegate { - LocRunnable* mRunnable; - bool mJoinable; - pthread_t mThandle; - pthread_mutex_t mMutex; - int mRefCount; - ~LocThreadDelegate(); - LocThreadDelegate(LocThread::tCreate creator, const char* threadName, - LocRunnable* runnable, bool joinable); - void destroy(); -public: - static LocThreadDelegate* create(LocThread::tCreate creator, - const char* threadName, LocRunnable* runnable, bool joinable); - void stop(); - // bye() is for the parent thread to go away. if joinable, - // parent must stop the spawned thread, join, and then - // destroy(); if detached, the parent can go straight - // ahead to destroy() - inline void bye() { mJoinable ? stop() : destroy(); } - inline bool isRunning() { return (NULL != mRunnable); } - static void* threadMain(void* arg); -}; - -// it is important to note that internal members must be -// initialized to values as if pthread_create succeeds. -// This is to avoid the race condition between the threads, -// once the thread is created, some of these values will -// be check in the spawned thread, and must set correctly -// then and there. -// However, upon pthread_create failure, the data members -// must be set to indicate failure, e.g. mRunnable, and -// threashold approprietly for destroy(), e.g. mRefCount. -LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator, - const char* threadName, LocRunnable* runnable, bool joinable) : - mRunnable(runnable), mJoinable(joinable), mThandle(NULL), - mMutex(PTHREAD_MUTEX_INITIALIZER), mRefCount(2) { - - // set up thread name, if nothing is passed in - if (!threadName) { - threadName = "LocThread"; - } - - // create the thread here, then if successful - // and a name is given, we set the thread name - if (creator) { - mThandle = creator(threadName, threadMain, this); - } else if (pthread_create(&mThandle, NULL, threadMain, this)) { - // pthread_create() failed - mThandle = NULL; - } - - if (mThandle) { - // set thread name - char lname[16]; - int len = sizeof(lname) - 1; - memcpy(lname, threadName, len); - lname[len] = 0; - // set the thread name here - pthread_setname_np(mThandle, lname); - - // detach, if not joinable - if (!joinable) { - pthread_detach(mThandle); - } - } else { - // must set these values upon failure - mRunnable = NULL; - mJoinable = false; - mRefCount = 1; - } -} - -inline -LocThreadDelegate::~LocThreadDelegate() { - // at this point nothing should need done any more -} - -// factory method so that we could return NULL upon failure -LocThreadDelegate* LocThreadDelegate::create(LocThread::tCreate creator, - const char* threadName, LocRunnable* runnable, bool joinable) { - LocThreadDelegate* thread = NULL; - if (runnable) { - thread = new LocThreadDelegate(creator, threadName, runnable, joinable); - if (thread && !thread->isRunning()) { - thread->destroy(); - thread = NULL; - } - } - - return thread; -} - -// The order is importang -// NULLing mRunnalbe stops the while loop in threadMain() -// join() if mJoinble must come before destroy() call, as -// the obj must remain alive at this time so that mThandle -// remains valud. -void LocThreadDelegate::stop() { - // mRunnable and mJoinable are reset on different triggers. - // mRunnable may get nulled on the spawned thread's way out; - // or here. - // mJouinable (if ever been true) gets falsed when client - // thread triggers stop, with either a stop() - // call or the client releases thread obj handle. - if (mRunnable) { - mRunnable = NULL; - } - if (mJoinable) { - mJoinable = false; - pthread_join(mThandle, NULL); - } - // call destroy() to possibly delete the obj - destroy(); -} - -// method for clients to call to release the obj -// when it is a detached thread, the client thread -// and the spawned thread can both try to destroy() -// asynchronously. And we delete this obj when -// mRefCount becomes 0. -void LocThreadDelegate::destroy() { - // else case shouldn't happen, unless there is a - // leaking obj. But only our code here has such - // obj, so if we test our code well, else case - // will never happen - if (mRefCount > 0) { - // we need a flag on the stack - bool callDelete = false; - - // critical section between threads - pthread_mutex_lock(&mMutex); - // last destroy() call - callDelete = (1 == mRefCount--); - pthread_mutex_unlock(&mMutex); - - // upon last destroy() call we delete this obj - if (callDelete) { - delete this; - } - } -} - -void* LocThreadDelegate::threadMain(void* arg) { - LocThreadDelegate* locThread = (LocThreadDelegate*)(arg); - - if (locThread) { - LocRunnable* runnable = locThread->mRunnable; - - if (runnable) { - if (locThread->isRunning()) { - runnable->prerun(); - } - - while (locThread->isRunning() && runnable->run()); - - if (locThread->isRunning()) { - runnable->postrun(); - } - - // at this time, locThread->mRunnable may or may not be NULL - // NULL it just to be safe and clean, as we want the field - // in the released memory slot to be NULL. - locThread->mRunnable = NULL; - delete runnable; - } - locThread->destroy(); - } - - return NULL; -} - -LocThread::~LocThread() { - if (mThread) { - mThread->bye(); - mThread = NULL; - } -} - -bool LocThread::start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable) { - bool success = false; - if (!mThread) { - mThread = LocThreadDelegate::create(creator, threadName, runnable, joinable); - // true only if thread is created successfully - success = (NULL != mThread); - } - return success; -} - -void LocThread::stop() { - if (mThread) { - mThread->stop(); - mThread = NULL; - } -} - -#ifdef __LOC_DEBUG__ - -#include -#include -#include - -class LocRunnableTest1 : public LocRunnable { - int mID; -public: - LocRunnableTest1(int id) : LocRunnable(), mID(id) {} - virtual bool run() { - printf("LocRunnableTest1: %d\n", mID++); - sleep(1); - return true; - } -}; - -// on linux command line: -// compile: g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -std=c++0x -I. -I../../../../vendor/qcom/proprietary/gps-internal/unit-tests/fakes_for_host -I../../../../system/core/include -lpthread LocThread.cpp -// test detached thread: valgrind ./a.out 0 -// test joinable thread: valgrind ./a.out 1 -int main(int argc, char** argv) { - LocRunnableTest1 test(10); - - LocThread thread; - thread.start("LocThreadTest", test, atoi(argv[1])); - - sleep(10); - - thread.stop(); - - sleep(5); - - return 0; -} - -#endif diff --git a/utils/LocThread.h b/utils/LocThread.h deleted file mode 100644 index 2a65d8fa..00000000 --- a/utils/LocThread.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#ifndef __LOC_THREAD__ -#define __LOC_THREAD__ - -#include -#include - -// abstract class to be implemented by client to provide a runnable class -// which gets scheduled by LocThread -class LocRunnable { -public: - inline LocRunnable() {} - inline virtual ~LocRunnable() {} - - // The method to be implemented by thread clients - // and be scheduled by LocThread - // This method will be repeated called until it returns false; or - // until thread is stopped. - virtual bool run() = 0; - - // The method to be run before thread loop (conditionally repeatedly) - // calls run() - inline virtual void prerun() {} - - // The method to be run after thread loop (conditionally repeatedly) - // calls run() - inline virtual void postrun() {} -}; - -// opaque class to provide service implementation. -class LocThreadDelegate; - -// A utility class to create a thread and run LocRunnable -// caller passes in. -class LocThread { - LocThreadDelegate* mThread; -public: - inline LocThread() : mThread(NULL) {} - virtual ~LocThread(); - - typedef pthread_t (*tCreate)(const char* name, void* (*start)(void*), void* arg); - // client starts thread with a runnable, which implements - // the logics to fun in the created thread context. - // The thread could be either joinable or detached. - // runnable is an obj managed by client. Client creates and - // frees it (but must be after stop() is called, or - // this LocThread obj is deleted). - // The obj will be deleted by LocThread if start() - // returns true. Else it is client's responsibility - // to delete the object - // Returns 0 if success; false if failure. - bool start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable = true); - inline bool start(const char* threadName, LocRunnable* runnable, bool joinable = true) { - return start(NULL, threadName, runnable, joinable); - } - - // NOTE: if this is a joinable thread, this stop may block - // for a while until the thread is joined. - void stop(); - - // thread status check - inline bool isRunning() { return NULL != mThread; } -}; - -#endif //__LOC_THREAD__ diff --git a/utils/LocTimer.cpp b/utils/LocTimer.cpp deleted file mode 100644 index 70904b2a..00000000 --- a/utils/LocTimer.cpp +++ /dev/null @@ -1,737 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __HOST_UNIT_TEST__ -#define EPOLLWAKEUP 0 -#define CLOCK_BOOTTIME CLOCK_MONOTONIC -#define CLOCK_BOOTTIME_ALARM CLOCK_MONOTONIC -#endif - -/* -There are implementations of 5 classes in this file: -LocTimer, LocTimerDelegate, LocTimerContainer, LocTimerPollTask, LocTimerWrapper - -LocTimer - client front end, interface for client to start / stop timers, also - to provide a callback. -LocTimerDelegate - an internal timer entity, which also is a LocRankable obj. - Its life cycle is different than that of LocTimer. It gets - created when LocTimer::start() is called, and gets deleted - when it expires or clients calls the hosting LocTimer obj's - stop() method. When a LocTimerDelegate obj is ticking, it - stays in the corresponding LocTimerContainer. When expired - or stopped, the obj is removed from the container. Since it - is also a LocRankable obj, and LocTimerContainer also is a - heap, its ranks() implementation decides where it is placed - in the heap. -LocTimerContainer - core of the timer service. It is a container (derived from - LocHeap) for LocTimerDelegate (implements LocRankable) objs. - There are 2 of such containers, one for sw timers (or Linux - timers) one for hw timers (or Linux alarms). It adds one of - each (those that expire the soonest) to kernel via services - provided by LocTimerPollTask. All the heap management on the - LocTimerDelegate objs are done in the MsgTask context, such - that synchronization is ensured. -LocTimerPollTask - is a class that wraps timerfd and epoll POXIS APIs. It also - both implements LocRunnalbe with epoll_wait() in the run() - method. It is also a LocThread client, so as to loop the run - method. -LocTimerWrapper - a LocTimer client itself, to implement the existing C API with - APIs, loc_timer_start() and loc_timer_stop(). - -*/ - -class LocTimerPollTask; - -// This is a multi-functaional class that: -// * extends the LocHeap class for the detection of head update upon add / remove -// events. When that happens, soonest time out changes, so timerfd needs update. -// * contains the timers, and add / remove them into the heap -// * provides and maps 2 of such containers, one for timers (or mSwTimers), one -// for alarms (or mHwTimers); -// * provides a polling thread; -// * provides a MsgTask thread for synchronized add / remove / timer client callback. -class LocTimerContainer : public LocHeap { - // mutex to synchronize getters of static members - static pthread_mutex_t mMutex; - // Container of timers - static LocTimerContainer* mSwTimers; - // Container of alarms - static LocTimerContainer* mHwTimers; - // Msg task to provider msg Q, sender and reader. - static MsgTask* mMsgTask; - // Poll task to provide epoll call and threading to poll. - static LocTimerPollTask* mPollTask; - // timer / alarm fd - int mDevFd; - // ctor - LocTimerContainer(bool wakeOnExpire); - // dtor - ~LocTimerContainer(); - static MsgTask* getMsgTaskLocked(); - static LocTimerPollTask* getPollTaskLocked(); - // extend LocHeap and pop if the top outRanks input - LocTimerDelegate* popIfOutRanks(LocTimerDelegate& timer); - // update the timer POSIX calls with updated soonest timer spec - void updateSoonestTime(LocTimerDelegate* priorTop); - -public: - // factory method to control the creation of mSwTimers / mHwTimers - static LocTimerContainer* get(bool wakeOnExpire); - - LocTimerDelegate* getSoonestTimer(); - int getTimerFd(); - // add a timer / alarm obj into the container - void add(LocTimerDelegate& timer); - // remove a timer / alarm obj from the container - void remove(LocTimerDelegate& timer); - // handling of timer / alarm expiration - void expire(); -}; - -// This class implements the polling thread that epolls imer / alarm fds. -// The LocRunnable::run() contains the actual polling. The other methods -// will be run in the caller's thread context to add / remove timer / alarm -// fds the kernel, while the polling is blocked on epoll_wait() call. -// Since the design is that we have maximally 2 polls, one for all the -// timers; one for all the alarms, we will poll at most on 2 fds. But it -// is possile that all we have are only timers or alarms at one time, so we -// allow dynamically add / remove fds we poll on. The design decision of -// having 1 fd per container of timer / alarm is such that, we may not need -// to make a system call each time a timer / alarm is added / removed, unless -// that changes the "soonest" time out of that of all the timers / alarms. -class LocTimerPollTask : public LocRunnable { - // the epoll fd - const int mFd; - // the thread that calls run() method - LocThread* mThread; - friend class LocThreadDelegate; - // dtor - ~LocTimerPollTask(); -public: - // ctor - LocTimerPollTask(); - // this obj will be deleted once thread is deleted - void destroy(); - // add a container of timers. Each contain has a unique device fd, i.e. - // either timer or alarm fd, and a heap of timers / alarms. It is expected - // that container would have written to the device fd with the soonest - // time out value in the heap at the time of calling this method. So all - // this method does is to add the fd of the input container to the poll - // and also add the pointer of the container to the event data ptr, such - // when poll_wait wakes up on events, we know who is the owner of the fd. - void addPoll(LocTimerContainer& timerContainer); - // remove a fd that is assciated with a container. The expectation is that - // the atual timer would have been removed from the container. - void removePoll(LocTimerContainer& timerContainer); - // The polling thread context will call this method. This is where - // epoll_wait() is blocking and waiting for events.. - virtual bool run(); -}; - -// Internal class of timer obj. It gets born when client calls LocTimer::start(); -// and gets deleted when client calls LocTimer::stop() or when the it expire()'s. -// This class implements LocRankable::ranks() so that when an obj is added into -// the container (of LocHeap), it gets placed in sorted order. -class LocTimerDelegate : public LocRankable { - friend class LocTimerContainer; - friend class LocTimer; - LocTimer* mClient; - LocSharedLock* mLock; - struct timespec mFutureTime; - LocTimerContainer* mContainer; - // not a complete obj, just ctor for LocRankable comparisons - inline LocTimerDelegate(struct timespec& delay) - : mClient(NULL), mLock(NULL), mFutureTime(delay), mContainer(NULL) {} - inline ~LocTimerDelegate() { if (mLock) { mLock->drop(); mLock = NULL; } } -public: - LocTimerDelegate(LocTimer& client, struct timespec& futureTime, bool wakeOnExpire); - void destroyLocked(); - // LocRankable virtual method - virtual int ranks(LocRankable& rankable); - void expire(); - inline struct timespec getFutureTime() { return mFutureTime; } -}; - -/***************************LocTimerContainer methods***************************/ - -// Most of these static recources are created on demand. They however are never -// destoyed. The theory is that there are processes that link to this util lib -// but never use timer, then these resources would never need to be created. -// For those processes that do use timer, it will likely also need to every -// once in a while. It might be cheaper keeping them around. -pthread_mutex_t LocTimerContainer::mMutex = PTHREAD_MUTEX_INITIALIZER; -LocTimerContainer* LocTimerContainer::mSwTimers = NULL; -LocTimerContainer* LocTimerContainer::mHwTimers = NULL; -MsgTask* LocTimerContainer::mMsgTask = NULL; -LocTimerPollTask* LocTimerContainer::mPollTask = NULL; - -// ctor - initialize timer heaps -// A container for swTimer (timer) is created, when wakeOnExpire is true; or -// HwTimer (alarm), when wakeOnExpire is false. -LocTimerContainer::LocTimerContainer(bool wakeOnExpire) : - mDevFd(timerfd_create(wakeOnExpire ? CLOCK_BOOTTIME_ALARM : CLOCK_BOOTTIME, 0)) { - - if ((-1 == mDevFd) && (errno == EINVAL)) { - LOC_LOGW("%s: timerfd_create failure, fallback to CLOCK_MONOTONIC - %s", - __FUNCTION__, strerror(errno)); - mDevFd = timerfd_create(CLOCK_MONOTONIC, 0); - } - - if (-1 != mDevFd) { - // ensure we have the necessary resources created - LocTimerContainer::getPollTaskLocked(); - LocTimerContainer::getMsgTaskLocked(); - } else { - LOC_LOGE("%s: timerfd_create failure - %s", __FUNCTION__, strerror(errno)); - } -} - -// dtor -// we do not ever destroy the static resources. -inline -LocTimerContainer::~LocTimerContainer() { - close(mDevFd); -} - -LocTimerContainer* LocTimerContainer::get(bool wakeOnExpire) { - // get the reference of either mHwTimer or mSwTimers per wakeOnExpire - LocTimerContainer*& container = wakeOnExpire ? mHwTimers : mSwTimers; - // it is cheap to check pointer first than locking mutext unconditionally - if (!container) { - pthread_mutex_lock(&mMutex); - // let's check one more time to be safe - if (!container) { - container = new LocTimerContainer(wakeOnExpire); - // timerfd_create failure - if (-1 == container->getTimerFd()) { - delete container; - container = NULL; - } - } - pthread_mutex_unlock(&mMutex); - } - return container; -} - -MsgTask* LocTimerContainer::getMsgTaskLocked() { - // it is cheap to check pointer first than locking mutext unconditionally - if (!mMsgTask) { - mMsgTask = new MsgTask("LocTimerMsgTask", false); - } - return mMsgTask; -} - -LocTimerPollTask* LocTimerContainer::getPollTaskLocked() { - // it is cheap to check pointer first than locking mutext unconditionally - if (!mPollTask) { - mPollTask = new LocTimerPollTask(); - } - return mPollTask; -} - -inline -LocTimerDelegate* LocTimerContainer::getSoonestTimer() { - return (LocTimerDelegate*)(peek()); -} - -inline -int LocTimerContainer::getTimerFd() { - return mDevFd; -} - -void LocTimerContainer::updateSoonestTime(LocTimerDelegate* priorTop) { - LocTimerDelegate* curTop = getSoonestTimer(); - - // check if top has changed - if (curTop != priorTop) { - struct itimerspec delay = {0}; - bool toSetTime = false; - // if tree is empty now, we remove poll and disarm timer - if (!curTop) { - mPollTask->removePoll(*this); - // setting the values to disarm timer - delay.it_value.tv_sec = 0; - delay.it_value.tv_nsec = 0; - toSetTime = true; - } else if (!priorTop || curTop->outRanks(*priorTop)) { - // do this first to avoid race condition, in case settime is called - // with too small an interval - mPollTask->addPoll(*this); - delay.it_value = curTop->getFutureTime(); - toSetTime = true; - } - if (toSetTime) { - timerfd_settime(getTimerFd(), TFD_TIMER_ABSTIME, &delay, NULL); - } - } -} - -// all the heap management is done in the MsgTask context. -inline -void LocTimerContainer::add(LocTimerDelegate& timer) { - struct MsgTimerPush : public LocMsg { - LocTimerContainer* mTimerContainer; - LocHeapNode* mTree; - LocTimerDelegate* mTimer; - inline MsgTimerPush(LocTimerContainer& container, LocTimerDelegate& timer) : - LocMsg(), mTimerContainer(&container), mTimer(&timer) {} - inline virtual void proc() const { - LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer(); - mTimerContainer->push((LocRankable&)(*mTimer)); - mTimerContainer->updateSoonestTime(priorTop); - } - }; - - mMsgTask->sendMsg(new MsgTimerPush(*this, timer)); -} - -// all the heap management is done in the MsgTask context. -void LocTimerContainer::remove(LocTimerDelegate& timer) { - struct MsgTimerRemove : public LocMsg { - LocTimerContainer* mTimerContainer; - LocTimerDelegate* mTimer; - inline MsgTimerRemove(LocTimerContainer& container, LocTimerDelegate& timer) : - LocMsg(), mTimerContainer(&container), mTimer(&timer) {} - inline virtual void proc() const { - LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer(); - - // update soonest timer only if mTimer is actually removed from - // mTimerContainer AND mTimer is not priorTop. - if (priorTop == ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) { - // if passing in NULL, we tell updateSoonestTime to update - // kernel with the current top timer interval. - mTimerContainer->updateSoonestTime(NULL); - } - // all timers are deleted here, and only here. - delete mTimer; - } - }; - - mMsgTask->sendMsg(new MsgTimerRemove(*this, timer)); -} - -// all the heap management is done in the MsgTask context. -// Upon expire, we check and continuously pop the heap until -// the top node's timeout is in the future. -void LocTimerContainer::expire() { - struct MsgTimerExpire : public LocMsg { - LocTimerContainer* mTimerContainer; - inline MsgTimerExpire(LocTimerContainer& container) : - LocMsg(), mTimerContainer(&container) {} - inline virtual void proc() const { - struct timespec now; - // get time spec of now - clock_gettime(CLOCK_BOOTTIME, &now); - LocTimerDelegate timerOfNow(now); - // pop everything in the heap that outRanks now, i.e. has time older than now - // and then call expire() on that timer. - for (LocTimerDelegate* timer = (LocTimerDelegate*)mTimerContainer->pop(); - NULL != timer; - timer = mTimerContainer->popIfOutRanks(timerOfNow)) { - // the timer delegate obj will be deleted before the return of this call - timer->expire(); - } - mTimerContainer->updateSoonestTime(NULL); - } - }; - - struct itimerspec delay = {0}; - timerfd_settime(getTimerFd(), TFD_TIMER_ABSTIME, &delay, NULL); - mPollTask->removePoll(*this); - mMsgTask->sendMsg(new MsgTimerExpire(*this)); -} - -LocTimerDelegate* LocTimerContainer::popIfOutRanks(LocTimerDelegate& timer) { - LocTimerDelegate* poppedNode = NULL; - if (mTree && !timer.outRanks(*peek())) { - poppedNode = (LocTimerDelegate*)(pop()); - } - - return poppedNode; -} - - -/***************************LocTimerPollTask methods***************************/ - -inline -LocTimerPollTask::LocTimerPollTask() - : mFd(epoll_create(2)), mThread(new LocThread()) { - // before a next call returens, a thread will be created. The run() method - // could already be running in parallel. Also, since each of the objs - // creates a thread, the container will make sure that there will be only - // one of such obj for our timer implementation. - if (!mThread->start("LocTimerPollTask", this)) { - delete mThread; - mThread = NULL; - } -} - -inline -LocTimerPollTask::~LocTimerPollTask() { - // when fs is closed, epoll_wait() should fail run() should return false - // and the spawned thread should exit. - close(mFd); -} - -void LocTimerPollTask::destroy() { - if (mThread) { - LocThread* thread = mThread; - mThread = NULL; - delete thread; - } else { - delete this; - } -} - -void LocTimerPollTask::addPoll(LocTimerContainer& timerContainer) { - struct epoll_event ev; - memset(&ev, 0, sizeof(ev)); - - ev.events = EPOLLIN | EPOLLWAKEUP; - ev.data.fd = timerContainer.getTimerFd(); - // it is important that we set this context pointer with the input - // timer container this is how we know which container should handle - // which expiration. - ev.data.ptr = &timerContainer; - - epoll_ctl(mFd, EPOLL_CTL_ADD, timerContainer.getTimerFd(), &ev); -} - -inline -void LocTimerPollTask::removePoll(LocTimerContainer& timerContainer) { - epoll_ctl(mFd, EPOLL_CTL_DEL, timerContainer.getTimerFd(), NULL); -} - -// The polling thread context will call this method. If run() method needs to -// be repetitvely called, it must return true from the previous call. -bool LocTimerPollTask::run() { - struct epoll_event ev[2]; - - // we have max 2 descriptors to poll from - int fds = epoll_wait(mFd, ev, 2, -1); - - // we pretty much want to continually poll until the fd is closed - bool rerun = (fds > 0) || (errno == EINTR); - - if (fds > 0) { - // we may have 2 events - for (int i = 0; i < fds; i++) { - // each fd has a context pointer associated with the right timer container - LocTimerContainer* container = (LocTimerContainer*)(ev[i].data.ptr); - if (container) { - container->expire(); - } else { - epoll_ctl(mFd, EPOLL_CTL_DEL, ev[i].data.fd, NULL); - } - } - } - - // if rerun is true, we are requesting to be scheduled again - return rerun; -} - -/***************************LocTimerDelegate methods***************************/ - -inline -LocTimerDelegate::LocTimerDelegate(LocTimer& client, struct timespec& futureTime, bool wakeOnExpire) - : mClient(&client), - mLock(mClient->mLock->share()), - mFutureTime(futureTime), - mContainer(LocTimerContainer::get(wakeOnExpire)) { - // adding the timer into the container - mContainer->add(*this); -} - -inline -void LocTimerDelegate::destroyLocked() { - // client handle will likely be deleted soon after this - // method returns. Nulling this handle so that expire() - // won't call the callback on the dead handle any more. - mClient = NULL; - - if (mContainer) { - LocTimerContainer* container = mContainer; - mContainer = NULL; - if (container) { - container->remove(*this); - } - } // else we do not do anything. No such *this* can be - // created and reached here with mContainer ever been - // a non NULL. So *this* must have reached the if clause - // once, and we want it reach there only once. -} - -int LocTimerDelegate::ranks(LocRankable& rankable) { - int rank = -1; - LocTimerDelegate* timer = (LocTimerDelegate*)(&rankable); - if (timer) { - // larger time ranks lower!!! - // IOW, if input obj has bigger tv_sec, this obj outRanks higher - rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec; - } - return rank; -} - -inline -void LocTimerDelegate::expire() { - // keeping a copy of client pointer to be safe - // when timeOutCallback() is called at the end of this - // method, *this* obj may be already deleted. - LocTimer* client = mClient; - // force a stop, which will lead to delete of this obj - if (client && client->stop()) { - // calling client callback with a pointer save on the stack - // only if stop() returns true, i.e. it hasn't been stopped - // already. - client->timeOutCallback(); - } -} - - -/***************************LocTimer methods***************************/ -LocTimer::LocTimer() : mTimer(NULL), mLock(new LocSharedLock()) { -} - -LocTimer::~LocTimer() { - stop(); - if (mLock) { - mLock->drop(); - mLock = NULL; - } -} - -bool LocTimer::start(unsigned int timeOutInMs, bool wakeOnExpire) { - bool success = false; - mLock->lock(); - if (!mTimer) { - struct timespec futureTime; - clock_gettime(CLOCK_BOOTTIME, &futureTime); - futureTime.tv_sec += timeOutInMs / 1000; - futureTime.tv_nsec += (timeOutInMs % 1000) * 1000000; - if (futureTime.tv_nsec >= 1000000000) { - futureTime.tv_sec += futureTime.tv_nsec / 1000000000; - futureTime.tv_nsec %= 1000000000; - } - mTimer = new LocTimerDelegate(*this, futureTime, wakeOnExpire); - // if mTimer is non 0, success should be 0; or vice versa - success = (NULL != mTimer); - } - mLock->unlock(); - return success; -} - -bool LocTimer::stop() { - bool success = false; - mLock->lock(); - if (mTimer) { - LocTimerDelegate* timer = mTimer; - mTimer = NULL; - if (timer) { - timer->destroyLocked(); - success = true; - } - } - mLock->unlock(); - return success; -} - -/***************************LocTimerWrapper methods***************************/ -////////////////////////////////////////////////////////////////////////// -// This section below wraps for the C style APIs -////////////////////////////////////////////////////////////////////////// -class LocTimerWrapper : public LocTimer { - loc_timer_callback mCb; - void* mCallerData; - LocTimerWrapper* mMe; - static pthread_mutex_t mMutex; - inline ~LocTimerWrapper() { mCb = NULL; mMe = NULL; } -public: - inline LocTimerWrapper(loc_timer_callback cb, void* callerData) : - mCb(cb), mCallerData(callerData), mMe(this) { - } - void destroy() { - pthread_mutex_lock(&mMutex); - if (NULL != mCb && this == mMe) { - delete this; - } - pthread_mutex_unlock(&mMutex); - } - virtual void timeOutCallback() { - loc_timer_callback cb = mCb; - void* callerData = mCallerData; - if (cb) { - cb(callerData, 0); - } - destroy(); - } -}; - -pthread_mutex_t LocTimerWrapper::mMutex = PTHREAD_MUTEX_INITIALIZER; - -void* loc_timer_start(uint64_t msec, loc_timer_callback cb_func, - void *caller_data, bool wake_on_expire) -{ - LocTimerWrapper* locTimerWrapper = NULL; - - if (cb_func) { - locTimerWrapper = new LocTimerWrapper(cb_func, caller_data); - - if (locTimerWrapper) { - locTimerWrapper->start(msec, wake_on_expire); - } - } - - return locTimerWrapper; -} - -void loc_timer_stop(void*& handle) -{ - if (handle) { - LocTimerWrapper* locTimerWrapper = (LocTimerWrapper*)(handle); - locTimerWrapper->destroy(); - handle = NULL; - } -} - -////////////////////////////////////////////////////////////////////////// -// This section above wraps for the C style APIs -////////////////////////////////////////////////////////////////////////// - -#ifdef __LOC_DEBUG__ - -double getDeltaSeconds(struct timespec from, struct timespec to) { - return (double)to.tv_sec + (double)to.tv_nsec / 1000000000 - - from.tv_sec - (double)from.tv_nsec / 1000000000; -} - -struct timespec getNow() { - struct timespec now; - clock_gettime(CLOCK_BOOTTIME, &now); - return now; -} - -class LocTimerTest : public LocTimer, public LocRankable { - int mTimeOut; - const struct timespec mTimeOfBirth; - inline struct timespec getTimerWrapper(int timeout) { - struct timespec now; - clock_gettime(CLOCK_BOOTTIME, &now); - now.tv_sec += timeout; - return now; - } -public: - inline LocTimerTest(int timeout) : LocTimer(), LocRankable(), - mTimeOut(timeout), mTimeOfBirth(getTimerWrapper(0)) {} - inline virtual int ranks(LocRankable& rankable) { - LocTimerTest* timer = dynamic_cast(&rankable); - return timer->mTimeOut - mTimeOut; - } - inline virtual void timeOutCallback() { - printf("timeOutCallback() - "); - deviation(); - } - double deviation() { - struct timespec now = getTimerWrapper(0); - double delta = getDeltaSeconds(mTimeOfBirth, now); - printf("%lf: %lf\n", delta, delta * 100 / mTimeOut); - return delta / mTimeOut; - } -}; - -// For Linux command line testing: -// compilation: -// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../system/core/include -o LocHeap.o LocHeap.cpp -// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -std=c++0x -I. -I../../../../system/core/include -lpthread -o LocThread.o LocThread.cpp -// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../system/core/include -o LocTimer.o LocTimer.cpp -int main(int argc, char** argv) { - struct timespec timeOfStart=getNow(); - srand(time(NULL)); - int tries = atoi(argv[1]); - int checks = tries >> 3; - LocTimerTest** timerArray = new LocTimerTest*[tries]; - memset(timerArray, NULL, tries); - - for (int i = 0; i < tries; i++) { - int r = rand() % tries; - LocTimerTest* timer = new LocTimerTest(r); - if (timerArray[r]) { - if (!timer->stop()) { - printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow())); - printf("ERRER: %dth timer, id %d, not running when it should be\n", i, r); - exit(0); - } else { - printf("stop() - %d\n", r); - delete timer; - timerArray[r] = NULL; - } - } else { - if (!timer->start(r, false)) { - printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow())); - printf("ERRER: %dth timer, id %d, running when it should not be\n", i, r); - exit(0); - } else { - printf("stop() - %d\n", r); - timerArray[r] = timer; - } - } - } - - for (int i = 0; i < tries; i++) { - if (timerArray[i]) { - if (!timerArray[i]->stop()) { - printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow())); - printf("ERRER: %dth timer, not running when it should be\n", i); - exit(0); - } else { - printf("stop() - %d\n", i); - delete timerArray[i]; - timerArray[i] = NULL; - } - } - } - - delete[] timerArray; - - return 0; -} - -#endif diff --git a/utils/LocTimer.h b/utils/LocTimer.h deleted file mode 100644 index c1468524..00000000 --- a/utils/LocTimer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef __LOC_TIMER_CPP_H__ -#define __LOC_TIMER_CPP_H__ - -#include -#include - -// opaque class to provide service implementation. -class LocTimerDelegate; -class LocSharedLock; - -// LocTimer client must extend this class and implementthe callback. -// start() / stop() methods are to arm / disarm timer. -class LocTimer -{ - LocTimerDelegate* mTimer; - LocSharedLock* mLock; - // don't really want mLock to be manipulated by clients, yet LocTimer - // has to have a reference to the lock so that the delete of LocTimer - // and LocTimerDelegate can work together on their share resources. - friend class LocTimerDelegate; - -public: - LocTimer(); - virtual ~LocTimer(); - - // timeOutInMs: timeout delay in ms - // wakeOnExpire: true if to wake up CPU (if sleeping) upon timer - // expiration and notify the client. - // false if to wait until next time CPU wakes up (if - // sleeping) and then notify the client. - // return: true on success; - // false on failure, e.g. timer is already running. - bool start(uint32_t timeOutInMs, bool wakeOnExpire); - - // return: true on success; - // false on failure, e.g. timer is not running. - bool stop(); - - // LocTimer client Should implement this method. - // This method is used for timeout calling back to client. This method - // should be short enough (eg: send a message to your own thread). - virtual void timeOutCallback() = 0; -}; - -#endif //__LOC_DELAY_H__ diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp deleted file mode 100644 index f33d6024..00000000 --- a/utils/MsgTask.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 2011-2013,2015 The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#define LOG_NDDEBUG 0 -#define LOG_TAG "LocSvc_MsgTask" - -#include -#include -#include -#include - -static void LocMsgDestroy(void* msg) { - delete (LocMsg*)msg; -} - -MsgTask::MsgTask(LocThread::tCreate tCreator, - const char* threadName, bool joinable) : - mQ(msg_q_init2()), mThread(new LocThread()) { - if (!mThread->start(tCreator, threadName, this, joinable)) { - delete mThread; - mThread = NULL; - } -} - -MsgTask::MsgTask(const char* threadName, bool joinable) : - mQ(msg_q_init2()), mThread(new LocThread()) { - if (!mThread->start(threadName, this, joinable)) { - delete mThread; - mThread = NULL; - } -} - -MsgTask::~MsgTask() { - msg_q_flush((void*)mQ); - msg_q_destroy((void**)&mQ); -} - -void MsgTask::destroy() { - msg_q_unblock((void*)mQ); - if (mThread) { - LocThread* thread = mThread; - mThread = NULL; - delete thread; - } else { - delete this; - } -} - -void MsgTask::sendMsg(const LocMsg* msg) const { - msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy); -} - -void MsgTask::prerun() { - // make sure we do not run in background scheduling group - set_sched_policy(gettid(), SP_FOREGROUND); -} - -bool MsgTask::run() { - LOC_LOGV("MsgTask::loop() listening ...\n"); - LocMsg* msg; - msq_q_err_type result = msg_q_rcv((void*)mQ, (void **)&msg); - if (eMSG_Q_SUCCESS != result) { - LOC_LOGE("%s:%d] fail receiving msg: %s\n", __func__, __LINE__, - loc_get_msg_q_status(result)); - return false; - } - - msg->log(); - // there is where each individual msg handling is invoked - msg->proc(); - - delete msg; - - return true; -} diff --git a/utils/linked_list.c b/utils/linked_list.c index acec5b1f..1109acd3 100644 --- a/utils/linked_list.c +++ b/utils/linked_list.c @@ -108,7 +108,7 @@ linked_list_err_type linked_list_destroy(void** list_data) ===========================================================================*/ linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dealloc)(void*)) { - LOC_LOGV("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, data_obj); + LOC_LOGD("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, data_obj); if( list_data == NULL ) { LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__); @@ -160,7 +160,7 @@ linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dea ===========================================================================*/ linked_list_err_type linked_list_remove(void* list_data, void **data_obj) { - LOC_LOGV("%s: Removing from list\n", __FUNCTION__); + LOC_LOGD("%s: Removing from list\n", __FUNCTION__); if( list_data == NULL ) { LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__); @@ -267,7 +267,7 @@ linked_list_err_type linked_list_search(void* list_data, void **data_p, bool (*equal)(void* data_0, void* data), void* data_0, bool rm_if_found) { - LOC_LOGV("%s: Search the list\n", __FUNCTION__); + LOC_LOGD("%s: Search the list\n", __FUNCTION__); if( list_data == NULL || NULL == equal ) { LOC_LOGE("%s: Invalid list parameter! list_data %p equal %p\n", diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 967d2f30..8c76d1fe 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,9 +38,8 @@ #include #include #include -#include -#include -#ifdef USE_GLIB +#include +#if defined(USE_GLIB) && !defined(OFF_TARGET) #include #endif #include "platform_lib_includes.h" @@ -52,23 +51,68 @@ *============================================================================*/ /* Parameter data */ -static uint32_t DEBUG_LEVEL = 0xff; -static uint32_t TIMESTAMP = 0; +static uint8_t DEBUG_LEVEL = 0xff; +static uint8_t TIMESTAMP = 0; /* Parameter spec table */ -static const loc_param_s_type loc_param_table[] = +static loc_param_s_type loc_parameter_table[] = { - {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, - {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, + {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, + {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, }; -static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type); +int loc_param_num = sizeof(loc_parameter_table) / sizeof(loc_param_s_type); + +/*=========================================================================== +FUNCTION trim_space + +DESCRIPTION + Removes leading and trailing spaces of the string + +DEPENDENCIES + N/A + +RETURN VALUE + None + +SIDE EFFECTS + N/A +===========================================================================*/ +void trim_space(char *org_string) +{ + char *scan_ptr, *write_ptr; + char *first_nonspace = NULL, *last_nonspace = NULL; + + scan_ptr = write_ptr = org_string; + + while (*scan_ptr) + { + if ( !isspace(*scan_ptr) && first_nonspace == NULL) + { + first_nonspace = scan_ptr; + } + + if (first_nonspace != NULL) + { + *(write_ptr++) = *scan_ptr; + if ( !isspace(*scan_ptr)) + { + last_nonspace = write_ptr; + } + } + + scan_ptr++; + } + + if (last_nonspace) { *last_nonspace = '\0'; } +} typedef struct loc_param_v_type { - char* param_name; - char* param_str_value; - int param_int_value; - double param_double_value; + char* param_name; + + char* param_str_value; + int param_int_value; + double param_double_value; }loc_param_v_type; /*=========================================================================== @@ -92,267 +136,61 @@ RETURN VALUE SIDE EFFECTS N/A ===========================================================================*/ -int loc_set_config_entry(const loc_param_s_type* config_entry, loc_param_v_type* config_value) +void loc_set_config_entry(loc_param_s_type* config_entry, loc_param_v_type* config_value) { - int ret=-1; - if(NULL == config_entry || NULL == config_value) - { - LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__); - return ret; - } + if(NULL == config_entry || NULL == config_value) + { + LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__); + return; + } - if (strcmp(config_entry->param_name, config_value->param_name) == 0 && - config_entry->param_ptr) - { - switch (config_entry->param_type) - { - case 's': - if (strcmp(config_value->param_str_value, "NULL") == 0) - { - *((char*)config_entry->param_ptr) = '\0'; - } - else { - strlcpy((char*) config_entry->param_ptr, - config_value->param_str_value, - LOC_MAX_PARAM_STRING + 1); - } - /* Log INI values */ - LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__, - config_entry->param_name, (char*)config_entry->param_ptr); + if (strcmp(config_entry->param_name, config_value->param_name) == 0 && + config_entry->param_ptr) + { + switch (config_entry->param_type) + { + case 's': + if (strcmp(config_value->param_str_value, "NULL") == 0) + { + *((char*)config_entry->param_ptr) = '\0'; + } + else { + strlcpy((char*) config_entry->param_ptr, + config_value->param_str_value, + LOC_MAX_PARAM_STRING + 1); + } + /* Log INI values */ + LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__, config_entry->param_name, (char*)config_entry->param_ptr); - if(NULL != config_entry->param_set) - { - *(config_entry->param_set) = 1; - } - ret = 0; - break; - case 'n': - *((int *)config_entry->param_ptr) = config_value->param_int_value; - /* Log INI values */ - LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__, - config_entry->param_name, config_value->param_int_value); + if(NULL != config_entry->param_set) + { + *(config_entry->param_set) = 1; + } + break; + case 'n': + *((int *)config_entry->param_ptr) = config_value->param_int_value; + /* Log INI values */ + LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__, config_entry->param_name, config_value->param_int_value); - if(NULL != config_entry->param_set) - { - *(config_entry->param_set) = 1; - } - ret = 0; - break; - case 'f': - *((double *)config_entry->param_ptr) = config_value->param_double_value; - /* Log INI values */ - LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__, - config_entry->param_name, config_value->param_double_value); + if(NULL != config_entry->param_set) + { + *(config_entry->param_set) = 1; + } + break; + case 'f': + *((double *)config_entry->param_ptr) = config_value->param_double_value; + /* Log INI values */ + LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__, config_entry->param_name, config_value->param_double_value); - if(NULL != config_entry->param_set) - { - *(config_entry->param_set) = 1; - } - ret = 0; - break; - default: - LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s", - __FUNCTION__, config_entry->param_name); - } - } - return ret; -} - -/*=========================================================================== -FUNCTION loc_fill_conf_item - -DESCRIPTION - Takes a line of configuration item and sets defined values based on - the passed in configuration table. This table maps strings to values to - set along with the type of each of these values. - -PARAMETERS: - input_buf : buffer contanis config item - config_table: table definition of strings to places to store information - table_length: length of the configuration table - -DEPENDENCIES - N/A - -RETURN VALUE - 0: Number of records in the config_table filled with input_buf - -SIDE EFFECTS - N/A -===========================================================================*/ -int loc_fill_conf_item(char* input_buf, - const loc_param_s_type* config_table, uint32_t table_length) -{ - int ret = 0; - - if (input_buf && config_table) { - char *lasts; - loc_param_v_type config_value; - memset(&config_value, 0, sizeof(config_value)); - - /* Separate variable and value */ - config_value.param_name = strtok_r(input_buf, "=", &lasts); - /* skip lines that do not contain "=" */ - if (config_value.param_name) { - config_value.param_str_value = strtok_r(NULL, "=", &lasts); - - /* skip lines that do not contain two operands */ - if (config_value.param_str_value) { - /* Trim leading and trailing spaces */ - loc_util_trim_space(config_value.param_name); - loc_util_trim_space(config_value.param_str_value); - - /* Parse numerical value */ - if ((strlen(config_value.param_str_value) >=3) && - (config_value.param_str_value[0] == '0') && - (tolower(config_value.param_str_value[1]) == 'x')) - { - /* hex */ - config_value.param_int_value = (int) strtol(&config_value.param_str_value[2], - (char**) NULL, 16); - } - else { - config_value.param_double_value = (double) atof(config_value.param_str_value); /* float */ - config_value.param_int_value = atoi(config_value.param_str_value); /* dec */ - } - - for(uint32_t i = 0; NULL != config_table && i < table_length; i++) - { - if(!loc_set_config_entry(&config_table[i], &config_value)) { - ret += 1; - } - } - } - } - } - - return ret; -} - -/*=========================================================================== -FUNCTION loc_read_conf_r (repetitive) - -DESCRIPTION - Reads the specified configuration file and sets defined values based on - the passed in configuration table. This table maps strings to values to - set along with the type of each of these values. - The difference between this and loc_read_conf is that this function returns - the file pointer position at the end of filling a config table. Also, it - reads a fixed number of parameters at a time which is equal to the length - of the configuration table. This functionality enables the caller to - repeatedly call the function to read data from the same file. - -PARAMETERS: - conf_fp : file pointer - config_table: table definition of strings to places to store information - table_length: length of the configuration table - -DEPENDENCIES - N/A - -RETURN VALUE - 0: Table filled successfully - 1: No more parameters to read - -1: Error filling table - -SIDE EFFECTS - N/A -===========================================================================*/ -int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, uint32_t table_length) -{ - int ret=0; - - unsigned int num_params=table_length; - if(conf_fp == NULL) { - LOC_LOGE("%s:%d]: ERROR: File pointer is NULL\n", __func__, __LINE__); - ret = -1; - goto err; - } - - /* Clear all validity bits */ - for(uint32_t i = 0; NULL != config_table && i < table_length; i++) - { - if(NULL != config_table[i].param_set) - { - *(config_table[i].param_set) = 0; - } - } - - char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */ - - LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params); - while(num_params) - { - if(!fgets(input_buf, LOC_MAX_PARAM_LINE, conf_fp)) { - LOC_LOGD("%s:%d]: fgets returned NULL\n", __func__, __LINE__); - break; - } - - num_params -= loc_fill_conf_item(input_buf, config_table, table_length); - } - -err: - return ret; -} - -/*=========================================================================== -FUNCTION loc_udpate_conf - -DESCRIPTION - Parses the passed in buffer for configuration items, and update the table - that is also passed in. - -Reads the specified configuration file and sets defined values based on - the passed in configuration table. This table maps strings to values to - set along with the type of each of these values. - -PARAMETERS: - conf_data: configuration items in bufferas a string - length: strlen(conf_data) - config_table: table definition of strings to places to store information - table_length: length of the configuration table - -DEPENDENCIES - N/A - -RETURN VALUE - number of the records in the table that is updated at time of return. - -SIDE EFFECTS - N/A -===========================================================================*/ -int loc_update_conf(const char* conf_data, int32_t length, - const loc_param_s_type* config_table, uint32_t table_length) -{ - int ret = -1; - - if (conf_data && length && config_table && table_length) { - // make a copy, so we do not tokenize the original data - char* conf_copy = (char*)malloc(length+1); - - if (conf_copy != NULL) - { - memcpy(conf_copy, conf_data, length); - // we hard NULL the end of string to be safe - conf_copy[length] = 0; - - // start with one record off - uint32_t num_params = table_length - 1; - char* saveptr = NULL; - char* input_buf = strtok_r(conf_copy, "\n", &saveptr); - ret = 0; - - LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params); - while(num_params && input_buf) { - ret++; - num_params -= loc_fill_conf_item(input_buf, config_table, table_length); - input_buf = strtok_r(NULL, "\n", &saveptr); - } - free(conf_copy); - } - } - - return ret; + if(NULL != config_entry->param_set) + { + *(config_entry->param_set) = 1; + } + break; + default: + LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s", __FUNCTION__, config_entry->param_name); + } + } } /*=========================================================================== @@ -377,24 +215,72 @@ RETURN VALUE SIDE EFFECTS N/A ===========================================================================*/ -void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_table, - uint32_t table_length) +void loc_read_conf(const char* conf_file_name, loc_param_s_type* config_table, uint32_t table_length) { - FILE *conf_fp = NULL; - char *lasts; - loc_param_v_type config_value; - uint32_t i; + FILE *gps_conf_fp = NULL; + char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */ + char *lasts; + loc_param_v_type config_value; + uint32_t i; - if((conf_fp = fopen(conf_file_name, "r")) != NULL) - { - LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name); - if(table_length && config_table) { - loc_read_conf_r(conf_fp, config_table, table_length); - rewind(conf_fp); - } - loc_read_conf_r(conf_fp, loc_param_table, loc_param_num); - fclose(conf_fp); - } - /* Initialize logging mechanism with parsed data */ - loc_logger_init(DEBUG_LEVEL, TIMESTAMP); + if((gps_conf_fp = fopen(conf_file_name, "r")) != NULL) + { + LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name); + } + else + { + LOC_LOGW("%s: no %s file found", __FUNCTION__, conf_file_name); + loc_logger_init(DEBUG_LEVEL, TIMESTAMP); + return; /* no parameter file */ + } + + /* Clear all validity bits */ + for(i = 0; NULL != config_table && i < table_length; i++) + { + if(NULL != config_table[i].param_set) + { + *(config_table[i].param_set) = 0; + } + } + + while(fgets(input_buf, LOC_MAX_PARAM_LINE, gps_conf_fp) != NULL) + { + memset(&config_value, 0, sizeof(config_value)); + + /* Separate variable and value */ + config_value.param_name = strtok_r(input_buf, "=", &lasts); + if (config_value.param_name == NULL) continue; /* skip lines that do not contain "=" */ + config_value.param_str_value = strtok_r(NULL, "=", &lasts); + if (config_value.param_str_value == NULL) continue; /* skip lines that do not contain two operands */ + + /* Trim leading and trailing spaces */ + trim_space(config_value.param_name); + trim_space(config_value.param_str_value); + + /* Parse numerical value */ + if (config_value.param_str_value[0] == '0' && tolower(config_value.param_str_value[1]) == 'x') + { + /* hex */ + config_value.param_int_value = (int) strtol(&config_value.param_str_value[2], (char**) NULL, 16); + } + else { + config_value.param_double_value = (double) atof(config_value.param_str_value); /* float */ + config_value.param_int_value = atoi(config_value.param_str_value); /* dec */ + } + + for(i = 0; NULL != config_table && i < table_length; i++) + { + loc_set_config_entry(&config_table[i], &config_value); + } + + for(i = 0; i < loc_param_num; i++) + { + loc_set_config_entry(&loc_parameter_table[i], &config_value); + } + } + + fclose(gps_conf_fp); + + /* Initialize logging mechanism with parsed data */ + loc_logger_init(DEBUG_LEVEL, TIMESTAMP); } diff --git a/utils/loc_cfg.h b/utils/loc_cfg.h index 9045e1d5..df833389 100644 --- a/utils/loc_cfg.h +++ b/utils/loc_cfg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,22 +30,17 @@ #ifndef LOC_CFG_H #define LOC_CFG_H -#include #include -#define LOC_MAX_PARAM_NAME 80 +#define LOC_MAX_PARAM_NAME 48 #define LOC_MAX_PARAM_STRING 80 -#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING) - -#define UTIL_UPDATE_CONF(conf_data, len, config_table) \ - loc_update_conf((conf_data), (len), (config_table), \ - sizeof(config_table) / sizeof(config_table[0])) +#define LOC_MAX_PARAM_LINE 80 #define UTIL_READ_CONF_DEFAULT(filename) \ loc_read_conf((filename), NULL, 0); #define UTIL_READ_CONF(filename, config_table) \ - loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0])) + loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0])) /*============================================================================= * @@ -54,7 +49,7 @@ *============================================================================*/ typedef struct { - const char *param_name; + char param_name[LOC_MAX_PARAM_NAME]; void *param_ptr; uint8_t *param_set; /* was this value set by config file? */ char param_type; /* 'n' for number, @@ -77,13 +72,10 @@ extern "C" { * MODULE EXPORTED FUNCTIONS * *============================================================================*/ -void loc_read_conf(const char* conf_file_name, - const loc_param_s_type* config_table, - uint32_t table_length); -int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, - uint32_t table_length); -int loc_update_conf(const char* conf_data, int32_t length, - const loc_param_s_type* config_table, uint32_t table_length); +extern void loc_read_conf(const char* conf_file_name, + loc_param_s_type* config_table, + uint32_t table_length); + #ifdef __cplusplus } #endif diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp index f6b54f91..c64310eb 100644 --- a/utils/loc_log.cpp +++ b/utils/loc_log.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, 2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,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 @@ -47,15 +47,14 @@ const char FROM_MODEM[] = "<---"; const char TO_AFW[] = "<==="; const char EXIT_TAG[] = "Exiting"; const char ENTRY_TAG[] = "Entering"; -const char EXIT_ERROR_TAG[] = "Exiting with error"; /* Logging Mechanism */ loc_logger_s_type loc_logger; /* Get names from value */ -const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask) +const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask) { - size_t i; + int i; for (i = 0; i < table_size; i++) { if (table[i].val & (long) mask) @@ -67,9 +66,9 @@ const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t tab } /* Get names from value */ -const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value) +const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value) { - size_t i; + int i; for (i = 0; i < table_size; i++) { if (table[i].val == (long) value) @@ -80,7 +79,7 @@ const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t tabl return UNKNOWN_STR; } -static const loc_name_val_s_type loc_msg_q_status[] = +static loc_name_val_s_type loc_msg_q_status[] = { NAME_VAL( eMSG_Q_SUCCESS ), NAME_VAL( eMSG_Q_FAILURE_GENERAL ), @@ -89,7 +88,7 @@ static const loc_name_val_s_type loc_msg_q_status[] = NAME_VAL( eMSG_Q_UNAVAILABLE_RESOURCE ), NAME_VAL( eMSG_Q_INSUFFICIENT_BUFFER ) }; -static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status); +static int loc_msg_q_status_num = sizeof(loc_msg_q_status) / sizeof(loc_name_val_s_type); /* Find msg_q status name */ const char* loc_get_msg_q_status(int status) @@ -103,18 +102,17 @@ const char* log_succ_fail_string(int is_succ) } //Target names -static const loc_name_val_s_type target_name[] = +loc_name_val_s_type target_name[] = { NAME_VAL(GNSS_NONE), NAME_VAL(GNSS_MSM), NAME_VAL(GNSS_GSS), NAME_VAL(GNSS_MDM), NAME_VAL(GNSS_QCA1530), - NAME_VAL(GNSS_AUTO), NAME_VAL(GNSS_UNKNOWN) }; -static const size_t target_name_num = LOC_TABLE_SIZE(target_name); +static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type); /*=========================================================================== @@ -135,7 +133,7 @@ const char *loc_get_target_name(unsigned int target) static char ret[BUFFER_SIZE]; index = getTargetGnssType(target); - if( index < 0 || (unsigned)index >= target_name_num ) + if( index >= target_name_num || index < 0) index = target_name_num - 1; if( (target & HAS_SSC) == HAS_SSC ) { @@ -164,7 +162,7 @@ RETURN VALUE The time string ===========================================================================*/ -char *loc_get_time(char *time_string, size_t buf_size) +char *loc_get_time(char *time_string, unsigned long buf_size) { struct timeval now; /* sec and usec */ struct tm now_tm; /* broken-down time */ @@ -178,61 +176,3 @@ char *loc_get_time(char *time_string, size_t buf_size) return time_string; } - - -/*=========================================================================== -FUNCTION loc_logger_init - -DESCRIPTION - Initializes the state of DEBUG_LEVEL and TIMESTAMP - -DEPENDENCIES - N/A - -RETURN VALUE - None - -SIDE EFFECTS - N/A -===========================================================================*/ -void loc_logger_init(unsigned long debug, unsigned long timestamp) -{ - loc_logger.DEBUG_LEVEL = debug; -#ifdef TARGET_BUILD_VARIANT_USER - // force user builds to 2 or less - if (loc_logger.DEBUG_LEVEL > 2) { - loc_logger.DEBUG_LEVEL = 2; - } -#endif - loc_logger.TIMESTAMP = timestamp; -} - - -/*=========================================================================== -FUNCTION get_timestamp - -DESCRIPTION - Generates a timestamp using the current system time - -DEPENDENCIES - N/A - -RETURN VALUE - Char pointer to the parameter str - -SIDE EFFECTS - N/A -===========================================================================*/ -char * get_timestamp(char *str, unsigned long buf_size) -{ - struct timeval tv; - struct timezone tz; - int hh, mm, ss; - gettimeofday(&tv, &tz); - hh = tv.tv_sec/3600%24; - mm = (tv.tv_sec%3600)/60; - ss = tv.tv_sec%60; - snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec); - return str; -} - diff --git a/utils/loc_log.h b/utils/loc_log.h index be492b11..82dc6368 100644 --- a/utils/loc_log.h +++ b/utils/loc_log.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, 2015 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,13 +36,12 @@ extern "C" #endif #include -#include #include "loc_target.h" typedef struct { - const char *name; - long val; + char name[128]; + long val; } loc_name_val_s_type; #define NAME_VAL(x) {"" #x "", x } @@ -50,19 +49,17 @@ typedef struct #define UNKNOWN_STR "UNKNOWN" #define CHECK_MASK(type, value, mask_var, mask) \ - (((mask_var) & (mask)) ? (type) (value) : (type) (-1)) - -#define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0])) + ((mask_var & mask) ? (type) value : (type) (-1)) /* Get names from value */ -const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask); -const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value); +const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask); +const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value); const char* loc_get_msg_q_status(int status); const char* loc_get_target_name(unsigned int target); extern const char* log_succ_fail_string(int is_succ); -extern char *loc_get_time(char *time_string, size_t buf_size); +extern char *loc_get_time(char *time_string, unsigned long buf_size); #ifdef __cplusplus } diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp deleted file mode 100644 index 7e96313f..00000000 --- a/utils/loc_misc_utils.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -#include -#include -#include -#include -#include - -#define LOG_NDDEBUG 0 -#define LOG_TAG "LocSvc_misc_utils" - -int loc_util_split_string(char *raw_string, char **split_strings_ptr, - int max_num_substrings, char delimiter) -{ - int raw_string_index=0; - int num_split_strings=0; - unsigned char end_string=0; - int raw_string_length=0; - - if(!raw_string || !split_strings_ptr) { - LOC_LOGE("%s:%d]: NULL parameters", __func__, __LINE__); - num_split_strings = -1; - goto err; - } - LOC_LOGD("%s:%d]: raw string: %s\n", __func__, __LINE__, raw_string); - raw_string_length = strlen(raw_string) + 1; - split_strings_ptr[num_split_strings] = &raw_string[raw_string_index]; - for(raw_string_index=0; raw_string_index < raw_string_length; raw_string_index++) { - if(raw_string[raw_string_index] == '\0') - end_string=1; - if((raw_string[raw_string_index] == delimiter) || end_string) { - raw_string[raw_string_index] = '\0'; - LOC_LOGD("%s:%d]: split string: %s\n", - __func__, __LINE__, split_strings_ptr[num_split_strings]); - num_split_strings++; - if(((raw_string_index + 1) < raw_string_length) && - (num_split_strings < max_num_substrings)) { - split_strings_ptr[num_split_strings] = &raw_string[raw_string_index+1]; - } - else { - break; - } - } - if(end_string) - break; - } -err: - LOC_LOGD("%s:%d]: num_split_strings: %d\n", __func__, __LINE__, num_split_strings); - return num_split_strings; -} - -void loc_util_trim_space(char *org_string) -{ - char *scan_ptr, *write_ptr; - char *first_nonspace = NULL, *last_nonspace = NULL; - - if(org_string == NULL) { - LOC_LOGE("%s:%d]: NULL parameter", __func__, __LINE__); - goto err; - } - - scan_ptr = write_ptr = org_string; - - while (*scan_ptr) { - //Find the first non-space character - if ( !isspace(*scan_ptr) && first_nonspace == NULL) { - first_nonspace = scan_ptr; - } - //Once the first non-space character is found in the - //above check, keep shifting the characters to the left - //to replace the spaces - if (first_nonspace != NULL) { - *(write_ptr++) = *scan_ptr; - //Keep track of which was the last non-space character - //encountered - //last_nonspace will not be updated in the case where - //the string ends with spaces - if ( !isspace(*scan_ptr)) { - last_nonspace = write_ptr; - } - } - scan_ptr++; - } - //Add NULL terminator after the last non-space character - if (last_nonspace) { *last_nonspace = '\0'; } -err: - return; -} diff --git a/utils/loc_misc_utils.h b/utils/loc_misc_utils.h deleted file mode 100644 index 7d66d842..00000000 --- a/utils/loc_misc_utils.h +++ /dev/null @@ -1,99 +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_MISC_UTILS_H_ -#define _LOC_MISC_UTILS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*=========================================================================== -FUNCTION loc_split_string - -DESCRIPTION: - This function is used to split a delimiter separated string into - sub-strings. This function does not allocate new memory to store the split - strings. Instead, it places '\0' in places of delimiters and assings the - starting address of the substring within the raw string as the string address - The input raw_string no longer remains to be a collection of sub-strings - after this function is executed. - Please make a copy of the input string before calling this function if - necessary - -PARAMETERS: - char *raw_string: is the original string with delimiter separated substrings - char **split_strings_ptr: is the arraw of pointers which will hold the addresses - of individual substrings - int max_num_substrings: is the maximum number of substrings that are expected - by the caller. The array of pointers in the above parameter - is usually this long - char delimiter: is the delimiter that separates the substrings. Examples: ' ', ';' - -DEPENDENCIES - N/A - -RETURN VALUE - int Number of split strings - -SIDE EFFECTS - The input raw_string no longer remains a delimiter separated single string. - -EXAMPLE - delimiter = ' ' //space - raw_string = "hello new user" //delimiter is space ' ' - addresses = 0123456789abcd - split_strings_ptr[0] = &raw_string[0]; //split_strings_ptr[0] contains "hello" - split_strings_ptr[1] = &raw_string[6]; //split_strings_ptr[1] contains "new" - split_strings_ptr[2] = &raw_string[a]; //split_strings_ptr[2] contains "user" - -===========================================================================*/ -int loc_util_split_string(char *raw_string, char **split_strings_ptr, int max_num_substrings, - char delimiter); - -/*=========================================================================== -FUNCTION trim_space - -DESCRIPTION - Removes leading and trailing spaces of the string - -DEPENDENCIES - N/A - -RETURN VALUE - None - -SIDE EFFECTS - N/A -===========================================================================*/ -void loc_util_trim_space(char *org_string); -#ifdef __cplusplus -} -#endif - -#endif //_LOC_MISC_UTILS_H_ diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index 30c040c7..b5a62972 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012,2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -53,15 +53,11 @@ #define STR_SURF "Surf" #define STR_MTP "MTP" #define STR_APQ "apq" -#define STR_AUTO "auto" #define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r') #define LENGTH(s) (sizeof(s) - 1) #define GPS_CHECK_NO_ERROR 0 #define GPS_CHECK_NO_GPS_HW 1 -/* When system server is started, it uses 20 seconds as ActivityManager - * timeout. After that it sends SIGSTOP signal to process. - */ -#define QCA1530_DETECT_TIMEOUT 15 +#define QCA1530_DETECT_TIMEOUT 30 #define QCA1530_DETECT_PRESENT "yes" #define QCA1530_DETECT_PROGRESS "detect" @@ -103,7 +99,7 @@ static int read_a_line(const char * file_path, char * line, int line_size) */ static bool is_qca1530(void) { - static const char qca1530_property_name[] = "sys.qca1530"; + static const char qca1530_property_name[] = "persist.qca1530"; bool res = false; int ret, i; char buf[PROPERTY_VALUE_MAX]; @@ -146,34 +142,6 @@ static bool is_qca1530(void) return res; } -/*The character array passed to this function should have length - of atleast PROPERTY_VALUE_MAX*/ -void loc_get_target_baseband(char *baseband, int array_length) -{ - if(baseband && (array_length >= PROPERTY_VALUE_MAX)) { - property_get("ro.baseband", baseband, ""); - LOC_LOGD("%s:%d]: Baseband: %s\n", __func__, __LINE__, baseband); - } - else { - LOC_LOGE("%s:%d]: NULL parameter or array length less than PROPERTY_VALUE_MAX\n", - __func__, __LINE__); - } -} - -/*The character array passed to this function should have length - of atleast PROPERTY_VALUE_MAX*/ -void loc_get_platform_name(char *platform_name, int array_length) -{ - if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) { - property_get("ro.board.platform", platform_name, ""); - LOC_LOGD("%s:%d]: Target name: %s\n", __func__, __LINE__, platform_name); - } - else { - LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n", - __func__, __LINE__); - } -} - unsigned int loc_get_target(void) { if (gTarget != (unsigned int)-1) @@ -196,8 +164,7 @@ unsigned int loc_get_target(void) goto detected; } - loc_get_target_baseband(baseband, sizeof(baseband)); - + platform_lib_abstraction_property_get("ro.baseband", baseband, ""); if (!access(hw_platform, F_OK)) { read_a_line(hw_platform, rd_hw_platform, LINE_LEN); } else { @@ -208,13 +175,8 @@ unsigned int loc_get_target(void) } else { read_a_line(id_dep, rd_id, LINE_LEN); } - if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) ) - { - gTarget = TARGET_AUTO; - goto detected; - } - if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ + if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) gTarget = TARGET_MPQ; @@ -245,17 +207,3 @@ detected: LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } - -/*Reads the property ro.lean to identify if this is a lean target - Returns: - 0 if not a lean and mean target - 1 if this is a lean and mean target -*/ -int loc_identify_lean_target() -{ - int ret = 0; - char lean_target[PROPERTY_VALUE_MAX]; - property_get("ro.lean", lean_target, ""); - LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target); - return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX)); -} diff --git a/utils/loc_target.h b/utils/loc_target.h index 3bb3b5e2..4aebb851 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,7 +35,6 @@ #define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) #define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC) -#define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) #define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) #define getTargetGnssType(target) (target>>1) @@ -46,18 +45,6 @@ extern "C" unsigned int loc_get_target(void); -/*The character array passed to this function should have length - of atleast PROPERTY_VALUE_MAX*/ -void loc_get_target_baseband(char *baseband, int array_length); -/*The character array passed to this function should have length - of atleast PROPERTY_VALUE_MAX*/ -void loc_get_platform_name(char *platform_name, int array_length); -/*Reads the property ro.lean to identify if this is a lean target - Returns: - 0 if not a lean and mean target - 1 if this is a lean and mean target*/ -int loc_identify_lean_target(); - /* Please remember to update 'target_name' in loc_log.cpp, if do any changes to this enum. */ typedef enum { @@ -66,7 +53,6 @@ typedef enum { GNSS_GSS, GNSS_MDM, GNSS_QCA1530, - GNSS_AUTO, GNSS_UNKNOWN }GNSS_TARGET; diff --git a/utils/loc_timer.c b/utils/loc_timer.c new file mode 100644 index 00000000..0e9f6bde --- /dev/null +++ b/utils/loc_timer.c @@ -0,0 +1,187 @@ +/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include "loc_timer.h" +#include +#include +#include"platform_lib_includes.h" + +enum timer_state { + READY = 100, + WAITING, + DONE, + ABORT +}; + +typedef struct { + loc_timer_callback callback_func; + void *user_data; + unsigned int time_msec; + pthread_cond_t timer_cond; + pthread_mutex_t timer_mutex; + enum timer_state state; +}timer_data; + +static void *timer_thread(void *thread_data) +{ + int ret = -ETIMEDOUT; + struct timespec ts; + struct timeval tv; + timer_data* t = (timer_data*)thread_data; + + LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t->time_msec); + + gettimeofday(&tv, NULL); + clock_gettime(CLOCK_REALTIME, &ts); + if(t->time_msec >= 1000) { + ts.tv_sec += t->time_msec/1000; + t->time_msec = t->time_msec % 1000; + } + if(t->time_msec) + ts.tv_nsec += t->time_msec * 1000000; + if(ts.tv_nsec > 999999999) { + LOC_LOGD("%s:%d]: Large nanosecs\n", __func__, __LINE__); + ts.tv_sec += 1; + ts.tv_nsec -= 1000000000; + } + LOC_LOGD("%s:%d]: ts.tv_sec:%d; ts.tv_nsec:%d\n" + "\t Current time: %d sec; %d nsec", + __func__, __LINE__, (int)ts.tv_sec, (int)ts.tv_nsec, + (int)tv.tv_sec, (int)tv.tv_usec*1000); + + pthread_mutex_lock(&(t->timer_mutex)); + if (READY == t->state) { + t->state = WAITING; + ret = pthread_cond_timedwait(&t->timer_cond, &t->timer_mutex, &ts); + t->state = DONE; + } + pthread_mutex_unlock(&(t->timer_mutex)); + + switch (ret) { + case ETIMEDOUT: + LOC_LOGV("%s:%d]: loc_timer timed out", __func__, __LINE__); + break; + case 0: + LOC_LOGV("%s:%d]: loc_timer stopped", __func__, __LINE__); + break; + case -ETIMEDOUT: + LOC_LOGV("%s:%d]: loc_timer cancelled", __func__, __LINE__); + break; + default: + LOC_LOGE("%s:%d]: Call to pthread timedwait failed; ret=%d\n", + __func__, __LINE__, ret); + break; + } + + pthread_mutex_destroy(&t->timer_mutex); + pthread_cond_destroy(&t->timer_cond); + + if(ETIMEDOUT == ret) + t->callback_func(t->user_data, ret); + + free(t); + LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__); + return NULL; +} + +void* loc_timer_start(unsigned int msec, loc_timer_callback cb_func, + void* caller_data) +{ + timer_data *t=NULL; + pthread_attr_t tattr; + pthread_t id; + LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__); + if(cb_func == NULL || msec == 0) { + LOC_LOGE("%s:%d]: Error: Wrong parameters\n", __func__, __LINE__); + goto _err; + } + t = (timer_data *)calloc(1, sizeof(timer_data)); + if(t == NULL) { + LOC_LOGE("%s:%d]: Could not allocate memory. Failing.\n", + __func__, __LINE__); + goto _err; + } + + if(pthread_cond_init(&(t->timer_cond), NULL)) { + LOC_LOGE("%s:%d]: Pthread cond init failed\n", __func__, __LINE__); + goto t_err; + } + if(pthread_mutex_init(&(t->timer_mutex), NULL)) { + LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__); + goto cond_err; + } + + t->callback_func = cb_func; + t->user_data = caller_data; + t->time_msec = msec; + t->state = READY; + + if (pthread_attr_init(&tattr)) { + LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__); + goto mutex_err; + } + pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED); + + if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) { + LOC_LOGE("%s:%d]: Could not create thread\n", __func__, __LINE__); + goto attr_err; + } + + LOC_LOGD("%s:%d]: Created thread with id: %d\n", + __func__, __LINE__, (int)id); + goto _err; + +attr_err: + pthread_attr_destroy(&tattr); +mutex_err: + pthread_mutex_destroy(&t->timer_mutex); +cond_err: + pthread_cond_destroy(&t->timer_cond); +t_err: + free(t); +_err: + LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__); + return t; +} + +void loc_timer_stop(void* handle) { + timer_data* t = (timer_data*)handle; + + if (NULL != t && (READY == t->state || WAITING == t->state)) { + pthread_mutex_lock(&(t->timer_mutex)); + if (READY == t->state || WAITING == t->state) { + pthread_cond_signal(&t->timer_cond); + t->state = ABORT; + } + pthread_mutex_unlock(&(t->timer_mutex)); + } +} diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 2967858e..5ca15862 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013,2015 The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-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 @@ -33,38 +33,28 @@ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include +#include +#include /* - user_data: client context pointer, passthrough. Originally received - from calling client when loc_timer_start() is called. - result: 0 if timer successfully timed out; else timer failed. + Return values: + Success = 0 + Failure = Non zero */ -typedef void (*loc_timer_callback)(void *user_data, int32_t result); +typedef void(*loc_timer_callback)(void *user_data, int result); /* - delay_msec: timeout value for the timer. - cb_func: callback function pointer, implemented by client. - Can not be NULL. - user_data: client context pointer, passthrough. Will be - returned when loc_timer_callback() is called. - wakeOnExpire: true if to wake up CPU (if sleeping) upon timer - expiration and notify the client. - false if to wait until next time CPU wakes up (if - sleeping) and then notify the client. - Returns the handle, which can be used to stop the timer - NULL, if timer start fails (e.g. if cb_func is NULL). + Returns the handle, which can be used to stop the timer */ -void* loc_timer_start(uint64_t delay_msec, - loc_timer_callback cb_func, - void *user_data, - bool wake_on_expire=false); +void* loc_timer_start(unsigned int delay_msec, + loc_timer_callback, + void* user_data); /* - handle becomes invalid upon the return of the callback + handle becomes invalid upon the return of the callback */ -void loc_timer_stop(void*& handle); +void loc_timer_stop(void* handle); #ifdef __cplusplus } diff --git a/utils/msg_q.c b/utils/msg_q.c index e412e781..1555668c 100644 --- a/utils/msg_q.c +++ b/utils/msg_q.c @@ -198,7 +198,7 @@ msq_q_err_type msg_q_snd(void* msg_q_data, void* msg_obj, void (*dealloc)(void*) msg_q* p_msg_q = (msg_q*)msg_q_data; pthread_mutex_lock(&p_msg_q->list_mutex); - LOC_LOGV("%s: Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); + LOC_LOGD("%s: Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); if( p_msg_q->unblocked ) { @@ -214,7 +214,7 @@ msq_q_err_type msg_q_snd(void* msg_q_data, void* msg_obj, void (*dealloc)(void*) pthread_mutex_unlock(&p_msg_q->list_mutex); - LOC_LOGV("%s: Finished Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); + LOC_LOGD("%s: Finished Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); return rv; } @@ -241,7 +241,7 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj) msg_q* p_msg_q = (msg_q*)msg_q_data; - LOC_LOGV("%s: Waiting on message\n", __FUNCTION__); + LOC_LOGD("%s: Waiting on message\n", __FUNCTION__); pthread_mutex_lock(&p_msg_q->list_mutex); @@ -262,7 +262,7 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj) pthread_mutex_unlock(&p_msg_q->list_mutex); - LOC_LOGV("%s: Received message 0x%08X rv = %d\n", __FUNCTION__, *msg_obj, rv); + LOC_LOGD("%s: Received message 0x%08X rv = %d\n", __FUNCTION__, *msg_obj, rv); return rv; } diff --git a/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp deleted file mode 100644 index e8cb93a9..00000000 --- a/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include "platform_lib_time.h" - -int64_t systemTime(int clock) -{ - struct timeval t; - t.tv_sec = t.tv_usec = 0; - gettimeofday(&t, NULL); - return t.tv_sec*1000000LL + t.tv_usec; -} - - -int64_t elapsedMillisSinceBoot() -{ - int64_t t_us = systemTime(0); - return (int64_t) t_us / 1000LL; -} diff --git a/utils/platform_lib_abstractions/platform_lib_includes.h b/utils/platform_lib_abstractions/platform_lib_includes.h deleted file mode 100644 index 5858674f..00000000 --- a/utils/platform_lib_abstractions/platform_lib_includes.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PLATFORM_LIB_INCLUDES_H_ -#define _PLATFORM_LIB_INCLUDES_H_ - -#include "platform_lib_time.h" -#include "platform_lib_macros.h" - -#endif diff --git a/utils/platform_lib_abstractions/platform_lib_macros.h b/utils/platform_lib_abstractions/platform_lib_macros.h deleted file mode 100644 index bc48dd99..00000000 --- a/utils/platform_lib_abstractions/platform_lib_macros.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __PLATFORM_LIB_MACROS_H__ -#define __PLATFORM_LIB_MACROS_H__ - -#include - -#define TS_PRINTF(format, x...) \ -{ \ - struct timeval tv; \ - struct timezone tz; \ - int hh, mm, ss; \ - gettimeofday(&tv, &tz); \ - hh = tv.tv_sec/3600%24; \ - mm = (tv.tv_sec%3600)/60; \ - ss = tv.tv_sec%60; \ - fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \ -} - - -#ifdef USE_GLIB - -#define strlcat g_strlcat -#define strlcpy g_strlcpy - -#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) - -#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid)) - -#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread -#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot()) - - -#else - -#ifdef __cplusplus -extern "C" { -#endif -pid_t gettid(void); - -#ifdef __cplusplus -} -#endif - -#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid()) -#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread -#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime()) - -#endif - -#endif diff --git a/utils/platform_lib_abstractions/platform_lib_time.h b/utils/platform_lib_abstractions/platform_lib_time.h deleted file mode 100644 index ce013afc..00000000 --- a/utils/platform_lib_abstractions/platform_lib_time.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PLATFORM_LIB_TIME_H_ -#define _PLATFORM_LIB_TIME_H_ - -int64_t systemTime(int clock); -int64_t elapsedMillisSinceBoot(); - -#endif From a376de48267adf99805cf7c0083cc10e06873b38 Mon Sep 17 00:00:00 2001 From: Deven Patel Date: Tue, 15 Mar 2016 12:20:01 -0700 Subject: [PATCH 40/41] Revert "Revert "Merging m_master changes to oe_master"." This reverts commit a29688ff347be4972133eb11ccecaf03b0d3445e Change-Id: Iab525a58ddb6a00e119afe19f4f51b07b7f428f2 --- core/Android.mk | 14 +- core/ContextBase.cpp | 29 +- core/ContextBase.h | 11 +- core/LBSProxyBase.h | 13 +- core/LocAdapterBase.cpp | 41 +- core/LocAdapterBase.h | 27 +- core/LocAdapterProxyBase.h | 70 + core/LocApiBase.cpp | 96 +- core/LocApiBase.h | 60 +- core/LocDualContext.cpp | 97 +- core/LocDualContext.h | 34 +- core/MsgTask.cpp | 131 -- core/UlpProxyBase.h | 14 +- core/gps_extended_c.h | 222 ++- core/loc_core_log.cpp | 67 +- etc/gps.conf | 38 +- loc_api/NOTICE | 13 - .../libloc_api-rpc-glue/rpc_inc/LocApiRpc.h | 8 +- .../libloc_api-rpc-glue/src/LocApiRpc.cpp | 48 +- loc_api/libloc_api-rpc/Android.mk | 61 - loc_api/libloc_api-rpc/gen-1240/Makefile.xdr | 29 - loc_api/libloc_api-rpc/gen-1240/loc_api.xdr | 172 -- .../libloc_api-rpc/gen-1240/loc_api_cb.xdr | 85 - .../libloc_api-rpc/gen-1240/loc_api_cb_svc.c | 64 - .../libloc_api-rpc/gen-1240/loc_api_cb_xdr.c | 32 - .../libloc_api-rpc/gen-1240/loc_api_clnt.c | 91 - .../gen-1240/loc_api_common.xdr | 906 --------- .../gen-1240/loc_api_common_xdr.c | 1650 ----------------- .../libloc_api-rpc/gen-1240/loc_api_fixup.c | 48 - .../gen-1240/loc_api_rpc_glue.c | 339 ---- loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c | 171 -- loc_api/libloc_api-rpc/gen-3200/Makefile.xdr | 29 - loc_api/libloc_api-rpc/gen-3200/loc_api.xdr | 164 -- .../libloc_api-rpc/gen-3200/loc_api_cb.xdr | 90 - .../libloc_api-rpc/gen-3200/loc_api_cb_svc.c | 64 - .../libloc_api-rpc/gen-3200/loc_api_cb_xdr.c | 32 - .../libloc_api-rpc/gen-3200/loc_api_clnt.c | 82 - .../gen-3200/loc_api_common.xdr | 803 -------- .../gen-3200/loc_api_common_xdr.c | 1441 -------------- .../libloc_api-rpc/gen-3200/loc_api_fixup.c | 48 - .../gen-3200/loc_api_rpc_glue.c | 339 ---- loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c | 171 -- loc_api/libloc_api-rpc/inc-1240/loc_api.h | 210 --- loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h | 64 - .../libloc_api-rpc/inc-1240/loc_api_common.h | 1154 ------------ .../libloc_api-rpc/inc-1240/loc_api_fixup.h | 188 -- .../inc-1240/loc_apicb_appinit.h | 34 - loc_api/libloc_api-rpc/inc-3200/loc_api.h | 198 -- loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h | 64 - .../libloc_api-rpc/inc-3200/loc_api_common.h | 1031 ---------- .../libloc_api-rpc/inc-3200/loc_api_fixup.h | 188 -- .../inc-3200/loc_apicb_appinit.h | 34 - loc_api/libloc_api-rpc/inc/debug.h | 57 - loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h | 100 - .../libloc_api-rpc/src/loc_apicb_appinit.c | 61 - loc_api/libloc_api_50001/Android.mk | 11 +- loc_api/libloc_api_50001/LocEngAdapter.cpp | 346 +++- loc_api/libloc_api_50001/LocEngAdapter.h | 90 +- loc_api/libloc_api_50001/gps.c | 2 +- loc_api/libloc_api_50001/loc.cpp | 258 ++- loc_api/libloc_api_50001/loc.h | 2 +- loc_api/libloc_api_50001/loc_eng.cpp | 672 +++++-- loc_api/libloc_api_50001/loc_eng.h | 104 +- loc_api/libloc_api_50001/loc_eng_agps.cpp | 4 +- loc_api/libloc_api_50001/loc_eng_agps.h | 12 + loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp | 2 +- loc_api/libloc_api_50001/loc_eng_dmn_conn.h | 12 +- loc_api/libloc_api_50001/loc_eng_msg.h | 14 +- loc_api/libloc_api_50001/loc_eng_ni.cpp | 169 +- loc_api/libloc_api_50001/loc_eng_ni.h | 8 + loc_api/libloc_api_50001/loc_eng_nmea.cpp | 62 +- loc_api/libloc_api_50001/loc_eng_nmea.h | 3 +- loc_api/libloc_api_50001/loc_eng_xtra.cpp | 58 +- .../loc_pla/include/platform_lib_log_util.h | 52 +- utils/Android.mk | 33 +- utils/LocHeap.cpp | 354 ++++ utils/LocHeap.h | 96 + utils/LocSharedLock.h | 59 + utils/LocThread.cpp | 264 +++ utils/LocThread.h | 92 + utils/LocTimer.cpp | 737 ++++++++ utils/LocTimer.h | 74 + utils/MsgTask.cpp | 100 + {core => utils}/MsgTask.h | 49 +- utils/linked_list.c | 6 +- utils/loc_cfg.cpp | 462 +++-- utils/loc_cfg.h | 26 +- utils/loc_log.cpp | 82 +- utils/loc_log.h | 17 +- utils/loc_misc_utils.cpp | 114 ++ utils/loc_misc_utils.h | 99 + utils/loc_target.cpp | 62 +- utils/loc_target.h | 16 +- utils/loc_timer.c | 187 -- utils/loc_timer.h | 36 +- utils/msg_q.c | 8 +- .../elapsed_millis_since_boot.cpp | 46 + .../platform_lib_includes.h | 35 + .../platform_lib_macros.h | 81 + .../platform_lib_time.h | 35 + 100 files changed, 4840 insertions(+), 11538 deletions(-) create mode 100644 core/LocAdapterProxyBase.h delete mode 100644 core/MsgTask.cpp delete mode 100644 loc_api/NOTICE delete mode 100644 loc_api/libloc_api-rpc/Android.mk delete mode 100644 loc_api/libloc_api-rpc/gen-1240/Makefile.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c delete mode 100644 loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/Makefile.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c delete mode 100644 loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c delete mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api.h delete mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h delete mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api_common.h delete mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h delete mode 100644 loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h delete mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api.h delete mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h delete mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api_common.h delete mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h delete mode 100644 loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h delete mode 100644 loc_api/libloc_api-rpc/inc/debug.h delete mode 100644 loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h delete mode 100644 loc_api/libloc_api-rpc/src/loc_apicb_appinit.c create mode 100644 utils/LocHeap.cpp create mode 100644 utils/LocHeap.h create mode 100644 utils/LocSharedLock.h create mode 100644 utils/LocThread.cpp create mode 100644 utils/LocThread.h create mode 100644 utils/LocTimer.cpp create mode 100644 utils/LocTimer.h create mode 100644 utils/MsgTask.cpp rename {core => utils}/MsgTask.h (67%) create mode 100644 utils/loc_misc_utils.cpp create mode 100644 utils/loc_misc_utils.h delete mode 100644 utils/loc_timer.c create mode 100644 utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp create mode 100644 utils/platform_lib_abstractions/platform_lib_includes.h create mode 100644 utils/platform_lib_abstractions/platform_lib_macros.h create mode 100644 utils/platform_lib_abstractions/platform_lib_time.h diff --git a/core/Android.mk b/core/Android.mk index 11cecc65..c6d3128d 100644 --- a/core/Android.mk +++ b/core/Android.mk @@ -10,6 +10,12 @@ 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 \ @@ -17,7 +23,6 @@ LOCAL_SHARED_LIBRARIES := \ libdl LOCAL_SRC_FILES += \ - MsgTask.cpp \ LocApiBase.cpp \ LocAdapterBase.cpp \ ContextBase.cpp \ @@ -29,11 +34,11 @@ LOCAL_CFLAGS += \ -D_ANDROID_ LOCAL_C_INCLUDES:= \ - $(TARGET_OUT_HEADERS)/gps.utils + $(TARGET_OUT_HEADERS)/gps.utils \ + $(TARGET_OUT_HEADERS)/libflp LOCAL_COPY_HEADERS_TO:= libloc_core/ LOCAL_COPY_HEADERS:= \ - MsgTask.h \ LocApiBase.h \ LocAdapterBase.h \ ContextBase.h \ @@ -42,7 +47,8 @@ LOCAL_COPY_HEADERS:= \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ - loc_core_log.h + loc_core_log.h \ + LocAdapterProxyBase.h LOCAL_PRELINK_MODULE := false diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp index b2869bb9..58dc8a78 100644 --- a/core/ContextBase.cpp +++ b/core/ContextBase.cpp @@ -69,13 +69,28 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) // first if can not be MPQ if (TARGET_MPQ != loc_get_target()) { - if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask))) { - // only RPC is the option now - void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW); - if (NULL != handle) { + 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 (NULL != getter) { - locApi = (*getter)(mMsgTask, exMask); + 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); + } } } } @@ -84,7 +99,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask) // locApi could still be NULL at this time // we would then create a dummy one if (NULL == locApi) { - locApi = new LocApiBase(mMsgTask, exMask); + locApi = new LocApiBase(mMsgTask, exMask, this); } return locApi; diff --git a/core/ContextBase.h b/core/ContextBase.h index 85cbab7e..fe0b8606 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -56,12 +56,17 @@ public: inline const MsgTask* getMsgTask() { return mMsgTask; } inline LocApiBase* getLocApi() { return mLocApi; } inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; } - inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); } - inline bool hasCPIExt() { return mLBSProxy->hasCPIExt(); } + inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); } + inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); } + inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); } inline void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) { mLBSProxy->requestUlp(adapter, capabilities); } + inline IzatDevId_t getIzatDevId() const { + return mLBSProxy->getIzatDevId(); + } + inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); } }; } // namespace loc_core diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h index f0d1a329..0faf8012 100644 --- a/core/LBSProxyBase.h +++ b/core/LBSProxyBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* 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 @@ -35,12 +35,14 @@ 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) const { + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase* context) const { return NULL; } protected: @@ -49,8 +51,11 @@ public: inline virtual ~LBSProxyBase() {} inline virtual void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) const {} - inline virtual bool hasAgpsExt() const { return false; } - inline virtual bool hasCPIExt() const { return false; } + inline virtual bool hasAgpsExtendedCapabilities() const { return false; } + inline virtual bool hasCPIExtendedCapabilities() const { return false; } + inline virtual void modemPowerVote(bool power) const {} + virtual void injectFeatureConfig(ContextBase* context) const {} + inline virtual IzatDevId_t getIzatDevId() const { return 0; } }; typedef LBSProxyBase* (getLBSProxy_t)(); diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 054a295c..8fdb8cbb 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -32,7 +32,8 @@ #include #include #include -#include +#include +#include namespace loc_core { @@ -41,27 +42,45 @@ namespace loc_core { // 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) : + ContextBase* context, LocAdapterProxyBase *adapterProxyBase) : mEvtMask(mask), mContext(context), - mLocApi(context->getLocApi()), mMsgTask(context->getMsgTask()) + mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase), + mMsgTask(context->getMsgTask()) { mLocApi->addAdapter(this); } -void LocAdapterBase:: - handleEngineDownEvent() -DEFAULT_IMPL() +void LocAdapterBase::handleEngineUpEvent() +{ + if (mLocAdapterProxyBase) { + mLocAdapterProxyBase->handleEngineUpEvent(); + } +} + +void LocAdapterBase::handleEngineDownEvent() +{ + if (mLocAdapterProxyBase) { + mLocAdapterProxyBase->handleEngineDownEvent(); + } +} void LocAdapterBase:: reportPosition(UlpLocation &location, GpsLocationExtended &locationExtended, void* locationExt, enum loc_sess_status status, - LocPosTechMask loc_technology_mask) -DEFAULT_IMPL() + LocPosTechMask loc_technology_mask) { + if (mLocAdapterProxyBase == NULL || + !mLocAdapterProxyBase->reportPosition(location, + locationExtended, + status, + loc_technology_mask)) { + DEFAULT_IMPL() + } +} void LocAdapterBase:: - reportSv(GpsSvStatus &svStatus, + reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) DEFAULT_IMPL() @@ -116,4 +135,8 @@ DEFAULT_IMPL(false) bool LocAdapterBase:: requestNiNotify(GpsNiNotification ¬ify, const void* data) DEFAULT_IMPL(false) + +void LocAdapterBase:: + reportGpsMeasurementData(GpsData &gpsMeasurementData) +DEFAULT_IMPL() } // namespace loc_core diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 8222b24b..5f4660b8 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,19 +35,23 @@ namespace loc_core { +class LocAdapterProxyBase; + class LocAdapterBase { protected: - const LOC_API_ADAPTER_EVENT_MASK_T mEvtMask; + 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), mMsgTask(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); + ContextBase* context, LocAdapterProxyBase *adapterProxyBase = NULL); inline LOC_API_ADAPTER_EVENT_MASK_T checkMask(LOC_API_ADAPTER_EVENT_MASK_T mask) const { return mEvtMask & mask; @@ -65,10 +69,19 @@ public: mMsgTask->sendMsg(msg); } + inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event, + loc_registration_mask_status isEnabled) + { + mEvtMask = + isEnabled == LOC_REGISTRATION_MASK_ENABLED ? (mEvtMask|event):(mEvtMask&~event); + + mLocApi->updateEvtMask(); + } + // This will be overridden by the individual adapters // if necessary. inline virtual void setUlpProxy(UlpProxyBase* ulp) {} - inline virtual void handleEngineUpEvent() {} + virtual void handleEngineUpEvent(); virtual void handleEngineDownEvent(); inline virtual void setPositionModeInt(LocPosMode& posMode) {} virtual void startFixInt() {} @@ -79,7 +92,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GpsSvStatus &svStatus, + virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -97,6 +110,8 @@ public: virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data); inline virtual bool isInSession() { return false; } + ContextBase* getContext() const { return mContext; } + virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData); }; } // namespace loc_core diff --git a/core/LocAdapterProxyBase.h b/core/LocAdapterProxyBase.h new file mode 100644 index 00000000..1ddcca4c --- /dev/null +++ b/core/LocAdapterProxyBase.h @@ -0,0 +1,70 @@ +/* Copyright (c) 2014 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef LOC_ADAPTER_PROXY_BASE_H +#define LOC_ADAPTER_PROXY_BASE_H + +#include +#include + +namespace loc_core { + +class LocAdapterProxyBase { +private: + LocAdapterBase *mLocAdapterBase; +protected: + inline LocAdapterProxyBase(const LOC_API_ADAPTER_EVENT_MASK_T mask, + ContextBase* context): + mLocAdapterBase(new LocAdapterBase(mask, context, this)) { + } + inline virtual ~LocAdapterProxyBase() { + delete mLocAdapterBase; + } + ContextBase* getContext() const { + return mLocAdapterBase->getContext(); + } + inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event, + loc_registration_mask_status isEnabled) { + mLocAdapterBase->updateEvtMask(event,isEnabled); + } + +public: + inline virtual void handleEngineUpEvent() {}; + inline virtual void handleEngineDownEvent() {}; + inline virtual bool reportPosition(UlpLocation &location, + GpsLocationExtended &locationExtended, + enum loc_sess_status status, + LocPosTechMask loc_technology_mask) { + return false; + } +}; + +} // namespace loc_core + +#endif //LOC_ADAPTER_PROXY_BASE_H diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 3cd2ffa8..dcd35fec 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -32,7 +32,8 @@ #include #include #include -#include +#include +#include namespace loc_core { @@ -125,8 +126,10 @@ struct LocOpenMsg : public LocMsg { }; LocApiBase::LocApiBase(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T excludedMask) : - mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0) + LOC_API_ADAPTER_EVENT_MASK_T excludedMask, + ContextBase* context) : + mExcludedMask(excludedMask), mMsgTask(msgTask), + mMask(0), mSupportedMsg(0), mContext(context) { memset(mLocAdapters, 0, sizeof(mLocAdapters)); } @@ -201,11 +204,18 @@ void LocApiBase::removeAdapter(LocAdapterBase* adapter) } } +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()); } @@ -222,6 +232,17 @@ void LocApiBase::reportPosition(UlpLocation &location, 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, @@ -232,10 +253,24 @@ void LocApiBase::reportPosition(UlpLocation &location, ); } -void LocApiBase::reportSv(GpsSvStatus &svStatus, +void LocApiBase::reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { + // print the SV info before delivering + LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n gps/glo/bds in use" + " mask: %x/%x/%x\n sv: prn snr elevation azimuth", + svStatus.num_svs, svStatus.ephemeris_mask, + svStatus.almanac_mask, svStatus.gps_used_in_fix_mask, + svStatus.glo_used_in_fix_mask, svStatus.bds_used_in_fix_mask); + for (int i = 0; i < svStatus.num_svs && i < GPS_MAX_SVS; i++) { + LOC_LOGV(" %d: %d %f %f %f", + i, + svStatus.sv_list[i].prn, + svStatus.sv_list[i].snr, + svStatus.sv_list[i].elevation, + svStatus.sv_list[i].azimuth); + } // loop through adapters, and deliver to all adapters. TO_ALL_LOCADAPTERS( mLocAdapters[i]->reportSv(svStatus, @@ -318,12 +353,23 @@ void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data) TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data)); } +void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList) +{ + mSupportedMsg = supportedMsgList; +} + void* LocApiBase :: getSibling() DEFAULT_IMPL(NULL) LocApiProxyBase* LocApiBase :: getLocApiProxy() DEFAULT_IMPL(NULL) +void LocApiBase::reportGpsMeasurementData(GpsData &gpsMeasurementData) +{ + // loop through adapters, and deliver to all adapters. + TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGpsMeasurementData(gpsMeasurementData)); +} + enum loc_api_adapter_err LocApiBase:: open(LOC_API_ADAPTER_EVENT_MASK_T mask) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) @@ -404,7 +450,8 @@ enum loc_api_adapter_err LocApiBase:: DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: - setSensorControlConfig(int sensorUsage) + setSensorControlConfig(int sensorUsage, + int sensorProvider) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: @@ -442,12 +489,23 @@ enum loc_api_adapter_err LocApiBase:: DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: - getZppFix(GpsLocation & zppLoc) + getWwanZppFix(GpsLocation& zppLoc) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) enum loc_api_adapter_err LocApiBase:: - getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask) -DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) + 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() @@ -466,10 +524,30 @@ void LocApiBase:: DEFAULT_IMPL() int LocApiBase:: - setGpsLock(unsigned int lock) + setGpsLock(LOC_GPS_LOCK_MASK lock) DEFAULT_IMPL(-1) +void LocApiBase:: + installAGpsCert(const DerEncodedCertificate* pData, + size_t length, + uint32_t slotBitMask) +DEFAULT_IMPL() + int LocApiBase:: getGpsLock() DEFAULT_IMPL(-1) + +enum loc_api_adapter_err LocApiBase:: + setXtraVersionCheck(enum xtra_version_check check) +DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) + +int LocApiBase:: + updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, + loc_registration_mask_status isEnabled) +DEFAULT_IMPL(-1) + +bool LocApiBase:: + gnssConstellationConfig() +DEFAULT_IMPL(false) + } // namespace loc_core diff --git a/core/LocApiBase.h b/core/LocApiBase.h index c48927c4..5a2c56f0 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -36,6 +36,7 @@ #include namespace loc_core { +class ContextBase; int hexcode(char *hexstring, int string_size, const char *data, int data_size); @@ -52,6 +53,13 @@ int decodeAddress(char *addr_string, int string_size, #define TO_1ST_HANDLING_ADAPTER(adapters, call) \ for (int i = 0; i sendMsg(msg); + } + void addAdapter(LocAdapterBase* adapter); void removeAdapter(LocAdapterBase* adapter); @@ -99,7 +113,7 @@ public: enum loc_sess_status status, LocPosTechMask loc_technology_mask = LOC_POS_TECH_MASK_DEFAULT); - void reportSv(GpsSvStatus &svStatus, + void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); void reportStatus(GpsStatusValue status); @@ -115,6 +129,8 @@ public: void reportDataCallOpened(); void reportDataCallClosed(); void requestNiNotify(GpsNiNotification ¬ify, const void* data); + void saveSupportedMsgList(uint64_t supportedMsgList); + void reportGpsMeasurementData(GpsData &gpsMeasurementData); // downward calls // All below functions are to be defined by adapter specific modules: @@ -158,7 +174,7 @@ public: virtual enum loc_api_adapter_err setLPPConfig(uint32_t profile); virtual enum loc_api_adapter_err - setSensorControlConfig(int sensorUsage); + setSensorControlConfig(int sensorUsage, int sensorProvider); virtual enum loc_api_adapter_err setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk, @@ -186,15 +202,28 @@ public: virtual enum loc_api_adapter_err setAGLONASSProtocol(unsigned long aGlonassProtocol); virtual enum loc_api_adapter_err - getZppFix(GpsLocation & zppLoc); + getWwanZppFix(GpsLocation & zppLoc); virtual enum loc_api_adapter_err - getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask); + getBestAvailableZppFix(GpsLocation & zppLoc); + virtual enum loc_api_adapter_err + getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask); virtual int initDataServiceClient(); virtual int openAndStartDataCall(); virtual void stopDataCall(); virtual void closeDataCall(); - + virtual void installAGpsCert(const DerEncodedCertificate* pData, + size_t length, + uint32_t slotBitMask); inline virtual void setInSession(bool inSession) {} + inline bool isMessageSupported (LocCheckingMessagesID msgID) const { + if (msgID > (sizeof(mSupportedMsg) << 3)) { + return false; + } else { + uint32_t messageChecker = 1 << msgID; + return (messageChecker & mSupportedMsg) == messageChecker; + } + } + void updateEvtMask(); /*Values for lock 1 = Do not lock any position sessions @@ -202,17 +231,30 @@ public: 3 = Lock MT position sessions 4 = Lock all position sessions */ - virtual int setGpsLock(unsigned int lock); + virtual int setGpsLock(LOC_GPS_LOCK_MASK lock); /* Returns Current value of GPS Lock on success -1 on failure */ virtual int getGpsLock(void); + + virtual enum loc_api_adapter_err setXtraVersionCheck(enum xtra_version_check check); + + /* + Update gps reporting events + */ + virtual int updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, + loc_registration_mask_status isEnabled); + /* + Check if the modem support the service + */ + virtual bool gnssConstellationConfig(); }; typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask); + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase *context); } // namespace loc_core diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index b4eaf7ff..b5f33ac3 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -49,86 +49,97 @@ LocDualContext::mBgExclMask = 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_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::mIzatLibName = "liblbs_core.so"; -#else -const char* LocDualContext::mIzatLibName = "liblbs_core.so.1"; -#endif +const char* LocDualContext::mLBSLibName = "liblbs_core.so"; -const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator, - const char* name) +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); + mMsgTask = new MsgTask(tCreator, name, joinable); } return mMsgTask; } -const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate, - const char* name) -{ - if (NULL == mMsgTask) { - mMsgTask = new MsgTask(tAssociate, name); - } - return mMsgTask; +inline +const MsgTask* LocDualContext::getMsgTask(const char* name, bool joinable) { + return getMsgTask((LocThread::tCreate)NULL, name, joinable); } -ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator, - const char* name) +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) { - const MsgTask* msgTask = getMsgTask(tCreator, name); + 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::getLocFgContext(MsgTask::tAssociate tAssociate, - const char* name) -{ - if (NULL == mFgContext) { - const MsgTask* msgTask = getMsgTask(tAssociate, name); - mFgContext = new LocDualContext(msgTask, - mFgExclMask); - } - return mFgContext; - -} - -ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator, - const char* name) +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) { - const MsgTask* msgTask = getMsgTask(tCreator, name); + 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; } -ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate, - const char* name) +void LocDualContext :: injectFeatureConfig(ContextBase *curContext) { - if (NULL == mBgContext) { - const MsgTask* msgTask = getMsgTask(tAssociate, name); - mBgContext = new LocDualContext(msgTask, - mBgExclMask); + 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); } - return mBgContext; + LOC_LOGD("%s:%d]: Exit", __func__, __LINE__); } LocDualContext::LocDualContext(const MsgTask* msgTask, LOC_API_ADAPTER_EVENT_MASK_T exMask) : - ContextBase(msgTask, exMask, mIzatLibName) + ContextBase(msgTask, exMask, mLBSLibName) { } diff --git a/core/LocDualContext.h b/core/LocDualContext.h index e761e764..ce77a1aa 100644 --- a/core/LocDualContext.h +++ b/core/LocDualContext.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -40,11 +40,11 @@ class LocDualContext : public ContextBase { static const MsgTask* mMsgTask; static ContextBase* mFgContext; static ContextBase* mBgContext; - - static const MsgTask* getMsgTask(MsgTask::tCreate tCreator, - const char* name); - static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate, - const char* name); + 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, @@ -52,19 +52,23 @@ protected: inline virtual ~LocDualContext() {} public: - static const char* mIzatLibName; + static const char* mLBSLibName; static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask; static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask; static const char* mLocationHalName; - static ContextBase* getLocFgContext(MsgTask::tCreate tCreator, - const char* name); - static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate, - const char* name); - static ContextBase* getLocBgContext(MsgTask::tCreate tCreator, - const char* name); - static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate, - const char* name); + static 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); }; } diff --git a/core/MsgTask.cpp b/core/MsgTask.cpp deleted file mode 100644 index df6db808..00000000 --- a/core/MsgTask.cpp +++ /dev/null @@ -1,131 +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_MsgTask" - -#include -#include -#include -#include -#include - -namespace loc_core { - -#define MAX_TASK_COMM_LEN 15 - -static void LocMsgDestroy(void* msg) { - delete (LocMsg*)msg; -} - -MsgTask::MsgTask(tCreate tCreator, const char* threadName) : - mQ(msg_q_init2()), mAssociator(NULL){ - if (tCreator) { - tCreator(threadName, loopMain, - (void*)new MsgTask(mQ, mAssociator)); - } else { - createPThread(threadName); - } -} - -MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) : - mQ(msg_q_init2()), mAssociator(tAssociator){ - createPThread(threadName); -} - -inline -MsgTask::MsgTask(const void* q, tAssociate associator) : - mQ(q), mAssociator(associator){ -} - -MsgTask::~MsgTask() { - msg_q_unblock((void*)mQ); -} - -void MsgTask::createPThread(const char* threadName) { - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - pthread_t tid; - // create the thread here, then if successful - // and a name is given, we set the thread name - if (!pthread_create(&tid, &attr, loopMain, - (void*)new MsgTask(mQ, mAssociator)) && - NULL != threadName) { - char lname[MAX_TASK_COMM_LEN+1]; - memcpy(lname, threadName, MAX_TASK_COMM_LEN); - lname[MAX_TASK_COMM_LEN] = 0; - pthread_setname_np(tid, lname); - } -} - -void MsgTask::sendMsg(const LocMsg* msg) const { - msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy); -} - -void* MsgTask::loopMain(void* arg) { - MsgTask* copy = (MsgTask*)arg; - - // make sure we do not run in background scheduling group - platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); - - if (NULL != copy->mAssociator) { - copy->mAssociator(); - } - - LocMsg* msg; - int cnt = 0; - - while (1) { - LOC_LOGD("MsgTask::loop() %d listening ...\n", cnt++); - - msq_q_err_type result = msg_q_rcv((void*)copy->mQ, (void **)&msg); - - if (eMSG_Q_SUCCESS != result) { - LOC_LOGE("%s:%d] fail receiving msg: %s\n", __func__, __LINE__, - loc_get_msg_q_status(result)); - // destroy the Q and exit - msg_q_destroy((void**)&(copy->mQ)); - delete copy; - return NULL; - } - - msg->log(); - // there is where each individual msg handling is invoked - msg->proc(); - - delete msg; - } - - delete copy; - - return NULL; -} - -} diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 90097571..59e265e8 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* 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 @@ -30,6 +30,7 @@ #define ULP_PROXY_BASE_H #include +#include "fused_location_extended.h" namespace loc_core { @@ -50,6 +51,7 @@ public: mPosMode = params; return false; } + inline virtual bool reportPosition(UlpLocation &location, GpsLocationExtended &locationExtended, void* locationExt, @@ -57,7 +59,7 @@ public: LocPosTechMask loc_technology_mask) { return false; } - inline virtual bool reportSv(GpsSvStatus &svStatus, + inline virtual bool reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { return false; @@ -67,6 +69,14 @@ public: } inline virtual void setAdapter(LocAdapterBase* adapter) {} inline virtual void setCapabilities(unsigned long capabilities) {} + inline virtual bool reportBatchingSession(FlpExtBatchOptions &options, + bool active) { + return false; + } + inline virtual bool reportPositions(const FlpExtLocation* locations, + int32_t number_of_locations) { + return false; + } }; } // namespace loc_core diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index f8e540fb..e37ff482 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -31,6 +31,8 @@ #include #include +#include +#include #include /** @@ -60,15 +62,31 @@ extern "C" { /** Position source is ULP */ #define ULP_LOCATION_IS_FROM_HYBRID 0x0001 /** Position source is GNSS only */ -#define ULP_LOCATION_IS_FROM_GNSS 0x0002 +#define ULP_LOCATION_IS_FROM_GNSS 0x0002 /** Position source is ZPP only */ -#define ULP_LOCATION_IS_FROM_ZPP 0x0004 +#define ULP_LOCATION_IS_FROM_ZPP 0x0004 +/** Position is from a Geofence Breach Event */ +#define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008 +/** Position is from Hardware FLP */ +#define ULP_LOCATION_IS_FROM_HW_FLP 0x0010 +/** Position is from NLP */ +#define ULP_LOCATION_IS_FROM_NLP 0x0020 +/** Position is from PIP */ +#define ULP_LOCATION_IS_FROM_PIP 0x0040 #define ULP_MIN_INTERVAL_INVALID 0xffffffff /*Emergency SUPL*/ #define GPS_NI_TYPE_EMERGENCY_SUPL 4 +#define AGPS_CERTIFICATE_MAX_LENGTH 2000 +#define AGPS_CERTIFICATE_MAX_SLOTS 10 + +enum loc_registration_mask_status { + LOC_REGISTRATION_MASK_ENABLED, + LOC_REGISTRATION_MASK_DISABLED +}; + typedef struct { /** set to sizeof(UlpLocation) */ size_t size; @@ -135,7 +153,7 @@ typedef struct { AGpsExtType type; AGpsStatusValue status; uint32_t ipv4_addr; - char ipv6_addr[16]; + struct sockaddr_storage addr; char ssid[SSID_BUF_SIZE]; char password[SSID_BUF_SIZE]; } AGpsExtStatus; @@ -201,22 +219,6 @@ typedef enum loc_position_mode_type { */ #define GPS_DEFAULT_FIX_INTERVAL_MS 1000 -/** GpsLocationExtended has valid latitude and longitude. */ -#define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0) -/** GpsLocationExtended has valid altitude. */ -#define GPS_LOCATION_EXTENDED_HAS_ALTITUDE (1U<<1) -/** GpsLocationExtended has valid speed. */ -#define GPS_LOCATION_EXTENDED_HAS_SPEED (1U<<2) -/** GpsLocationExtended has valid bearing. */ -#define GPS_LOCATION_EXTENDED_HAS_BEARING (1U<<4) -/** GpsLocationExtended has valid accuracy. */ -#define GPS_LOCATION_EXTENDED_HAS_ACCURACY (1U<<8) - -/** GPS extended supports geofencing */ -#define GPS_EXTENDED_CAPABILITY_GEOFENCE 0x0000001 -/** GPS extended supports batching */ -#define GPS_EXTENDED_CAPABILITY_BATCHING 0x0000002 - /** Flags to indicate which values are valid in a GpsLocationExtended. */ typedef uint16_t GpsLocationExtendedFlags; /** GpsLocationExtended has valid pdop, hdop, vdop. */ @@ -231,6 +233,20 @@ typedef uint16_t GpsLocationExtendedFlags; #define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010 /** GpsLocationExtended has valid speed uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020 +/** GpsLocationExtended has valid heading uncertainty */ +#define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040 +/** GpsLocationExtended has valid horizontal reliability */ +#define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080 +/** GpsLocationExtended has valid vertical reliability */ +#define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100 + +typedef enum { + LOC_RELIABILITY_NOT_SET = 0, + LOC_RELIABILITY_VERY_LOW = 1, + LOC_RELIABILITY_LOW = 2, + LOC_RELIABILITY_MEDIUM = 3, + LOC_RELIABILITY_HIGH = 4 +}LocReliability; /** Represents gps location extended. */ typedef struct { @@ -252,8 +268,55 @@ typedef struct { float vert_unc; /** speed uncertainty in m/s */ float speed_unc; + /** heading uncertainty in degrees (0 to 359.999) */ + float bearing_unc; + /** horizontal reliability. */ + LocReliability horizontal_reliability; + /** vertical reliability. */ + LocReliability vertical_reliability; } GpsLocationExtended; +/** Represents SV status. */ +typedef struct { + /** set to sizeof(GnssSvStatus) */ + size_t size; + + /** Number of SVs currently visible. */ + int num_svs; + + /** Contains an array of SV information. */ + GpsSvInfo sv_list[GPS_MAX_SVS]; + + /** Represents a bit mask indicating which SVs + * have ephemeris data. + */ + uint32_t ephemeris_mask; + + /** Represents a bit mask indicating which SVs + * have almanac data. + */ + uint32_t almanac_mask; + + /** + * Represents a bit mask indicating which GPS SVs + * were used for computing the most recent position fix. + */ + uint32_t gps_used_in_fix_mask; + + /** + * Represents a bit mask indicating which GLONASS SVs + * were used for computing the most recent position fix. + */ + uint32_t glo_used_in_fix_mask; + + /** + * Represents a bit mask indicating which BDS SVs + * were used for computing the most recent position fix. + */ + uint64_t bds_used_in_fix_mask; + +} GnssSvStatus; + enum loc_sess_status { LOC_SESS_SUCCESS, LOC_SESS_INTERMEDIATE, @@ -302,66 +365,95 @@ enum loc_api_adapter_err { LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7, LOC_API_ADAPTER_ERR_TIMEOUT = 8, LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9, + LOC_API_ADAPTER_ERR_INTERNAL = 10, - LOC_API_ADAPTER_ERR_ENGINE_DOWN = 100, - LOC_API_ADAPTER_ERR_FAILURE, + /* 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_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type + LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report + LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate + LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate + LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request + LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request + LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server + LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl + LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state + LOC_API_ADAPTER_REQUEST_WIFI, // + LOC_API_ADAPTER_SENSOR_STATUS, // + LOC_API_ADAPTER_REQUEST_TIME_SYNC, // + LOC_API_ADAPTER_REPORT_SPI, // + LOC_API_ADAPTER_REPORT_NI_GEOFENCE, // + LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, // + LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, // + LOC_API_ADAPTER_PEDOMETER_CTRL, // + LOC_API_ADAPTER_MOTION_CTRL, // + LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data + LOC_API_ADAPTER_BATCH_FULL, // Batching on full + LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix + LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // + LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request + LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request + LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report + LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request + LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report LOC_API_ADAPTER_EVENT_MAX }; -#define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) && - (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL)) + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) { location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED; - location.gpsLocation.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal + - location_report_ptr->speed_vertical * location_report_ptr->speed_vertical); + location.gpsLocation.speed = location_report_ptr->speed_horizontal; } // Heading @@ -783,7 +796,7 @@ void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_re void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) { - GpsSvStatus SvStatus = {0}; + GnssSvStatus SvStatus = {0}; GpsLocationExtended locationExtended = {0}; locationExtended.size = sizeof(locationExtended); int num_svs_max = 0; @@ -809,7 +822,7 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) { if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS) { - SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus); + SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo); SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn; // We only have the data field to report gps eph and alm mask @@ -828,7 +841,7 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) { - SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); } } // SBAS: GPS RPN: 120-151, @@ -841,6 +854,12 @@ void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) // In extended measurement report, we follow nmea standard, which is 65-96 else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS) { + if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && + (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) + { + SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + } + SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1); } // Unsupported SV system @@ -1387,8 +1406,9 @@ GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding) } LocApiBase* getLocApi(const MsgTask* msgTask, - LOC_API_ADAPTER_EVENT_MASK_T exMask) { - return new LocApiRpc(msgTask, exMask); + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase *context) { + return new LocApiRpc(msgTask, exMask, context); } /*Values for lock @@ -1397,12 +1417,12 @@ LocApiBase* getLocApi(const MsgTask* msgTask, 3 = Lock MT position sessions 4 = Lock all position sessions */ -int LocApiRpc::setGpsLock(unsigned int lock) +int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask) { rpc_loc_ioctl_data_u_type ioctl_data; boolean ret_val; - LOC_LOGD("%s:%d]: lock: %d\n", __func__, __LINE__, lock); - ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = (rpc_loc_lock_e_type)lock; + LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask); + ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask); ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK; ret_val = loc_eng_ioctl (loc_eng_data.client_handle, RPC_LOC_IOCTL_SET_ENGINE_LOCK, diff --git a/loc_api/libloc_api-rpc/Android.mk b/loc_api/libloc_api-rpc/Android.mk deleted file mode 100644 index 06e46948..00000000 --- a/loc_api/libloc_api-rpc/Android.mk +++ /dev/null @@ -1,61 +0,0 @@ -ifneq ($(BUILD_TINY_ANDROID),true) - -ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001) - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -AMSS_VERSION:=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION) -RPC_INC:=inc-$(AMSS_VERSION) - -generated_files:= \ - gen-$(AMSS_VERSION)/loc_api_clnt.c \ - gen-$(AMSS_VERSION)/loc_api_cb_xdr.c \ - gen-$(AMSS_VERSION)/loc_api_common_xdr.c \ - gen-$(AMSS_VERSION)/loc_api_cb_svc.c \ - gen-$(AMSS_VERSION)/loc_api_xdr.c \ - gen-$(AMSS_VERSION)/loc_api_fixup.c \ - gen-$(AMSS_VERSION)/loc_api_rpc_glue.c \ - src/loc_apicb_appinit.c - -LOCAL_SRC_FILES:= $(generated_files) - -# removed from library build since the client should implement this code. -# src/loc_api_cb_server.c - -LOCAL_CFLAGS:=-fno-short-enums -LOCAL_CFLAGS+=-include $(RPC_INC)/loc_api_common.h -LOCAL_CFLAGS+=-DDEBUG -# LOCAL_CFLAGS+=-DDEBUG -DVERBOSE - -LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL - -LOCAL_SHARED_LIBRARIES:= librpc -LOCAL_STATIC_LIBRARIES:= libcommondefs-rpc - - - -LOCAL_COPY_HEADERS_TO:= libloc_api-rpc/inc -LOCAL_COPY_HEADERS:= \ - $(RPC_INC)/loc_api_cb.h \ - $(RPC_INC)/loc_api_common.h \ - $(RPC_INC)/loc_api.h \ - $(RPC_INC)/loc_api_fixup.h \ - $(RPC_INC)/loc_apicb_appinit.h \ - inc/debug.h \ - inc/loc_api_rpc_glue.h - -LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/inc \ - $(LOCAL_PATH)/$(RPC_INC) \ - $(TARGET_OUT_HEADERS)/libcommondefs-rpc \ - $(TARGET_OUT_HEADERS)/librpc - -LOCAL_MODULE:= libloc_api-rpc -LOCAL_MODULE_OWNER := qcom - -include $(BUILD_STATIC_LIBRARY) - -endif -endif diff --git a/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr b/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr deleted file mode 100644 index 5d9cf6c8..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/Makefile.xdr +++ /dev/null @@ -1,29 +0,0 @@ -CLIENTS:= loc_api -SERVERS:= loc_api_cb -COMMON:= loc_api_common -RPC_INC:= inc-$(AMSS_VERSION) - -all: $(CLIENTS) $(SERVERS) $(COMMON) fixup - -$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr) - -$(CLIENTS) $(SERVERS) $(COMMON):: - rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@) - rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@) - -$(CLIENTS):: - rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@) - -$(SERVERS):: - rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@) - -fixup: - mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak - sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include ../$(RPC_INC)/loc_api_common.h - rm -f ../$(RPC_INC)/loc_api_common.h.bak - -clean: - rm -f $(addsuffix _clnt.c, $(CLIENTS)) - rm -f $(addsuffix _svc.c, $(SERVERS)) - rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON)) - rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON))) diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr deleted file mode 100644 index a9d60aa4..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api.xdr +++ /dev/null @@ -1,172 +0,0 @@ -/* LOC_API TOOL VERSION: 4.36 */ -/*============================================================================= - L O C _ A P I . X D R - -GENERAL DESCRIPTION - This is an AUTO GENERATED file that provides an xdr compatible definition of - the loc_api API. - - --------------------------------------------------------------------------- - Copyright (c) 2010 QUALCOMM Incorporated. - All Rights Reserved. QUALCOMM Proprietary and Confidential. - --------------------------------------------------------------------------- -=============================================================================*/ - -/*============================================================================= - - Edit History - - AUTO GENERATED - -Generated by following versions of Htorpc modules: -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3 - -loc_api Definition File(s): -Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16 -=============================================================================*/ -/*============================================================================= -$Header$ -=============================================================================*/ - - - -typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>; - -/* - * Declare an rpc_uint32 type for each callback type in the API - */ -typedef rpc_uint32 rpc_loc_event_cb_f_type; - - - -/* - * These are struct declarations for the function arguments - */ - -struct rpc_loc_open_args { - rpc_loc_event_mask_type event_reg_mask; - rpc_loc_event_cb_f_type event_callback; -}; - -struct rpc_loc_close_args { - rpc_loc_client_handle_type handle; -}; - -struct rpc_loc_start_fix_args { - rpc_loc_client_handle_type handle; -}; - -struct rpc_loc_stop_fix_args { - rpc_loc_client_handle_type handle; -}; - -struct rpc_loc_ioctl_args { - rpc_loc_client_handle_type handle; - rpc_loc_ioctl_e_type ioctl_type; - rpc_loc_ioctl_data_u_type *ioctl_data; -}; - - - -struct rpc_loc_api_api_version_s_args { - rpc_boolean len_not_null; -}; - -/* - * These are struct declarations for the function results - */ - -struct rpc_loc_api_rpc_glue_code_info_remote_rets { - rpc_uint32 toolvers; /* Tool version */ - rpc_uint32 features; /* Features turned on in the code. - * 0x00000001 ONCRPC Server Cleanup Support - */ - rpc_uint32 proghash; /* Unique hash value for the API XDR definition */ - rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */ -}; - -struct rpc_loc_open_rets { - rpc_loc_client_handle_type loc_open_result; -}; - -struct rpc_loc_close_rets { - rpc_int32 loc_close_result; -}; - -struct rpc_loc_start_fix_rets { - rpc_int32 loc_start_fix_result; -}; - -struct rpc_loc_stop_fix_rets { - rpc_int32 loc_stop_fix_result; -}; - -struct rpc_loc_ioctl_rets { - rpc_int32 loc_ioctl_result; -}; - - struct rpc_loc_api_api_versions_rets { - rpc_loc_api_api_versions_return_type loc_api_api_versions_result; - rpc_uint32 *len; -}; - -/* - * XDR definition of the LOC_API program ( vers. 0x00040002 ) - */ - -program LOC_APIPROG { - version LOC_APIVERS_0001 { - - void - rpc_loc_api_null( void ) = 0; - - rpc_loc_api_rpc_glue_code_info_remote_rets - rpc_loc_api_rpc_glue_code_info_remote( void ) = 1; - - rpc_loc_open_rets - rpc_loc_open( rpc_loc_open_args ) = 2; - - rpc_loc_close_rets - rpc_loc_close( rpc_loc_close_args ) = 3; - - rpc_loc_start_fix_rets - rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4; - - rpc_loc_stop_fix_rets - rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5; - - rpc_loc_ioctl_rets - rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6; - - rpc_loc_api_api_versions_rets - rpc_loc_api_api_versions( void ) = 0xFFFFFFFF; - - - - - } = 0x00040001; - - - - version LOC_APIVERS_0002 { - -/* Following elements added in enum rpc_loc_ni_event_e_type in 0x00040002 -RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ -*/ - - void - rpc_loc_api_null( void ) = 0; - - } = 0x00040002; - - -} = 0x3000008c; - -const LOC_APIVERS = 0x00040002; diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr deleted file mode 100644 index 1bd4e151..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb.xdr +++ /dev/null @@ -1,85 +0,0 @@ -/* LOC_API TOOL VERSION: 4.36 */ -/*============================================================================= - L O C _ A P I _ C B . X D R - -GENERAL DESCRIPTION - This is an AUTO GENERATED file that provides an xdr compatible definition of - an api that represents the grouping of the different callback functions the - loc_api API supports. - - --------------------------------------------------------------------------- - Copyright (c) 2010 QUALCOMM Incorporated. - All Rights Reserved. QUALCOMM Proprietary and Confidential. - --------------------------------------------------------------------------- -=============================================================================*/ - -/*============================================================================= - - Edit History - - AUTO GENERATED - -Generated by following versions of Htorpc modules: -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3 - -loc_api Definition File(s): -Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16 -=============================================================================*/ -/*============================================================================= -$Header$ -=============================================================================*/ - - - - -/* - * These are struct declarations for the function arguments - */ - -struct rpc_loc_event_cb_f_type_args { - rpc_uint32 cb_id; - rpc_loc_client_handle_type loc_handle; - rpc_loc_event_mask_type loc_event; - rpc_loc_event_payload_u_type *loc_event_payload; -}; - - - - - -/* - * These are struct declaratios for the function results - */ - -struct rpc_loc_event_cb_f_type_rets { - rpc_int32 loc_event_cb_f_type_result; -}; - - - -/* - * XDR definition of the LOC_API callback program ( vers. 0x00040002 ) - */ - -program LOC_APICBPROG { - version LOC_APICBVERS_0001 { - - rpc_loc_event_cb_f_type_rets - rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1; - - - - - } = 0x00040001; - - -} = 0x3100008c; - -const LOC_APICBVERS = 0x00040002; diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c deleted file mode 100644 index 52a0d15b..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_svc.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api_cb.h" -#include -#include -#include -#include -#include -#include -#include - -#ifndef SIG_PF -#define SIG_PF void(*)(int) -#endif - -void -loc_apicbprog_0x00040001(struct svc_req *rqstp, register SVCXPRT *transp) -{ - union { - rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00040001_arg; - } argument; - union { - rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00040001_res; - } result; - bool_t retval; - xdrproc_t _xdr_argument, _xdr_result; - bool_t (*local)(char *, void *, struct svc_req *); - - switch (rqstp->rq_proc) { - case NULLPROC: - (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); - return; - - case rpc_loc_event_cb_f_type: - _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args; - _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets; - local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00040001_svc; - break; - - default: - svcerr_noproc (transp); - return; - } - memset ((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { - svcerr_decode (transp); - return; - } - retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); - if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { - svcerr_systemerr (transp); - } - if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { - fprintf (stderr, "%s", "unable to free arguments"); - exit (1); - } - if (!loc_apicbprog_0x00040001_freeresult (transp, _xdr_result, (caddr_t) &result)) - fprintf (stderr, "%s", "unable to free results"); - - return; -} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c deleted file mode 100644 index 1d7795ed..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_cb_xdr.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api_cb.h" - -bool_t -xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->cb_id)) - return FALSE; - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle)) - return FALSE; - if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event)) - return FALSE; - if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result)) - return FALSE; - return TRUE; -} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c deleted file mode 100644 index dca1e8d5..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_clnt.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include /* for memset */ -#include "loc_api.h" - -/* Default timeout can be changed using clnt_control() */ -static struct timeval TIMEOUT = { 25, 0 }; - -enum clnt_stat -rpc_loc_api_null_0x00040001(void *argp, void *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_null, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_open_0x00040001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_open, - (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_close_0x00040001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_close, - (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_start_fix, - (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_stop_fix, - (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_ioctl, - (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_api_api_versions_0x00040001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_api_versions, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_api_null_0x00040002(void *argp, void *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_null, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); -} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr deleted file mode 100644 index 4e01607d..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_common.xdr +++ /dev/null @@ -1,906 +0,0 @@ -/* LOC_API TOOL VERSION: 4.36 */ -/*============================================================================= - L O C _ A P I _ C O M M O N . X D R - -GENERAL DESCRIPTION - This is an AUTO GENERATED file that provides an xdr compatible definition of - an api that represents the grouping of the different callback functions the - loc_api API supports. - - --------------------------------------------------------------------------- - Copyright (c) 2010 QUALCOMM Incorporated. - All Rights Reserved. QUALCOMM Proprietary and Confidential. - --------------------------------------------------------------------------- -=============================================================================*/ - -/*============================================================================= - - Edit History - - AUTO GENERATED - -Generated by following versions of Htorpc modules: -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/htorpc.pl#20 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#3 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#7 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#29 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#2 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#6 -Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#3 - -loc_api Definition File(s): -Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#16 -=============================================================================*/ -/*============================================================================= -$Header$ -=============================================================================*/ - - - -const LOC_API_TOOLVERS = 0x00040024; -const LOC_API_FEATURES = 0x00000001; - -const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010; - -const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200; - -const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080; - -const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040; - -const RPC_LOC_EVENT_RESERVED = 0x8000000000000000; - -const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001; - -const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020; - -const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008; - -const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002; - -const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100; - -const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00040001; -const RPC_LOC_OPEN_VERSION = 0x00040001; -const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00040001; -const RPC_LOC_API_NULL_VERSION = 0x00040001; -const RPC_LOC_STOP_FIX_VERSION = 0x00040001; -const RPC_LOC_IOCTL_VERSION = 0x00040001; -const RPC_LOC_START_FIX_VERSION = 0x00040001; -const RPC_LOC_CLOSE_VERSION = 0x00040001; -const RPC_LOC_API_API_VERSIONS_VERSION = 0x00040001; -const RPC_LOC_API_API_MAJOR_NUM = 0x0004; -const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0; - -typedef bool rpc_boolean; - -typedef unsigned long rpc_uint32; - -typedef unsigned short rpc_uint16; - -typedef unsigned char rpc_uint8; - -typedef long rpc_int32; - -typedef unsigned char rpc_byte; - -typedef unsigned hyper rpc_uint64; - -typedef rpc_int32 rpc_loc_client_handle_type; - -typedef rpc_uint64 rpc_loc_event_mask_type; - -typedef rpc_uint64 rpc_loc_position_valid_mask_type; - -typedef rpc_uint32 rpc_loc_pos_technology_mask_type; - -enum rpc_loc_session_status_e_type { - RPC_LOC_SESS_STATUS_SUCCESS = 0, - RPC_LOC_SESS_STATUS_IN_PROGESS = 1, - RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, - RPC_LOC_SESS_STATUS_TIMEOUT = 3, - RPC_LOC_SESS_STATUS_USER_END = 4, - RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, - RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, - RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, - RPC_LOC_SESS_STATUS_MAX = 268435456 -}; - -struct rpc_loc_calendar_time_s_type { - rpc_uint16 year; - unsigned char month; - unsigned char day_of_week; - unsigned char day; - unsigned char hour; - unsigned char minute; - unsigned char second; - rpc_uint16 millisecond; -}; - -struct rpc_loc_parsed_position_s_type { - rpc_loc_position_valid_mask_type valid_mask; - rpc_loc_session_status_e_type session_status; - rpc_loc_calendar_time_s_type timestamp_calendar; - rpc_uint64 timestamp_utc; - rpc_uint8 leap_seconds; - float time_unc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float speed_horizontal; - float speed_vertical; - float heading; - float hor_unc_circular; - float hor_unc_ellipse_semi_major; - float hor_unc_ellipse_semi_minor; - float hor_unc_ellipse_orient_azimuth; - float vert_unc; - float speed_unc; - float heading_unc; - unsigned char confidence_horizontal; - unsigned char confidence_vertical; - float magnetic_deviation; - rpc_loc_pos_technology_mask_type technology_mask; -}; - -enum rpc_loc_sv_system_e_type { - RPC_LOC_SV_SYSTEM_GPS = 1, - RPC_LOC_SV_SYSTEM_GALILEO = 2, - RPC_LOC_SV_SYSTEM_SBAS = 3, - RPC_LOC_SV_SYSTEM_COMPASS = 4, - RPC_LOC_SV_SYSTEM_GLONASS = 5, - RPC_LOC_SV_SYSTEM_MAX = 268435456 -}; - -enum rpc_loc_sv_status_e_type { - RPC_LOC_SV_STATUS_IDLE = 1, - RPC_LOC_SV_STATUS_SEARCH = 2, - RPC_LOC_SV_STATUS_TRACK = 3, - RPC_LOC_SV_STATUS_MAX = 268435456 -}; - -typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; - -struct rpc_loc_sv_info_s_type { - rpc_loc_sv_info_valid_mask_type valid_mask; - rpc_loc_sv_system_e_type system; - rpc_uint8 prn; - rpc_uint8 health_status; - rpc_loc_sv_status_e_type process_status; - rpc_boolean has_eph; - rpc_boolean has_alm; - float elevation; - float azimuth; - float snr; -}; - -typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; - -struct rpc_loc_gnss_info_s_type { - rpc_loc_gnss_info_valid_mask_type valid_mask; - float position_dop; - float horizontal_dop; - float vertical_dop; - rpc_boolean altitude_assumed; - rpc_uint16 sv_count; - rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/ -}; - -struct rpc_loc_nmea_report_s_type { - rpc_uint16 length; - opaque nmea_sentences[1200]; /* EVAL:[1200]*/ -}; - -enum rpc_loc_status_event_e_type { - RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, - RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2, - RPC_LOC_STATUS_EVENT_MAX = 268435456 -}; - -enum rpc_loc_engine_state_e_type { - RPC_LOC_ENGINE_STATE_ON = 1, - RPC_LOC_ENGINE_STATE_OFF = 2, - RPC_LOC_ENGINE_STATE_MAX = 268435456 -}; - -enum rpc_loc_fix_session_state_e_type { - RPC_LOC_FIX_SESSION_STATE_BEGIN = 1, - RPC_LOC_FIX_SESSION_STATE_END = 2, - RPC_LOC_FIX_SESSION_STATE_MAX = 268435456 -}; - -union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) { - case RPC_LOC_STATUS_EVENT_ENGINE_STATE: - rpc_loc_engine_state_e_type engine_state; - case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: - rpc_loc_fix_session_state_e_type fix_session_state; - default: - void; -}; - -struct rpc_loc_status_event_s_type { - rpc_loc_status_event_e_type event; - rpc_loc_status_event_payload_u_type payload; -}; - -enum rpc_loc_server_addr_e_type { - RPC_LOC_SERVER_ADDR_IPV4 = 1, - RPC_LOC_SERVER_ADDR_URL = 2, - RPC_LOC_SERVER_ADDR_MAX = 268435456 -}; - -struct rpc_loc_server_addr_ipv4_type { - rpc_uint32 addr; - rpc_uint16 port; -}; - -struct rpc_loc_server_addr_url_type { - rpc_uint16 length; - opaque addr[256]; /* EVAL:[256]*/ -}; - -union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) { - case RPC_LOC_SERVER_ADDR_IPV4: - rpc_loc_server_addr_ipv4_type ipv4; - case RPC_LOC_SERVER_ADDR_URL: - rpc_loc_server_addr_url_type url; - default: - void; -}; - -struct rpc_loc_server_info_s_type { - rpc_loc_server_addr_e_type addr_type; - rpc_loc_server_addr_u_type addr_info; -}; - -enum rpc_loc_ni_notify_verify_e_type { - RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, - RPC_LOC_NI_USER_NOTIFY_ONLY = 2, - RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, - RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, - RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, - RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456 -}; - -enum rpc_loc_ni_event_e_type { - RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, - RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, - RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, - RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4, - RPC_LOC_NI_EVENT_MAX = 268435456 -}; - -enum rpc_loc_ni_datacoding_scheme_e_type { - RPC_LOC_NI_PRESUPL_ISO646IRV = 0, - RPC_LOC_NI_PRESUPL_ISO8859 = 1, - RPC_LOC_NI_PRESUPL_UTF8 = 2, - RPC_LOC_NI_PRESUPL_UTF16 = 3, - RPC_LOC_NI_PRESUPL_UCS2 = 4, - RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, - RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, - RPC_LOC_NI_PRESUPL_JIS = 7, - RPC_LOC_NI_PRESUPL_EUC = 8, - RPC_LOC_NI_PRESUPL_GB2312 = 9, - RPC_LOC_NI_PRESUPL_CNS11643 = 10, - RPC_LOC_NI_PRESUPL_KSC1001 = 11, - RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, - RPC_LOC_NI_SS_GERMAN = 12, - RPC_LOC_NI_SS_ENGLISH = 13, - RPC_LOC_NI_SS_ITALIAN = 14, - RPC_LOC_NI_SS_FRENCH = 15, - RPC_LOC_NI_SS_SPANISH = 16, - RPC_LOC_NI_SS_DUTCH = 17, - RPC_LOC_NI_SS_SWEDISH = 18, - RPC_LOC_NI_SS_DANISH = 19, - RPC_LOC_NI_SS_PORTUGUESE = 20, - RPC_LOC_NI_SS_FINNISH = 21, - RPC_LOC_NI_SS_NORWEGIAN = 22, - RPC_LOC_NI_SS_GREEK = 23, - RPC_LOC_NI_SS_TURKISH = 24, - RPC_LOC_NI_SS_HUNGARIAN = 25, - RPC_LOC_NI_SS_POLISH = 26, - RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, - RPC_LOC_NI_SUPL_UTF8 = 28, - RPC_LOC_NI_SUPL_UCS2 = 29, - RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, - RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647 -}; - -enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { - RPC_LOC_NI_VX_OCTET = 0, - RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, - RPC_LOC_NI_VX_ASCII = 2, - RPC_LOC_NI_VX_IA5 = 3, - RPC_LOC_NI_VX_UNICODE = 4, - RPC_LOC_NI_VX_SHIFT_JIS = 5, - RPC_LOC_NI_VX_KOREAN = 6, - RPC_LOC_NI_VX_LATIN_HEBREW = 7, - RPC_LOC_NI_VX_LATIN = 8, - RPC_LOC_NI_VX_GSM = 9, - RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456 -}; - -enum rpc_loc_ni_vx_pos_mode_e_type { - RPC_LOC_VX_MS_ASSISTED_ONLY = 1, - RPC_LOC_VX_MS_BASED_ONLY = 2, - RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, - RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, - RPC_LOC_VX_POS_MODE_MAX = 268435456 -}; - -struct rpc_loc_ni_vx_requester_id_s_type { - unsigned char requester_id_length; - opaque requester_id[200]; /* EVAL:[200]*/ -}; - -struct rpc_loc_ni_vx_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - unsigned char pos_qos_incl; - unsigned char pos_qos; - rpc_uint32 num_fixes; - rpc_uint32 tbf; - rpc_loc_ni_vx_pos_mode_e_type pos_mode; - rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; - rpc_loc_ni_vx_requester_id_s_type requester_id; - rpc_uint16 user_resp_timer_val; -}; - -enum rpc_loc_ni_supl_pos_method_e_type { - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, - RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, - RPC_LOC_NI_POSMETHOD_AFLT = 6, - RPC_LOC_NI_POSMETHOD_ECID = 7, - RPC_LOC_NI_POSMETHOD_EOTD = 8, - RPC_LOC_NI_POSMETHOD_OTDOA = 9, - RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, - RPC_LOC_NI_POSMETHOD_MAX = 268435456 -}; - -struct rpc_loc_ni_supl_slp_session_id_s_type { - unsigned char presence; - opaque session_id[4]; /* EVAL:[4]*/ - rpc_loc_server_info_s_type slp_address; -}; - -struct rpc_loc_ni_requestor_id_s_type { - unsigned char data_coding_scheme; - opaque requestor_id_string[200]; /* EVAL:[200]*/ - unsigned char string_len; -}; - -struct rpc_loc_ni_supl_client_name_s_type { - unsigned char data_coding_scheme; - opaque client_name_string[64]; /* EVAL:[64]*/ - unsigned char string_len; -}; - -struct rpc_loc_ni_supl_qop_s_type { - unsigned char bit_mask; - unsigned char horacc; - unsigned char veracc; - rpc_uint16 maxLocAge; - unsigned char delay; -}; - -struct rpc_loc_ni_supl_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - rpc_uint16 flags; - rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; - opaque supl_hash[8]; /* EVAL:[8]*/ - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_supl_pos_method_e_type pos_method; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_supl_client_name_s_type client_name; - rpc_loc_ni_supl_qop_s_type supl_qop; - rpc_uint16 user_response_timer; -}; - -struct rpc_loc_ni_ext_client_address_s_type { - unsigned char ext_client_address_len; - opaque ext_client_address[20]; /* EVAL:[20]*/ -}; - -enum rpc_loc_ni_location_type_e_type { - RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, - RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, - RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, - RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456 -}; - -struct rpc_loc_ni_deferred_location_s_type { - unsigned char unused_bits; - unsigned char ms_available; -}; - -struct rpc_loc_ni_codeword_string_s_type { - unsigned char data_coding_scheme; - opaque lcs_codeword_string[20]; /* EVAL:[20]*/ - unsigned char string_len; -}; - -struct rpc_loc_ni_service_type_id_s_type { - unsigned char lcs_service_type_id; -}; - -struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - unsigned char invoke_id; - rpc_uint16 flags; - unsigned char notification_length; - opaque notification_text[64]; /* EVAL:[64]*/ - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_ext_client_address_s_type ext_client_address_data; - rpc_loc_ni_location_type_e_type location_type; - rpc_loc_ni_deferred_location_s_type deferred_location; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_codeword_string_s_type codeword_string; - rpc_loc_ni_service_type_id_s_type service_type_id; - rpc_uint16 user_response_timer; -}; - -enum rpc_loc_ni_service_interaction_e_type { - RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1, - RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456 -}; - -struct rpc_loc_ni_vx_service_interaction_req_s_type { - rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req; - rpc_loc_ni_service_interaction_e_type service_interation_type; -}; - -union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) { - case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: - rpc_loc_ni_vx_notify_verify_req_s_type vx_req; - case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: - rpc_loc_ni_supl_notify_verify_req_s_type supl_req; - case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: - rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; - case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ: - rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req; - default: - void; -}; - -struct rpc_loc_ni_event_s_type { - rpc_loc_ni_event_e_type event; - rpc_loc_ni_event_payload_u_type payload; -}; - -enum rpc_loc_assist_data_request_e_type { - RPC_LOC_ASSIST_DATA_TIME_REQ = 1, - RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, - RPC_LOC_ASSIST_DATA_MAX = 268435456 -}; - - typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/ - - typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; /* EVAL:[3]*/ - -struct rpc_loc_time_download_source_s_type { - rpc_uint32 delay_threshold; - rpc_struct_loc_time_download_source_s_type_servers servers; -}; - - typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/ - - typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; /* EVAL:[3]*/ - -struct rpc_loc_predicted_orbits_data_source_s_type { - rpc_uint32 max_file_size; - rpc_uint32 max_part_size; - rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; -}; - -union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) { - case RPC_LOC_ASSIST_DATA_TIME_REQ: - rpc_loc_time_download_source_s_type time_download; - case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: - rpc_loc_predicted_orbits_data_source_s_type data_download; - default: - void; -}; - -struct rpc_loc_assist_data_request_s_type { - rpc_loc_assist_data_request_e_type event; - rpc_loc_assist_data_request_payload_u_type payload; -}; - -typedef rpc_uint32 rpc_loc_server_connection_handle; - -enum rpc_loc_server_protocol_e_type { - RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, - RPC_LOC_SERVER_PROTOCOL_SUPL = 1, - RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, - RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, - RPC_LOC_SERVER_PROTOCOL_MAX = 16777216 -}; - -enum rpc_loc_server_request_e_type { - RPC_LOC_SERVER_REQUEST_OPEN = 1, - RPC_LOC_SERVER_REQUEST_CLOSE = 2, - RPC_LOC_SERVER_REQUEST_MAX = 268435456 -}; - -struct rpc_loc_server_open_req_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_protocol_e_type protocol; -}; - -struct rpc_loc_server_close_req_s_type { - rpc_loc_server_connection_handle conn_handle; -}; - -union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) { - case RPC_LOC_SERVER_REQUEST_OPEN: - rpc_loc_server_open_req_s_type open_req; - case RPC_LOC_SERVER_REQUEST_CLOSE: - rpc_loc_server_close_req_s_type close_req; - default: - void; -}; - -struct rpc_loc_server_request_s_type { - rpc_loc_server_request_e_type event; - rpc_loc_server_request_u_type payload; -}; - -enum rpc_loc_qwip_request_e_type { - RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0, - RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM, - RPC_LOC_QWIP_STOP_PERIODIC_FIXES, - RPC_LOC_QWIP_SUSPEND, - RPC_LOC_QWIP_REQUEST_MAX = 268435456 -}; - -struct rpc_loc_qwip_request_s_type { - rpc_loc_qwip_request_e_type request_type; - rpc_uint16 tbf_ms; -}; - -struct rpc_loc_reserved_payload_s_type { - rpc_uint16 data_size; - opaque data<>; -}; - -enum rpc_loc_ioctl_e_type { - RPC_LOC_IOCTL_GET_API_VERSION = 1, - RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, - RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, - RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, - RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, - RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, - RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, - RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, - RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, - RPC_LOC_IOCTL_INJECT_POSITION = 407, - RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, - RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, - RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, - RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411, - RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412, - RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413, - RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, - RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, - RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, - RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, - RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, - RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, - RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, - RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, - RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, - RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, - RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, - RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, - RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, - RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, - RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, - RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, - RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, - RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, - RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, - RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824 -}; - -struct rpc_loc_api_version_s_type { - unsigned char major; - unsigned char minor; -}; - -enum rpc_loc_fix_recurrence_e_type { - RPC_LOC_PERIODIC_FIX = 1, - RPC_LOC_SINGLE_FIX = 2, - RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456 -}; - -enum rpc_loc_operation_mode_e_type { - RPC_LOC_OPER_MODE_DEFAULT = 1, - RPC_LOC_OPER_MODE_MSB = 2, - RPC_LOC_OPER_MODE_MSA = 3, - RPC_LOC_OPER_MODE_STANDALONE = 4, - RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, - RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, - RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, - RPC_LOC_OPER_MODE_CELL_ID = 8, - RPC_LOC_OPER_MODE_MAX = 268435456 -}; - -enum rpc_loc_notify_e_type { - RPC_LOC_NOTIFY_ON_INTERVAL = 1, - RPC_LOC_NOTIFY_ON_DISTANCE = 2, - RPC_LOC_NOTIFY_ON_ANY = 3, - RPC_LOC_NOTIFY_ON_ALL = 4, - RPC_LOC_NOTIFY_TYPE_MAX = 268435456 -}; - -struct rpc_loc_fix_criteria_s_type { - rpc_uint32 valid_mask; - rpc_loc_fix_recurrence_e_type recurrence_type; - rpc_loc_operation_mode_e_type preferred_operation_mode; - rpc_uint32 preferred_accuracy; - rpc_uint32 preferred_response_time; - rpc_boolean intermediate_pos_report_enabled; - rpc_loc_notify_e_type notify_type; - rpc_uint32 min_interval; - float min_distance; - rpc_uint32 min_dist_sample_interval; -}; - -enum rpc_loc_ni_user_resp_e_type { - RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456 -}; - -struct rpc_loc_user_verify_s_type { - rpc_loc_ni_user_resp_e_type user_resp; - rpc_loc_ni_event_s_type ni_event_pass_back; -}; - -enum rpc_loc_predicted_orbits_data_format_e_type { - RPC_LOC_PREDICTED_ORBITS_XTRA = 0, - RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456 -}; - -struct rpc_loc_predicted_orbits_data_s_type { - rpc_loc_predicted_orbits_data_format_e_type format_type; - rpc_uint32 total_size; - rpc_uint8 total_parts; - rpc_uint8 part; - rpc_uint16 part_len; - opaque data_ptr<>; -}; - -struct rpc_loc_predicted_orbits_data_validity_report_s_type { - rpc_uint64 start_time_utc; - rpc_uint16 valid_duration_hrs; -}; - -struct rpc_loc_predicted_orbits_auto_download_config_s_type { - rpc_boolean enable; - unsigned char auto_check_every_hrs; -}; - -struct rpc_loc_assist_data_time_s_type { - rpc_uint64 time_utc; - rpc_uint32 uncertainty; -}; - -typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; - -struct rpc_loc_assist_data_pos_s_type { - rpc_loc_assist_pos_valid_mask_type valid_mask; - rpc_uint64 timestamp_utc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float hor_unc_circular; - float vert_unc; - unsigned char confidence_horizontal; - unsigned char confidence_vertical; - rpc_int32 timestamp_age; -}; - -enum rpc_loc_server_open_status_e_type { - RPC_LOC_SERVER_OPEN_SUCCESS = 1, - RPC_LOC_SERVER_OPEN_FAIL = 2, - RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456 -}; - -struct rpc_loc_server_open_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_open_status_e_type open_status; - opaque apn_name[100]; /* EVAL:[100]*/ -}; - -enum rpc_loc_server_close_status_e_type { - RPC_LOC_SERVER_CLOSE_SUCCESS = 1, - RPC_LOC_SERVER_CLOSE_FAIL = 2, - RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456 -}; - -struct rpc_loc_server_close_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_close_status_e_type close_status; -}; - -struct rpc_loc_wiper_fix_time_s_type { - rpc_uint32 slow_clock_count; -}; - -struct rpc_loc_wiper_fix_pos_s_type { - rpc_int32 lat; - rpc_int32 lon; - rpc_uint16 HEPE; - rpc_uint8 num_of_aps_used; - rpc_uint8 fix_error_code; -}; - -struct rpc_loc_wiper_ap_info_s_type { - opaque mac_addr[6]; /* EVAL:[6]*/ - rpc_int32 rssi; - rpc_uint16 channel; - rpc_uint8 ap_qualifier; -}; - -struct rpc_loc_wiper_ap_set_s_type { - rpc_uint8 num_of_aps; - rpc_loc_wiper_ap_info_s_type ap_info[50]; /* EVAL:[50]*/ -}; - -struct rpc_loc_wiper_position_report_s_type { - rpc_uint8 wiper_valid_info_flag; - rpc_loc_wiper_fix_time_s_type wiper_fix_time; - rpc_loc_wiper_fix_pos_s_type wiper_fix_position; - rpc_loc_wiper_ap_set_s_type wiper_ap_set; -}; - -enum rpc_loc_wiper_status_e_type { - RPC_LOC_WIPER_STATUS_AVAILABLE = 1, - RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2, - RPC_LOC_WIPER_STATUS_E_SIZE = 268435456 -}; - -enum rpc_loc_fs_operation_e_type { - RPC_LOC_FS_CREATE_WRITE_FILE = 1, - RPC_LOC_FS_APPEND_FILE = 2, - RPC_LOC_FS_DELETE_FILE = 3, - RPC_LOC_FS_READ_FILE = 4, - RPC_LOC_FS_MAX = 268435456 -}; - -struct rpc_loc_efs_data_s_type { - opaque filename[64]; /* EVAL:[64]*/ - rpc_loc_fs_operation_e_type operation; - rpc_uint32 total_size; - opaque data_ptr<>; - rpc_uint32 part_len; - rpc_uint8 part; - rpc_uint8 total_parts; - rpc_uint32 reserved; -}; - -enum rpc_loc_lock_e_type { - RPC_LOC_LOCK_NONE = 1, - RPC_LOC_LOCK_MI = 2, - RPC_LOC_LOCK_MT = 3, - RPC_LOC_LOCK_ALL = 4, - RPC_LOC_LOCK_MAX = 268435456 -}; - -typedef rpc_uint32 rpc_loc_nmea_sentence_type; - -typedef rpc_uint32 rpc_loc_assist_data_type; - -struct rpc_loc_assist_data_delete_s_type { - rpc_loc_assist_data_type type; - rpc_uint32 reserved[8]; /* EVAL:[8]*/ -}; - -union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) { - case RPC_LOC_IOCTL_SET_FIX_CRITERIA: - rpc_loc_fix_criteria_s_type fix_criteria; - case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: - rpc_loc_user_verify_s_type user_verify_resp; - case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: - rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; - case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: - rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; - case RPC_LOC_IOCTL_INJECT_UTC_TIME: - rpc_loc_assist_data_time_s_type assistance_data_time; - case RPC_LOC_IOCTL_INJECT_POSITION: - rpc_loc_assist_data_pos_s_type assistance_data_position; - case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: - rpc_loc_server_open_status_s_type conn_open_status; - case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: - rpc_loc_server_close_status_s_type conn_close_status; - case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT: - rpc_loc_wiper_position_report_s_type wiper_pos; - case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS: - rpc_loc_wiper_status_e_type wiper_status; - case RPC_LOC_IOCTL_SET_ENGINE_LOCK: - rpc_loc_lock_e_type engine_lock; - case RPC_LOC_IOCTL_SET_SBAS_CONFIG: - rpc_boolean sbas_mode; - case RPC_LOC_IOCTL_SET_NMEA_TYPES: - rpc_loc_nmea_sentence_type nmea_types; - case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: - rpc_boolean on_demand_lpm; - case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: - rpc_loc_server_info_s_type server_addr; - case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: - rpc_loc_assist_data_delete_s_type assist_data_delete; - case RPC_LOC_IOCTL_ACCESS_EFS_DATA: - rpc_loc_efs_data_s_type efs_data; - default: - void; -}; - -union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) { - case RPC_LOC_IOCTL_GET_API_VERSION: - rpc_loc_api_version_s_type api_version; - case RPC_LOC_IOCTL_GET_FIX_CRITERIA: - rpc_loc_fix_criteria_s_type fix_criteria; - case RPC_LOC_IOCTL_GET_ENGINE_LOCK: - rpc_loc_lock_e_type engine_lock; - case RPC_LOC_IOCTL_GET_SBAS_CONFIG: - rpc_boolean sbas_mode; - case RPC_LOC_IOCTL_GET_NMEA_TYPES: - rpc_loc_nmea_sentence_type nmea_types; - case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: - rpc_boolean on_demand_lpm; - case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: - rpc_loc_server_info_s_type server_addr; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: - rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: - rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; - default: - void; -}; - -struct rpc_loc_ioctl_callback_s_type { - rpc_loc_ioctl_e_type type; - rpc_int32 status; - rpc_loc_ioctl_callback_data_u_type data; -}; - -union rpc_loc_event_payload_u_type switch (unsigned hyper disc) { - case RPC_LOC_EVENT_PARSED_POSITION_REPORT: - rpc_loc_parsed_position_s_type parsed_location_report; - case RPC_LOC_EVENT_SATELLITE_REPORT: - rpc_loc_gnss_info_s_type gnss_report; - case RPC_LOC_EVENT_NMEA_POSITION_REPORT: - rpc_loc_nmea_report_s_type nmea_report; - case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: - rpc_loc_ni_event_s_type ni_request; - case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: - rpc_loc_assist_data_request_s_type assist_data_request; - case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: - rpc_loc_server_request_s_type loc_server_request; - case RPC_LOC_EVENT_IOCTL_REPORT: - rpc_loc_ioctl_callback_s_type ioctl_report; - case RPC_LOC_EVENT_STATUS_REPORT: - rpc_loc_status_event_s_type status_report; - case RPC_LOC_EVENT_WPS_NEEDED_REQUEST: - rpc_loc_qwip_request_s_type qwip_request; - case RPC_LOC_EVENT_RESERVED: - rpc_loc_reserved_payload_s_type reserved; - default: - void; -}; - diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c deleted file mode 100644 index 7c860bf3..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_common_xdr.c +++ /dev/null @@ -1,1650 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api_common.h" - -bool_t -xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp) -{ - register int32_t *buf; - - if (!xdr_bool (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp) -{ - register int32_t *buf; - - if (!xdr_u_long (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp) -{ - register int32_t *buf; - - if (!xdr_u_short (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp) -{ - register int32_t *buf; - - if (!xdr_long (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_byte (XDR *xdrs, rpc_byte *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp) -{ - register int32_t *buf; - - if (!xdr_u_quad_t (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint16 (xdrs, &objp->year)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->month)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->day_of_week)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->day)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->hour)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->minute)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->second)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->millisecond)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status)) - return FALSE; - if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar)) - return FALSE; - if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds)) - return FALSE; - if (!xdr_float (xdrs, &objp->time_unc)) - return FALSE; - if (!xdr_double (xdrs, &objp->latitude)) - return FALSE; - if (!xdr_double (xdrs, &objp->longitude)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) - return FALSE; - if (!xdr_float (xdrs, &objp->speed_horizontal)) - return FALSE; - if (!xdr_float (xdrs, &objp->speed_vertical)) - return FALSE; - if (!xdr_float (xdrs, &objp->heading)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_circular)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth)) - return FALSE; - if (!xdr_float (xdrs, &objp->vert_unc)) - return FALSE; - if (!xdr_float (xdrs, &objp->speed_unc)) - return FALSE; - if (!xdr_float (xdrs, &objp->heading_unc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_vertical)) - return FALSE; - if (!xdr_float (xdrs, &objp->magnetic_deviation)) - return FALSE; - if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->prn)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->health_status)) - return FALSE; - if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->has_eph)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->has_alm)) - return FALSE; - if (!xdr_float (xdrs, &objp->elevation)) - return FALSE; - if (!xdr_float (xdrs, &objp->azimuth)) - return FALSE; - if (!xdr_float (xdrs, &objp->snr)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_float (xdrs, &objp->position_dop)) - return FALSE; - if (!xdr_float (xdrs, &objp->horizontal_dop)) - return FALSE; - if (!xdr_float (xdrs, &objp->vertical_dop)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->sv_count)) - return FALSE; - if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80, - sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_uint16 (xdrs, &objp->length)) - return FALSE; - if (!xdr_opaque (xdrs, objp->nmea_sentences, 1200)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_STATUS_EVENT_ENGINE_STATE: - if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state)) - return FALSE; - break; - case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: - if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->addr)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->port)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_uint16 (xdrs, &objp->length)) - return FALSE; - if (!xdr_opaque (xdrs, objp->addr, 256)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_SERVER_ADDR_IPV4: - if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4)) - return FALSE; - break; - case RPC_LOC_SERVER_ADDR_URL: - if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type)) - return FALSE; - if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->requester_id_length)) - return FALSE; - if (!xdr_opaque (xdrs, objp->requester_id, 200)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->pos_qos_incl)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->pos_qos)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->tbf)) - return FALSE; - if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode)) - return FALSE; - if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme)) - return FALSE; - if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->presence)) - return FALSE; - if (!xdr_opaque (xdrs, objp->session_id, 4)) - return FALSE; - if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) - return FALSE; - if (!xdr_opaque (xdrs, objp->requestor_id_string, 200)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->string_len)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) - return FALSE; - if (!xdr_opaque (xdrs, objp->client_name_string, 64)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->string_len)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->bit_mask)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->horacc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->veracc)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->delay)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->flags)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id)) - return FALSE; - if (!xdr_opaque (xdrs, objp->supl_hash, 8)) - return FALSE; - if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method)) - return FALSE; - if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->ext_client_address_len)) - return FALSE; - if (!xdr_opaque (xdrs, objp->ext_client_address, 20)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->unused_bits)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->ms_available)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) - return FALSE; - if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->string_len)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->lcs_service_type_id)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->invoke_id)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->flags)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->notification_length)) - return FALSE; - if (!xdr_opaque (xdrs, objp->notification_text, 64)) - return FALSE; - if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) - return FALSE; - if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data)) - return FALSE; - if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type)) - return FALSE; - if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location)) - return FALSE; - if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) - return FALSE; - if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string)) - return FALSE; - if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req)) - return FALSE; - if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: - if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req)) - return FALSE; - break; - case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: - if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req)) - return FALSE; - break; - case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: - if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req)) - return FALSE; - break; - case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ: - if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp) -{ - register int32_t *buf; - - if (!xdr_string (xdrs, objp, 256)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp) -{ - register int32_t *buf; - - if (!xdr_vector (xdrs, (char *)objp, 3, - sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold)) - return FALSE; - if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp) -{ - register int32_t *buf; - - if (!xdr_string (xdrs, objp, 256)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp) -{ - register int32_t *buf; - - if (!xdr_vector (xdrs, (char *)objp, 3, - sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size)) - return FALSE; - if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_ASSIST_DATA_TIME_REQ: - if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download)) - return FALSE; - break; - case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: - if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_SERVER_REQUEST_OPEN: - if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req)) - return FALSE; - break; - case RPC_LOC_SERVER_REQUEST_CLOSE: - if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint16 (xdrs, &objp->data_size)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->major)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->minor)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type)) - return FALSE; - if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled)) - return FALSE; - if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->min_interval)) - return FALSE; - if (!xdr_float (xdrs, &objp->min_distance)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp)) - return FALSE; - if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->part)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->part_len)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_boolean (xdrs, &objp->enable)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, &objp->time_utc)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) - return FALSE; - if (!xdr_double (xdrs, &objp->latitude)) - return FALSE; - if (!xdr_double (xdrs, &objp->longitude)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_circular)) - return FALSE; - if (!xdr_float (xdrs, &objp->vert_unc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_vertical)) - return FALSE; - if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status)) - return FALSE; - if (!xdr_opaque (xdrs, objp->apn_name, 100)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->lat)) - return FALSE; - if (!xdr_rpc_int32 (xdrs, &objp->lon)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->HEPE)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_opaque (xdrs, objp->mac_addr, 6)) - return FALSE; - if (!xdr_rpc_int32 (xdrs, &objp->rssi)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->channel)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps)) - return FALSE; - if (!xdr_vector (xdrs, (char *)objp->ap_info, 50, - sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag)) - return FALSE; - if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time)) - return FALSE; - if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position)) - return FALSE; - if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_opaque (xdrs, objp->filename, 64)) - return FALSE; - if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->part_len)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->part)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->reserved)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type)) - return FALSE; - if (!xdr_vector (xdrs, (char *)objp->reserved, 8, - sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_IOCTL_SET_FIX_CRITERIA: - if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria)) - return FALSE; - break; - case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: - if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp)) - return FALSE; - break; - case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: - if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: - if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download)) - return FALSE; - break; - case RPC_LOC_IOCTL_INJECT_UTC_TIME: - if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time)) - return FALSE; - break; - case RPC_LOC_IOCTL_INJECT_POSITION: - if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position)) - return FALSE; - break; - case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: - if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status)) - return FALSE; - break; - case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: - if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status)) - return FALSE; - break; - case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT: - if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos)) - return FALSE; - break; - case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS: - if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_ENGINE_LOCK: - if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_SBAS_CONFIG: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_NMEA_TYPES: - if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: - if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr)) - return FALSE; - break; - case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: - if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete)) - return FALSE; - break; - case RPC_LOC_IOCTL_ACCESS_EFS_DATA: - if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_IOCTL_GET_API_VERSION: - if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_FIX_CRITERIA: - if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_ENGINE_LOCK: - if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_SBAS_CONFIG: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_NMEA_TYPES: - if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: - if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr)) - return FALSE; - break; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: - if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source)) - return FALSE; - break; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: - if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type)) - return FALSE; - if (!xdr_rpc_int32 (xdrs, &objp->status)) - return FALSE; - if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_quad_t (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_EVENT_PARSED_POSITION_REPORT: - if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report)) - return FALSE; - break; - case RPC_LOC_EVENT_SATELLITE_REPORT: - if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report)) - return FALSE; - break; - case RPC_LOC_EVENT_NMEA_POSITION_REPORT: - if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report)) - return FALSE; - break; - case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: - if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request)) - return FALSE; - break; - case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: - if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request)) - return FALSE; - break; - case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: - if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request)) - return FALSE; - break; - case RPC_LOC_EVENT_IOCTL_REPORT: - if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report)) - return FALSE; - break; - case RPC_LOC_EVENT_STATUS_REPORT: - if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report)) - return FALSE; - break; - case RPC_LOC_EVENT_WPS_NEEDED_REQUEST: - if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request)) - return FALSE; - break; - case RPC_LOC_EVENT_RESERVED: - if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved)) - return FALSE; - break; - default: - break; - } - return TRUE; -} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c deleted file mode 100644 index fe512f5d..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_fixup.c +++ /dev/null @@ -1,48 +0,0 @@ -/*============================================================================= - L O C _ A P I _ F I X U P . C - -GENERAL DESCRIPTION - This file adds API constants that are not automatically transmitted to - the RPC stubs, and it also fixes other RPC-related problems. - - --------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------------- -=============================================================================*/ - -#include - -#include "loc_api_fixup.h" - -#ifdef ADD_XDR_FLOAT - -int -xdr_float(xdrp, fp) - XDR *xdrp; - float *fp; -{ - return xdr_long(xdrp, (long*)fp); -} - -int -xdr_double(xdrp, dp) - XDR *xdrp; - double *dp; -{ - return xdr_long(xdrp, (long*)dp + 1) - && xdr_long(xdrp, (long*)dp); -} - -#endif /* ADD_XDR_FLOAT */ diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c deleted file mode 100644 index fbaca8b6..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c +++ /dev/null @@ -1,339 +0,0 @@ -/****************************************************************************** - @file loc_api_rpc_glue.c - @brief Android Loc API glue code using rpcgen. - - DESCRIPTION - Loc API glue code for Android - - ----------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------------- - ******************************************************************************/ -/*===================================================================== - EDIT HISTORY FOR MODULE - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - -when who what, where, why --------- --- ------------------------------------------------------- -03/05/2009 dx Initial version - -======================================================================*/ -/*===================================================================== - - INCLUDE FILES FOR MODULE - -======================================================================*/ -//#define LOG_NDDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* Include RPC headers */ -#include "loc_api_rpc_glue.h" - -/* Callback init */ -#include "loc_apicb_appinit.h" - -/* Logging */ -#define LOG_TAG "lib_api_rpc_glue" -#include - -/* Comment this out to enable logging */ -#undef LOGD -#define LOGD(...) {} - -/*===================================================================== - External declarations -======================================================================*/ - -CLIENT* loc_api_clnt = NULL; - -/* Callback ID and pointer */ -#define LOC_API_CB_ID 1 -loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */ - -#define RPC_FUNC_VERSION_BASE(a,b) a ## b -#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b) - -#define LOC_GLUE_CHECK_INIT(ret_type) \ - if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } - -#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \ - if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } - -/* Callback functions */ -/* Returns 1 if successful */ -bool_t rpc_loc_event_cb_f_type_0x00040001_svc( - rpc_loc_event_cb_f_type_args *argp, - rpc_loc_event_cb_f_type_rets *ret, - struct svc_req *req) -{ - /* Callback not registered, or unexpected ID (shouldn't happen) */ - if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID) - { - LOGD("Warning: No callback handler.\n"); - ret->loc_event_cb_f_type_result = 0; - return 1; /* simply return */ - } - - LOGD("proc: %x prog: %x vers: %x\n", - (int) req->rq_proc, - (int) req->rq_prog, - (int) req->rq_vers); - - LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n", - (int) argp->loc_event, - (int) argp->loc_handle, - (int) ret); - - /* Forward callback to real callback procedure */ - rpc_loc_client_handle_type loc_handle = argp->loc_handle; - rpc_loc_event_mask_type loc_event = argp->loc_event; - const rpc_loc_event_payload_u_type* loc_event_payload = - (const rpc_loc_event_payload_u_type*) argp->loc_event_payload; - - int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload); - ret->loc_event_cb_f_type_result = rc; - - return 1; /* ok */ -} - -int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) -{ - xdr_free (xdr_result, result); - - /* - * Insert additional freeing code here, if needed - */ - // LOGD("***** loc_apicbprog_freeresult\n"); - - return 1; -} - -int loc_apicbprog_0x00040001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) -{ - return loc_apicbprog_freeresult (transp, xdr_result, result); -} - -/*=========================================================================== - -FUNCTION loc_api_glue_init - -DESCRIPTION - Initiates the RPC client - -RETURN VALUE - 1 for success - 0 for failure - -===========================================================================*/ -int loc_api_glue_init(void) -{ - if (loc_api_clnt == NULL) - { - /* Print msg */ - LOGD("Trying to create RPC client...\n"); - loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL); - LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt); - - if (loc_api_clnt == NULL) - { - fprintf(stderr, "Error: cannot create RPC client.\n"); - return 0; - } - - /* Init RPC callbacks */ - int rc = loc_apicb_app_init(); - if (rc >= 0) - { - LOGD("Loc API callback initialized.\n"); - } else { - fprintf(stderr, "Loc API callback initialization failed.\n"); - return 0; - } - } - - return 1; -} - -rpc_loc_client_handle_type loc_open ( - rpc_loc_event_mask_type event_reg_mask, - loc_event_cb_f_type *event_callback - ) -{ - LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type); - - rpc_loc_open_args args; - args.event_reg_mask = event_reg_mask; - args.event_callback = LOC_API_CB_ID; - loc_api_saved_cb = event_callback; - - rpc_loc_open_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_open_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (rpc_loc_client_handle_type) rets.loc_open_result; -} - -int32 loc_close(rpc_loc_client_handle_type handle) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_close_args args; - args.handle = handle; - - rpc_loc_close_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_close_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_close_result; -} - -int32 loc_start_fix(rpc_loc_client_handle_type handle) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_start_fix_args args; - args.handle = handle; - - rpc_loc_start_fix_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_start_fix_result; -} - -int32 loc_stop_fix(rpc_loc_client_handle_type handle) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_stop_fix_args args; - args.handle = handle; - - rpc_loc_stop_fix_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_stop_fix_result; -} - -int32 loc_ioctl( - rpc_loc_client_handle_type handle, - rpc_loc_ioctl_e_type ioctl_type, - rpc_loc_ioctl_data_u_type* ioctl_data - ) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_ioctl_args args; - args.handle = handle; - args.ioctl_data = ioctl_data; - args.ioctl_type = ioctl_type; - if (ioctl_data != NULL) - { - /* Assign ioctl union discriminator */ - ioctl_data->disc = ioctl_type; - - /* In case the user hasn't filled in other disc fields, - automatically fill them in here */ - switch (ioctl_type) - { - case RPC_LOC_IOCTL_GET_API_VERSION: - case RPC_LOC_IOCTL_SET_FIX_CRITERIA: - case RPC_LOC_IOCTL_GET_FIX_CRITERIA: - case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: - case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: - case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: - case RPC_LOC_IOCTL_INJECT_UTC_TIME: - case RPC_LOC_IOCTL_INJECT_RTC_VALUE: - case RPC_LOC_IOCTL_INJECT_POSITION: - case RPC_LOC_IOCTL_QUERY_ENGINE_STATE: - case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: - case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: - case RPC_LOC_IOCTL_SET_ENGINE_LOCK: - case RPC_LOC_IOCTL_GET_ENGINE_LOCK: - case RPC_LOC_IOCTL_SET_SBAS_CONFIG: - case RPC_LOC_IOCTL_GET_SBAS_CONFIG: - case RPC_LOC_IOCTL_SET_NMEA_TYPES: - case RPC_LOC_IOCTL_GET_NMEA_TYPES: - break; - case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: - args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc = - args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type; - break; - case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: - break; - case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: - case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: - case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: - case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: - default: - break; - } /* switch */ - } /* ioctl_data != NULL */ - - rpc_loc_ioctl_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_ioctl_result; -} - -/* Returns 0 if error */ -int32 loc_api_null(void) -{ - LOC_GLUE_CHECK_INIT(int32); - - int32 rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets; -} diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c deleted file mode 100644 index 835f6b18..00000000 --- a/loc_api/libloc_api-rpc/gen-1240/loc_api_xdr.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api.h" - -bool_t -xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp) -{ - register int32_t *buf; - - if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0, - sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask)) - return FALSE; - if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type)) - return FALSE; - if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_boolean (xdrs, &objp->len_not_null)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->toolvers)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->features)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->proghash)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result)) - return FALSE; - if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) - return FALSE; - return TRUE; -} diff --git a/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr b/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr deleted file mode 100644 index 5d9cf6c8..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/Makefile.xdr +++ /dev/null @@ -1,29 +0,0 @@ -CLIENTS:= loc_api -SERVERS:= loc_api_cb -COMMON:= loc_api_common -RPC_INC:= inc-$(AMSS_VERSION) - -all: $(CLIENTS) $(SERVERS) $(COMMON) fixup - -$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr) - -$(CLIENTS) $(SERVERS) $(COMMON):: - rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@) - rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@) - -$(CLIENTS):: - rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@) - -$(SERVERS):: - rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@) - -fixup: - mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak - sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include ../$(RPC_INC)/loc_api_common.h - rm -f ../$(RPC_INC)/loc_api_common.h.bak - -clean: - rm -f $(addsuffix _clnt.c, $(CLIENTS)) - rm -f $(addsuffix _svc.c, $(SERVERS)) - rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON)) - rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON))) diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr deleted file mode 100644 index 981266b3..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api.xdr +++ /dev/null @@ -1,164 +0,0 @@ -/* LOC_API TOOL VERSION: 3.28 */ -/*============================================================================= - L O C _ A P I . X D R - -GENERAL DESCRIPTION - This is an AUTO GENERATED file that provides an xdr compatible definition of - the loc_api API. - - --------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------------- -=============================================================================*/ - -/*============================================================================= - - Edit History - - AUTO GENERATED - -Generated by following versions of Htorpc modules: -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 - -=============================================================================*/ -/*============================================================================= -$Header$ -=============================================================================*/ - - - -typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>; - -/* - * Declare an rpc_uint32 type for each callback type in the API - */ -typedef rpc_uint32 rpc_loc_event_cb_f_type; - - - -/* - * These are struct declarations for the function arguments - */ - -struct rpc_loc_open_args { - rpc_loc_event_mask_type event_reg_mask; - rpc_loc_event_cb_f_type event_callback; -}; - -struct rpc_loc_close_args { - rpc_loc_client_handle_type handle; -}; - -struct rpc_loc_start_fix_args { - rpc_loc_client_handle_type handle; -}; - -struct rpc_loc_stop_fix_args { - rpc_loc_client_handle_type handle; -}; - -struct rpc_loc_ioctl_args { - rpc_loc_client_handle_type handle; - rpc_loc_ioctl_e_type ioctl_type; - rpc_loc_ioctl_data_u_type *ioctl_data; -}; - - - -struct rpc_loc_api_api_version_s_args { - rpc_boolean len_not_null; -}; - -/* - * These are struct declarations for the function results - */ - -struct rpc_loc_api_rpc_glue_code_info_remote_rets { - rpc_uint32 toolvers; /* Tool version */ - rpc_uint32 features; /* Features turned on in the code. - * 0x00000001 ONCRPC Server Cleanup Support - */ - rpc_uint32 proghash; /* Unique hash value for the API XDR definition */ - rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */ -}; - -struct rpc_loc_open_rets { - rpc_loc_client_handle_type loc_open_result; -}; - -struct rpc_loc_close_rets { - rpc_int32 loc_close_result; -}; - -struct rpc_loc_start_fix_rets { - rpc_int32 loc_start_fix_result; -}; - -struct rpc_loc_stop_fix_rets { - rpc_int32 loc_stop_fix_result; -}; - -struct rpc_loc_ioctl_rets { - rpc_int32 loc_ioctl_result; -}; - - struct rpc_loc_api_api_versions_rets { - rpc_loc_api_api_versions_return_type loc_api_api_versions_result; - rpc_uint32 *len; -}; - -/* - * XDR definition of the LOC_API program ( vers. 0x00010001 ) - */ - -program LOC_APIPROG { - version LOC_APIVERS_0001 { - - void - rpc_loc_api_null( void ) = 0; - - rpc_loc_api_rpc_glue_code_info_remote_rets - rpc_loc_api_rpc_glue_code_info_remote( void ) = 1; - - rpc_loc_open_rets - rpc_loc_open( rpc_loc_open_args ) = 2; - - rpc_loc_close_rets - rpc_loc_close( rpc_loc_close_args ) = 3; - - rpc_loc_start_fix_rets - rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4; - - rpc_loc_stop_fix_rets - rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5; - - rpc_loc_ioctl_rets - rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6; - - rpc_loc_api_api_versions_rets - rpc_loc_api_api_versions( void ) = 0xFFFFFFFF; - - - } = 0x00010001; -} = 0x3000008c; - -const LOC_APIVERS = 0x00010001; diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr deleted file mode 100644 index 3f53504b..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb.xdr +++ /dev/null @@ -1,90 +0,0 @@ -/* LOC_API TOOL VERSION: 3.28 */ -/*============================================================================= - L O C _ A P I _ C B . X D R - -GENERAL DESCRIPTION - This is an AUTO GENERATED file that provides an xdr compatible definition of - an api that represents the grouping of the different callback functions the - loc_api API supports. - - --------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------------- -=============================================================================*/ - -/*============================================================================= - - Edit History - - AUTO GENERATED - -Generated by following versions of Htorpc modules: -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 - -=============================================================================*/ -/*============================================================================= -$Header$ -=============================================================================*/ - - - - -/* - * These are struct declarations for the function arguments - */ - -struct rpc_loc_event_cb_f_type_args { - rpc_uint32 cb_id; - rpc_loc_client_handle_type loc_handle; - rpc_loc_event_mask_type loc_event; - rpc_loc_event_payload_u_type *loc_event_payload; -}; - - - - - -/* - * These are struct declaratios for the function results - */ - -struct rpc_loc_event_cb_f_type_rets { - rpc_int32 loc_event_cb_f_type_result; -}; - - - -/* - * XDR definition of the LOC_API callback program ( vers. 0x00010001 ) - */ - -program LOC_APICBPROG { - version LOC_APICBVERS_0001 { - - rpc_loc_event_cb_f_type_rets - rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1; - - - } = 0x00010001; -} = 0x3100008c; - -const LOC_APICBVERS = 0x00010001; diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c deleted file mode 100644 index b1aa1998..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_svc.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api_cb.h" -#include -#include -#include -#include -#include -#include -#include - -#ifndef SIG_PF -#define SIG_PF void(*)(int) -#endif - -void -loc_apicbprog_0x00010001(struct svc_req *rqstp, register SVCXPRT *transp) -{ - union { - rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00010001_arg; - } argument; - union { - rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00010001_res; - } result; - bool_t retval; - xdrproc_t _xdr_argument, _xdr_result; - bool_t (*local)(char *, void *, struct svc_req *); - - switch (rqstp->rq_proc) { - case NULLPROC: - (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); - return; - - case rpc_loc_event_cb_f_type: - _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args; - _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets; - local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00010001_svc; - break; - - default: - svcerr_noproc (transp); - return; - } - memset ((char *)&argument, 0, sizeof (argument)); - if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { - svcerr_decode (transp); - return; - } - retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); - if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { - svcerr_systemerr (transp); - } - if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { - fprintf (stderr, "%s", "unable to free arguments"); - exit (1); - } - if (!loc_apicbprog_0x00010001_freeresult (transp, _xdr_result, (caddr_t) &result)) - fprintf (stderr, "%s", "unable to free results"); - - return; -} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c deleted file mode 100644 index 1d7795ed..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_cb_xdr.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api_cb.h" - -bool_t -xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->cb_id)) - return FALSE; - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle)) - return FALSE; - if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event)) - return FALSE; - if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result)) - return FALSE; - return TRUE; -} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c deleted file mode 100644 index 79814d42..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_clnt.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include /* for memset */ -#include "loc_api.h" - -/* Default timeout can be changed using clnt_control() */ -static struct timeval TIMEOUT = { 25, 0 }; - -enum clnt_stat -rpc_loc_api_null_0x00010001(void *argp, void *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_null, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_open_0x00010001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_open, - (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_close_0x00010001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_close, - (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_start_fix, - (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_stop_fix, - (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_ioctl, - (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res, - TIMEOUT)); -} - -enum clnt_stat -rpc_loc_api_api_versions_0x00010001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt) -{ - return (clnt_call(clnt, rpc_loc_api_api_versions, - (xdrproc_t) xdr_void, (caddr_t) argp, - (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res, - TIMEOUT)); -} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr deleted file mode 100644 index 7ef6357c..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr +++ /dev/null @@ -1,803 +0,0 @@ -/* LOC_API TOOL VERSION: 3.28 */ -/*============================================================================= - L O C _ A P I _ C O M M O N . X D R - -GENERAL DESCRIPTION - This is an AUTO GENERATED file that provides an xdr compatible definition of - an api that represents the grouping of the different callback functions the - loc_api API supports. - - --------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------------- -=============================================================================*/ - -/*============================================================================= - - Edit History - - AUTO GENERATED - -Generated by following versions of Htorpc modules: -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2 -Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4 - -=============================================================================*/ -/*============================================================================= -$Header$ -=============================================================================*/ - - - - -const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010; - -const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080; - -const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040; - -const RPC_LOC_EVENT_RESERVED = 0x8000000000000000; - -const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001; - -const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020; - -const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008; - -const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002; - -const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100; - -const RPC_LOC_OPEN_VERSION = 0x00010001; -const RPC_LOC_CLOSE_VERSION = 0x00010001; -const RPC_LOC_START_FIX_VERSION = 0x00010001; -const RPC_LOC_STOP_FIX_VERSION = 0x00010001; -const RPC_LOC_IOCTL_VERSION = 0x00010001; -const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00010001; -const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0; -const RPC_LOC_API_API_MAJOR_NUM = 0x0001; -typedef bool rpc_boolean; -typedef unsigned long rpc_uint32; - -typedef unsigned short rpc_uint16; - -typedef unsigned char rpc_uint8; - -typedef long rpc_int32; - -typedef unsigned char rpc_byte; - -typedef unsigned hyper rpc_uint64; - -typedef rpc_int32 rpc_loc_client_handle_type; - -typedef rpc_uint64 rpc_loc_event_mask_type; - -typedef rpc_uint64 rpc_loc_position_valid_mask_type; - -typedef rpc_uint32 rpc_loc_pos_technology_mask_type; - -enum rpc_loc_session_status_e_type { - RPC_LOC_SESS_STATUS_SUCCESS = 0, - RPC_LOC_SESS_STATUS_IN_PROGESS = 1, - RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, - RPC_LOC_SESS_STATUS_TIMEOUT = 3, - RPC_LOC_SESS_STATUS_USER_END = 4, - RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, - RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, - RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, - RPC_LOC_SESS_STATUS_MAX = 268435456 -}; - -struct rpc_loc_calendar_time_s_type { - rpc_uint16 year; - unsigned char month; - unsigned char day_of_week; - unsigned char day; - unsigned char hour; - unsigned char minute; - unsigned char second; - rpc_uint16 millisecond; -}; - -struct rpc_loc_parsed_position_s_type { - rpc_loc_position_valid_mask_type valid_mask; - rpc_loc_session_status_e_type session_status; - rpc_loc_calendar_time_s_type timestamp_calendar; - rpc_uint64 timestamp_utc; - rpc_uint8 leap_seconds; - float time_unc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float speed_horizontal; - float speed_vertical; - float heading; - float hor_unc_circular; - float hor_unc_ellipse_semi_major; - float hor_unc_ellipse_semi_minor; - float hor_unc_ellipse_orient_azimuth; - float vert_unc; - float speed_unc; - float heading_unc; - unsigned char confidence_horizontal; - unsigned char confidence_vertical; - float magnetic_deviation; - rpc_loc_pos_technology_mask_type technology_mask; -}; - -enum rpc_loc_sv_system_e_type { - RPC_LOC_SV_SYSTEM_GPS = 1, - RPC_LOC_SV_SYSTEM_GALILEO = 2, - RPC_LOC_SV_SYSTEM_SBAS = 3, - RPC_LOC_SV_SYSTEM_COMPASS = 4, - RPC_LOC_SV_SYSTEM_GLONASS = 5, - RPC_LOC_SV_SYSTEM_MAX = 268435456 -}; - -enum rpc_loc_sv_status_e_type { - RPC_LOC_SV_STATUS_IDLE = 1, - RPC_LOC_SV_STATUS_SEARCH = 2, - RPC_LOC_SV_STATUS_TRACK = 3, - RPC_LOC_SV_STATUS_MAX = 268435456 -}; - -typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; - -struct rpc_loc_sv_info_s_type { - rpc_loc_sv_info_valid_mask_type valid_mask; - rpc_loc_sv_system_e_type system; - rpc_uint8 prn; - rpc_uint8 health_status; - rpc_loc_sv_status_e_type process_status; - rpc_boolean has_eph; - rpc_boolean has_alm; - float elevation; - float azimuth; - float snr; -}; - -typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; - -struct rpc_loc_gnss_info_s_type { - rpc_loc_gnss_info_valid_mask_type valid_mask; - float position_dop; - float horizontal_dop; - float vertical_dop; - rpc_boolean altitude_assumed; - rpc_uint16 sv_count; - rpc_loc_sv_info_s_type sv_list; -}; - -struct rpc_loc_nmea_report_s_type { - rpc_uint16 length; - opaque nmea_sentences; -}; - -enum rpc_loc_status_event_e_type { - RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, - RPC_LOC_STATUS_EVENT_MAX = 268435456 -}; - -enum rpc_loc_engine_state_e_type { - RPC_LOC_ENGINE_STATE_ON = 1, - RPC_LOC_ENGINE_STATE_OFF = 2, - RPC_LOC_ENGINE_STATE_MAX = 268435456 -}; - -union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) { - case RPC_LOC_STATUS_EVENT_ENGINE_STATE: - rpc_loc_engine_state_e_type engine_state; - default: - void; -}; - -struct rpc_loc_status_event_s_type { - rpc_loc_status_event_e_type event; - rpc_loc_status_event_payload_u_type payload; -}; - -enum rpc_loc_server_addr_e_type { - RPC_LOC_SERVER_ADDR_IPV4 = 1, - RPC_LOC_SERVER_ADDR_URL = 2, - RPC_LOC_SERVER_ADDR_MAX = 268435456 -}; - -struct rpc_loc_server_addr_ipv4_type { - rpc_uint32 addr; - rpc_uint16 port; -}; - -struct rpc_loc_server_addr_url_type { - rpc_uint16 length; - opaque addr; -}; - -union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) { - case RPC_LOC_SERVER_ADDR_IPV4: - rpc_loc_server_addr_ipv4_type ipv4; - case RPC_LOC_SERVER_ADDR_URL: - rpc_loc_server_addr_url_type url; - default: - void; -}; - -struct rpc_loc_server_info_s_type { - rpc_loc_server_addr_e_type addr_type; - rpc_loc_server_addr_u_type addr_info; -}; - -enum rpc_loc_ni_notify_verify_e_type { - RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, - RPC_LOC_NI_USER_NOTIFY_ONLY = 2, - RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, - RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, - RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, - RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456 -}; - -enum rpc_loc_ni_event_e_type { - RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, - RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, - RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, - RPC_LOC_NI_EVENT_MAX = 268435456 -}; - -enum rpc_loc_ni_datacoding_scheme_e_type { - RPC_LOC_NI_PRESUPL_ISO646IRV = 0, - RPC_LOC_NI_PRESUPL_ISO8859 = 1, - RPC_LOC_NI_PRESUPL_UTF8 = 2, - RPC_LOC_NI_PRESUPL_UTF16 = 3, - RPC_LOC_NI_PRESUPL_UCS2 = 4, - RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, - RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, - RPC_LOC_NI_PRESUPL_JIS = 7, - RPC_LOC_NI_PRESUPL_EUC = 8, - RPC_LOC_NI_PRESUPL_GB2312 = 9, - RPC_LOC_NI_PRESUPL_CNS11643 = 10, - RPC_LOC_NI_PRESUPL_KSC1001 = 11, - RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, - RPC_LOC_NI_SS_GERMAN = 12, - RPC_LOC_NI_SS_ENGLISH = 13, - RPC_LOC_NI_SS_ITALIAN = 14, - RPC_LOC_NI_SS_FRENCH = 15, - RPC_LOC_NI_SS_SPANISH = 16, - RPC_LOC_NI_SS_DUTCH = 17, - RPC_LOC_NI_SS_SWEDISH = 18, - RPC_LOC_NI_SS_DANISH = 19, - RPC_LOC_NI_SS_PORTUGUESE = 20, - RPC_LOC_NI_SS_FINNISH = 21, - RPC_LOC_NI_SS_NORWEGIAN = 22, - RPC_LOC_NI_SS_GREEK = 23, - RPC_LOC_NI_SS_TURKISH = 24, - RPC_LOC_NI_SS_HUNGARIAN = 25, - RPC_LOC_NI_SS_POLISH = 26, - RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, - RPC_LOC_NI_SUPL_UTF8 = 28, - RPC_LOC_NI_SUPL_UCS2 = 29, - RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, - RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647 -}; - -enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { - RPC_LOC_NI_VX_OCTET = 0, - RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, - RPC_LOC_NI_VX_ASCII = 2, - RPC_LOC_NI_VX_IA5 = 3, - RPC_LOC_NI_VX_UNICODE = 4, - RPC_LOC_NI_VX_SHIFT_JIS = 5, - RPC_LOC_NI_VX_KOREAN = 6, - RPC_LOC_NI_VX_LATIN_HEBREW = 7, - RPC_LOC_NI_VX_LATIN = 8, - RPC_LOC_NI_VX_GSM = 9, - RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456 -}; - -enum rpc_loc_ni_vx_pos_mode_e_type { - RPC_LOC_VX_MS_ASSISTED_ONLY = 1, - RPC_LOC_VX_MS_BASED_ONLY = 2, - RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, - RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, - RPC_LOC_VX_POS_MODE_MAX = 268435456 -}; - -struct rpc_loc_ni_vx_requester_id_s_type { - unsigned char requester_id_length; - opaque requester_id[200]; -}; - -struct rpc_loc_ni_vx_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - unsigned char pos_qos_incl; - unsigned char pos_qos; - rpc_uint32 num_fixes; - rpc_uint32 tbf; - rpc_loc_ni_vx_pos_mode_e_type pos_mode; - rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; - rpc_loc_ni_vx_requester_id_s_type requester_id; - rpc_uint16 user_resp_timer_val; -}; - -enum rpc_loc_ni_supl_pos_method_e_type { - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, - RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, - RPC_LOC_NI_POSMETHOD_AFLT = 6, - RPC_LOC_NI_POSMETHOD_ECID = 7, - RPC_LOC_NI_POSMETHOD_EOTD = 8, - RPC_LOC_NI_POSMETHOD_OTDOA = 9, - RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, - RPC_LOC_NI_POSMETHOD_MAX = 268435456 -}; - -struct rpc_loc_ni_supl_slp_session_id_s_type { - unsigned char presence; - opaque session_id[4]; - rpc_loc_server_info_s_type slp_address; -}; - -struct rpc_loc_ni_requestor_id_s_type { - unsigned char data_coding_scheme; - opaque requestor_id_string; - unsigned char string_len; -}; - -struct rpc_loc_ni_supl_client_name_s_type { - unsigned char data_coding_scheme; - opaque client_name_string; - unsigned char string_len; -}; - -struct rpc_loc_ni_supl_qop_s_type { - unsigned char bit_mask; - unsigned char horacc; - unsigned char veracc; - unsigned char maxLocAge; - unsigned char delay; -}; - -struct rpc_loc_ni_supl_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - rpc_uint16 flags; - rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; - opaque supl_hash[8]; - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_supl_pos_method_e_type pos_method; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_supl_client_name_s_type client_name; - rpc_loc_ni_supl_qop_s_type supl_qop; - rpc_uint16 user_response_timer; -}; - -struct rpc_loc_ni_ext_client_address_s_type { - unsigned char ext_client_address_len; - opaque ext_client_address; -}; - -enum rpc_loc_ni_location_type_e_type { - RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, - RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, - RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, - RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456 -}; - -struct rpc_loc_ni_deferred_location_s_type { - unsigned char unused_bits; - unsigned char ms_available; -}; - -struct rpc_loc_ni_codeword_string_s_type { - unsigned char data_coding_scheme; - opaque lcs_codeword_string; - unsigned char string_len; -}; - -struct rpc_loc_ni_service_type_id_s_type { - unsigned char lcs_service_type_id; -}; - -struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - unsigned char invoke_id; - rpc_uint16 flags; - unsigned char notification_length; - opaque notification_text; - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_ext_client_address_s_type ext_client_address_data; - rpc_loc_ni_location_type_e_type location_type; - rpc_loc_ni_deferred_location_s_type deferred_location; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_codeword_string_s_type codeword_string; - rpc_loc_ni_service_type_id_s_type service_type_id; - rpc_uint16 user_response_timer; -}; - -union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) { - case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: - rpc_loc_ni_vx_notify_verify_req_s_type vx_req; - case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: - rpc_loc_ni_supl_notify_verify_req_s_type supl_req; - case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: - rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; - default: - void; -}; - -struct rpc_loc_ni_event_s_type { - rpc_loc_ni_event_e_type event; - rpc_loc_ni_event_payload_u_type payload; -}; - -enum rpc_loc_assist_data_request_e_type { - RPC_LOC_ASSIST_DATA_TIME_REQ = 1, - RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, - RPC_LOC_ASSIST_DATA_MAX = 268435456 -}; - -typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr; - -typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; - -struct rpc_loc_time_download_source_s_type { - rpc_uint32 delay_threshold; - rpc_struct_loc_time_download_source_s_type_servers servers; -}; - -typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; - -typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; - -struct rpc_loc_predicted_orbits_data_source_s_type { - rpc_uint32 max_file_size; - rpc_uint32 max_part_size; - rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; -}; - -union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) { - case RPC_LOC_ASSIST_DATA_TIME_REQ: - rpc_loc_time_download_source_s_type time_download; - case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: - rpc_loc_predicted_orbits_data_source_s_type data_download; - default: - void; -}; - -struct rpc_loc_assist_data_request_s_type { - rpc_loc_assist_data_request_e_type event; - rpc_loc_assist_data_request_payload_u_type payload; -}; - -typedef rpc_uint32 rpc_loc_server_connection_handle; - -enum rpc_loc_server_protocol_e_type { - RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, - RPC_LOC_SERVER_PROTOCOL_SUPL = 1, - RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, - RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, - RPC_LOC_SERVER_PROTOCOL_MAX = 16777216 -}; - -enum rpc_loc_server_request_e_type { - RPC_LOC_SERVER_REQUEST_OPEN = 1, - RPC_LOC_SERVER_REQUEST_CLOSE = 2, - RPC_LOC_SERVER_REQUEST_MAX = 268435456 -}; - -struct rpc_loc_server_open_req_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_protocol_e_type protocol; -}; - -struct rpc_loc_server_close_req_s_type { - rpc_loc_server_connection_handle conn_handle; -}; - -union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) { - case RPC_LOC_SERVER_REQUEST_OPEN: - rpc_loc_server_open_req_s_type open_req; - case RPC_LOC_SERVER_REQUEST_CLOSE: - rpc_loc_server_close_req_s_type close_req; - default: - void; -}; - -struct rpc_loc_server_request_s_type { - rpc_loc_server_request_e_type event; - rpc_loc_server_request_u_type payload; -}; - -struct rpc_loc_reserved_payload_s_type { - rpc_uint16 data_size; - opaque data<>; -}; - -enum rpc_loc_ioctl_e_type { - RPC_LOC_IOCTL_GET_API_VERSION = 1, - RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, - RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, - RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, - RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, - RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, - RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, - RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, - RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, - RPC_LOC_IOCTL_INJECT_POSITION = 407, - RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, - RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, - RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, - RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, - RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, - RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, - RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, - RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, - RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, - RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, - RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, - RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, - RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, - RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, - RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, - RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, - RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, - RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, - RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, - RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, - RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, - RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, - RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824 -}; - -struct rpc_loc_api_version_s_type { - unsigned char major; - unsigned char minor; -}; - -enum rpc_loc_fix_recurrence_e_type { - RPC_LOC_PERIODIC_FIX = 1, - RPC_LOC_SINGLE_FIX = 2, - RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456 -}; - -enum rpc_loc_operation_mode_e_type { - RPC_LOC_OPER_MODE_DEFAULT = 1, - RPC_LOC_OPER_MODE_MSB = 2, - RPC_LOC_OPER_MODE_MSA = 3, - RPC_LOC_OPER_MODE_STANDALONE = 4, - RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, - RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, - RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, - RPC_LOC_OPER_MODE_MAX = 268435456 -}; - -enum rpc_loc_notify_e_type { - RPC_LOC_NOTIFY_ON_INTERVAL = 1, - RPC_LOC_NOTIFY_ON_DISTANCE = 2, - RPC_LOC_NOTIFY_ON_ANY = 3, - RPC_LOC_NOTIFY_ON_ALL = 4, - RPC_LOC_NOTIFY_TYPE_MAX = 268435456 -}; - -struct rpc_loc_fix_criteria_s_type { - rpc_uint32 valid_mask; - rpc_loc_fix_recurrence_e_type recurrence_type; - rpc_loc_operation_mode_e_type preferred_operation_mode; - rpc_uint32 preferred_accuracy; - rpc_uint32 preferred_response_time; - rpc_boolean intermediate_pos_report_enabled; - rpc_loc_notify_e_type notify_type; - rpc_uint32 min_interval; - float min_distance; - rpc_uint32 min_dist_sample_interval; -}; - -enum rpc_loc_ni_user_resp_e_type { - RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456 -}; - -struct rpc_loc_user_verify_s_type { - rpc_loc_ni_user_resp_e_type user_resp; - rpc_loc_ni_event_s_type ni_event_pass_back; -}; - -enum rpc_loc_predicted_orbits_data_format_e_type { - RPC_LOC_PREDICTED_ORBITS_XTRA = 0, - RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456 -}; - -struct rpc_loc_predicted_orbits_data_s_type { - rpc_loc_predicted_orbits_data_format_e_type format_type; - rpc_uint32 total_size; - rpc_uint8 total_parts; - rpc_uint8 part; - rpc_uint16 part_len; - opaque data_ptr<>; -}; - -struct rpc_loc_predicted_orbits_data_validity_report_s_type { - rpc_uint64 start_time_utc; - rpc_uint16 valid_duration_hrs; -}; - -struct rpc_loc_predicted_orbits_auto_download_config_s_type { - rpc_boolean enable; - unsigned char auto_check_every_hrs; -}; - -struct rpc_loc_assist_data_time_s_type { - rpc_uint64 time_utc; - rpc_uint32 uncertainty; -}; - -typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; - -struct rpc_loc_assist_data_pos_s_type { - rpc_loc_assist_pos_valid_mask_type valid_mask; - rpc_uint64 timestamp_utc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float hor_unc_circular; - float vert_unc; - unsigned char confidence_horizontal; - unsigned char confidence_vertical; -}; - -enum rpc_loc_server_open_status_e_type { - RPC_LOC_SERVER_OPEN_SUCCESS = 1, - RPC_LOC_SERVER_OPEN_FAIL = 2, - RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456 -}; - -struct rpc_loc_server_open_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_open_status_e_type open_status; - string apn_name<>; -}; - -enum rpc_loc_server_close_status_e_type { - RPC_LOC_SERVER_CLOSE_SUCCESS = 1, - RPC_LOC_SERVER_CLOSE_FAIL = 2, - RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456 -}; - -struct rpc_loc_server_close_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_close_status_e_type close_status; -}; - -enum rpc_loc_lock_e_type { - RPC_LOC_LOCK_NONE = 1, - RPC_LOC_LOCK_MI = 2, - RPC_LOC_LOCK_MT = 3, - RPC_LOC_LOCK_ALL = 4, - RPC_LOC_LOCK_MAX = 268435456 -}; - -typedef rpc_uint32 rpc_loc_nmea_sentence_type; - -typedef rpc_uint32 rpc_loc_assist_data_type; - -struct rpc_loc_assist_data_delete_s_type { - rpc_loc_assist_data_type type; - rpc_uint32 reserved[8]; -}; - -union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) { - case RPC_LOC_IOCTL_SET_FIX_CRITERIA: - rpc_loc_fix_criteria_s_type fix_criteria; - case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: - rpc_loc_user_verify_s_type user_verify_resp; - case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: - rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; - case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: - rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; - case RPC_LOC_IOCTL_INJECT_UTC_TIME: - rpc_loc_assist_data_time_s_type assistance_data_time; - case RPC_LOC_IOCTL_INJECT_POSITION: - rpc_loc_assist_data_pos_s_type assistance_data_position; - case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: - rpc_loc_server_open_status_s_type conn_open_status; - case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: - rpc_loc_server_close_status_s_type conn_close_status; - case RPC_LOC_IOCTL_SET_ENGINE_LOCK: - rpc_loc_lock_e_type engine_lock; - case RPC_LOC_IOCTL_SET_SBAS_CONFIG: - rpc_boolean sbas_mode; - case RPC_LOC_IOCTL_SET_NMEA_TYPES: - rpc_loc_nmea_sentence_type nmea_types; - case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: - rpc_boolean on_demand_lpm; - case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: - rpc_loc_server_info_s_type server_addr; - case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: - rpc_loc_assist_data_delete_s_type assist_data_delete; - default: - void; -}; - -union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) { - case RPC_LOC_IOCTL_GET_API_VERSION: - rpc_loc_api_version_s_type api_version; - case RPC_LOC_IOCTL_GET_FIX_CRITERIA: - rpc_loc_fix_criteria_s_type fix_criteria; - case RPC_LOC_IOCTL_GET_ENGINE_LOCK: - rpc_loc_lock_e_type engine_lock; - case RPC_LOC_IOCTL_GET_SBAS_CONFIG: - rpc_boolean sbas_mode; - case RPC_LOC_IOCTL_GET_NMEA_TYPES: - rpc_loc_nmea_sentence_type nmea_types; - case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: - rpc_boolean on_demand_lpm; - case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: - rpc_loc_server_info_s_type server_addr; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: - rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: - rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; - default: - void; -}; - -struct rpc_loc_ioctl_callback_s_type { - rpc_loc_ioctl_e_type type; - rpc_int32 status; - rpc_loc_ioctl_callback_data_u_type data; -}; - -union rpc_loc_event_payload_u_type switch (unsigned hyper disc) { - case RPC_LOC_EVENT_PARSED_POSITION_REPORT: - rpc_loc_parsed_position_s_type parsed_location_report; - case RPC_LOC_EVENT_SATELLITE_REPORT: - rpc_loc_gnss_info_s_type gnss_report; - case RPC_LOC_EVENT_NMEA_POSITION_REPORT: - rpc_loc_nmea_report_s_type nmea_report; - case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: - rpc_loc_ni_event_s_type ni_request; - case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: - rpc_loc_assist_data_request_s_type assist_data_request; - case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: - rpc_loc_server_request_s_type loc_server_request; - case RPC_LOC_EVENT_IOCTL_REPORT: - rpc_loc_ioctl_callback_s_type ioctl_report; - case RPC_LOC_EVENT_STATUS_REPORT: - rpc_loc_status_event_s_type status_report; - case RPC_LOC_EVENT_RESERVED: - rpc_loc_reserved_payload_s_type reserved; - default: - void; -}; - -const RPC_LOC_API_NULL_VERSION = 0x00010001; -const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00010001; diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c deleted file mode 100644 index 7b37b9c3..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c +++ /dev/null @@ -1,1441 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api_common.h" - -bool_t -xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp) -{ - register int32_t *buf; - - if (!xdr_bool (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp) -{ - register int32_t *buf; - - if (!xdr_u_long (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp) -{ - register int32_t *buf; - - if (!xdr_u_short (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp) -{ - register int32_t *buf; - - if (!xdr_long (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_byte (XDR *xdrs, rpc_byte *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp) -{ - register int32_t *buf; - - if (!xdr_u_quad_t (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint16 (xdrs, &objp->year)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->month)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->day_of_week)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->day)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->hour)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->minute)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->second)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->millisecond)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status)) - return FALSE; - if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar)) - return FALSE; - if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds)) - return FALSE; - if (!xdr_float (xdrs, &objp->time_unc)) - return FALSE; - if (!xdr_double (xdrs, &objp->latitude)) - return FALSE; - if (!xdr_double (xdrs, &objp->longitude)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) - return FALSE; - if (!xdr_float (xdrs, &objp->speed_horizontal)) - return FALSE; - if (!xdr_float (xdrs, &objp->speed_vertical)) - return FALSE; - if (!xdr_float (xdrs, &objp->heading)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_circular)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth)) - return FALSE; - if (!xdr_float (xdrs, &objp->vert_unc)) - return FALSE; - if (!xdr_float (xdrs, &objp->speed_unc)) - return FALSE; - if (!xdr_float (xdrs, &objp->heading_unc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_vertical)) - return FALSE; - if (!xdr_float (xdrs, &objp->magnetic_deviation)) - return FALSE; - if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->prn)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->health_status)) - return FALSE; - if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->has_eph)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->has_alm)) - return FALSE; - if (!xdr_float (xdrs, &objp->elevation)) - return FALSE; - if (!xdr_float (xdrs, &objp->azimuth)) - return FALSE; - if (!xdr_float (xdrs, &objp->snr)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_float (xdrs, &objp->position_dop)) - return FALSE; - if (!xdr_float (xdrs, &objp->horizontal_dop)) - return FALSE; - if (!xdr_float (xdrs, &objp->vertical_dop)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->sv_count)) - return FALSE; - if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT, - sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint16 (xdrs, &objp->length)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_STATUS_EVENT_ENGINE_STATE: - if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->addr)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->port)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint16 (xdrs, &objp->length)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_SERVER_ADDR_IPV4: - if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4)) - return FALSE; - break; - case RPC_LOC_SERVER_ADDR_URL: - if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type)) - return FALSE; - if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->requester_id_length)) - return FALSE; - if (!xdr_opaque (xdrs, objp->requester_id, 200)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->pos_qos_incl)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->pos_qos)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->tbf)) - return FALSE; - if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode)) - return FALSE; - if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme)) - return FALSE; - if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_u_char (xdrs, &objp->presence)) - return FALSE; - if (!xdr_opaque (xdrs, objp->session_id, 4)) - return FALSE; - if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->string_len)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->string_len)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->bit_mask)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->horacc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->veracc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->maxLocAge)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->delay)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->flags)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id)) - return FALSE; - if (!xdr_opaque (xdrs, objp->supl_hash, 8)) - return FALSE; - if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method)) - return FALSE; - if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name)) - return FALSE; - if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->ext_client_address_len)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->unused_bits)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->ms_available)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->string_len)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->lcs_service_type_id)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->invoke_id)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->flags)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->notification_length)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH)) - return FALSE; - if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) - return FALSE; - if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data)) - return FALSE; - if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type)) - return FALSE; - if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location)) - return FALSE; - if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) - return FALSE; - if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string)) - return FALSE; - if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: - if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req)) - return FALSE; - break; - case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: - if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req)) - return FALSE; - break; - case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: - if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp) -{ - register int32_t *buf; - - if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp) -{ - register int32_t *buf; - - if (!xdr_vector (xdrs, (char *)objp, 3, - sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold)) - return FALSE; - if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp) -{ - register int32_t *buf; - - if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp) -{ - register int32_t *buf; - - if (!xdr_vector (xdrs, (char *)objp, 3, - sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size)) - return FALSE; - if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_ASSIST_DATA_TIME_REQ: - if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download)) - return FALSE; - break; - case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: - if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_SERVER_REQUEST_OPEN: - if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req)) - return FALSE; - break; - case RPC_LOC_SERVER_REQUEST_CLOSE: - if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event)) - return FALSE; - if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint16 (xdrs, &objp->data_size)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->major)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->minor)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type)) - return FALSE; - if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time)) - return FALSE; - if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled)) - return FALSE; - if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->min_interval)) - return FALSE; - if (!xdr_float (xdrs, &objp->min_distance)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp)) - return FALSE; - if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) - return FALSE; - if (!xdr_rpc_uint8 (xdrs, &objp->part)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->part_len)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc)) - return FALSE; - if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_boolean (xdrs, &objp->enable)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, &objp->time_utc)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint64 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask)) - return FALSE; - if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) - return FALSE; - if (!xdr_double (xdrs, &objp->latitude)) - return FALSE; - if (!xdr_double (xdrs, &objp->longitude)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) - return FALSE; - if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) - return FALSE; - if (!xdr_float (xdrs, &objp->hor_unc_circular)) - return FALSE; - if (!xdr_float (xdrs, &objp->vert_unc)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->confidence_vertical)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status)) - return FALSE; - if (!xdr_string (xdrs, &objp->apn_name, ~0)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) - return FALSE; - if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp) -{ - register int32_t *buf; - - if (!xdr_enum (xdrs, (enum_t *) objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type)) - return FALSE; - if (!xdr_vector (xdrs, (char *)objp->reserved, 8, - sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_IOCTL_SET_FIX_CRITERIA: - if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria)) - return FALSE; - break; - case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: - if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp)) - return FALSE; - break; - case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: - if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: - if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download)) - return FALSE; - break; - case RPC_LOC_IOCTL_INJECT_UTC_TIME: - if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time)) - return FALSE; - break; - case RPC_LOC_IOCTL_INJECT_POSITION: - if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position)) - return FALSE; - break; - case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: - if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status)) - return FALSE; - break; - case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: - if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_ENGINE_LOCK: - if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_SBAS_CONFIG: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_NMEA_TYPES: - if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm)) - return FALSE; - break; - case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: - if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr)) - return FALSE; - break; - case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: - if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_IOCTL_GET_API_VERSION: - if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_FIX_CRITERIA: - if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_ENGINE_LOCK: - if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_SBAS_CONFIG: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_NMEA_TYPES: - if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: - if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm)) - return FALSE; - break; - case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: - if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr)) - return FALSE; - break; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: - if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source)) - return FALSE; - break; - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: - if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity)) - return FALSE; - break; - default: - break; - } - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type)) - return FALSE; - if (!xdr_rpc_int32 (xdrs, &objp->status)) - return FALSE; - if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp) -{ - register int32_t *buf; - - if (!xdr_u_quad_t (xdrs, &objp->disc)) - return FALSE; - switch (objp->disc) { - case RPC_LOC_EVENT_PARSED_POSITION_REPORT: - if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report)) - return FALSE; - break; - case RPC_LOC_EVENT_SATELLITE_REPORT: - if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report)) - return FALSE; - break; - case RPC_LOC_EVENT_NMEA_POSITION_REPORT: - if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report)) - return FALSE; - break; - case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: - if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request)) - return FALSE; - break; - case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: - if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request)) - return FALSE; - break; - case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: - if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request)) - return FALSE; - break; - case RPC_LOC_EVENT_IOCTL_REPORT: - if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report)) - return FALSE; - break; - case RPC_LOC_EVENT_STATUS_REPORT: - if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report)) - return FALSE; - break; - case RPC_LOC_EVENT_RESERVED: - if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved)) - return FALSE; - break; - default: - break; - } - return TRUE; -} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c deleted file mode 100644 index fe512f5d..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_fixup.c +++ /dev/null @@ -1,48 +0,0 @@ -/*============================================================================= - L O C _ A P I _ F I X U P . C - -GENERAL DESCRIPTION - This file adds API constants that are not automatically transmitted to - the RPC stubs, and it also fixes other RPC-related problems. - - --------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --------------------------------------------------------------------------- -=============================================================================*/ - -#include - -#include "loc_api_fixup.h" - -#ifdef ADD_XDR_FLOAT - -int -xdr_float(xdrp, fp) - XDR *xdrp; - float *fp; -{ - return xdr_long(xdrp, (long*)fp); -} - -int -xdr_double(xdrp, dp) - XDR *xdrp; - double *dp; -{ - return xdr_long(xdrp, (long*)dp + 1) - && xdr_long(xdrp, (long*)dp); -} - -#endif /* ADD_XDR_FLOAT */ diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c deleted file mode 100644 index 8c171222..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c +++ /dev/null @@ -1,339 +0,0 @@ -/****************************************************************************** - @file loc_api_rpc_glue.c - @brief Android Loc API glue code using rpcgen. - - DESCRIPTION - Loc API glue code for Android - - ----------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------------- - ******************************************************************************/ -/*===================================================================== - EDIT HISTORY FOR MODULE - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - -when who what, where, why --------- --- ------------------------------------------------------- -03/05/2009 dx Initial version - -======================================================================*/ -/*===================================================================== - - INCLUDE FILES FOR MODULE - -======================================================================*/ -//#define LOG_NDDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* Include RPC headers */ -#include "loc_api_rpc_glue.h" - -/* Callback init */ -#include "loc_apicb_appinit.h" - -/* Logging */ -#define LOG_TAG "lib_api_rpc_glue" -#include - -/* Comment this out to enable logging */ -#undef LOGD -#define LOGD(...) {} - -/*===================================================================== - External declarations -======================================================================*/ - -CLIENT* loc_api_clnt = NULL; - -/* Callback ID and pointer */ -#define LOC_API_CB_ID 1 -loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */ - -#define RPC_FUNC_VERSION_BASE(a,b) a ## b -#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b) - -#define LOC_GLUE_CHECK_INIT(ret_type) \ - if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } - -#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \ - if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; } - -/* Callback functions */ -/* Returns 1 if successful */ -bool_t rpc_loc_event_cb_f_type_0x00010001_svc( - rpc_loc_event_cb_f_type_args *argp, - rpc_loc_event_cb_f_type_rets *ret, - struct svc_req *req) -{ - /* Callback not registered, or unexpected ID (shouldn't happen) */ - if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID) - { - LOGD("Warning: No callback handler.\n"); - ret->loc_event_cb_f_type_result = 0; - return 1; /* simply return */ - } - - LOGD("proc: %x prog: %x vers: %x\n", - (int) req->rq_proc, - (int) req->rq_prog, - (int) req->rq_vers); - - LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n", - (int) argp->loc_event, - (int) argp->loc_handle, - (int) ret); - - /* Forward callback to real callback procedure */ - rpc_loc_client_handle_type loc_handle = argp->loc_handle; - rpc_loc_event_mask_type loc_event = argp->loc_event; - const rpc_loc_event_payload_u_type* loc_event_payload = - (const rpc_loc_event_payload_u_type*) argp->loc_event_payload; - - int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload); - ret->loc_event_cb_f_type_result = rc; - - return 1; /* ok */ -} - -int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) -{ - xdr_free (xdr_result, result); - - /* - * Insert additional freeing code here, if needed - */ - // LOGD("***** loc_apicbprog_freeresult\n"); - - return 1; -} - -int loc_apicbprog_0x00010001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) -{ - return loc_apicbprog_freeresult (transp, xdr_result, result); -} - -/*=========================================================================== - -FUNCTION loc_api_glue_init - -DESCRIPTION - Initiates the RPC client - -RETURN VALUE - 1 for success - 0 for failure - -===========================================================================*/ -int loc_api_glue_init(void) -{ - if (loc_api_clnt == NULL) - { - /* Print msg */ - LOGD("Trying to create RPC client...\n"); - loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00010000, NULL); - LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt); - - if (loc_api_clnt == NULL) - { - fprintf(stderr, "Error: cannot create RPC client.\n"); - return 0; - } - - /* Init RPC callbacks */ - int rc = loc_apicb_app_init(); - if (rc >= 0) - { - LOGD("Loc API callback initialized.\n"); - } else { - fprintf(stderr, "Loc API callback initialization failed.\n"); - return 0; - } - } - - return 1; -} - -rpc_loc_client_handle_type loc_open ( - rpc_loc_event_mask_type event_reg_mask, - loc_event_cb_f_type *event_callback - ) -{ - LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type); - - rpc_loc_open_args args; - args.event_reg_mask = event_reg_mask; - args.event_callback = LOC_API_CB_ID; - loc_api_saved_cb = event_callback; - - rpc_loc_open_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (rpc_loc_client_handle_type) rets.loc_open_result; -} - -int32 loc_close(rpc_loc_client_handle_type handle) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_close_args args; - args.handle = handle; - - rpc_loc_close_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_close_result; -} - -int32 loc_start_fix(rpc_loc_client_handle_type handle) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_start_fix_args args; - args.handle = handle; - - rpc_loc_start_fix_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_start_fix_result; -} - -int32 loc_stop_fix(rpc_loc_client_handle_type handle) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_stop_fix_args args; - args.handle = handle; - - rpc_loc_stop_fix_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_stop_fix_result; -} - -int32 loc_ioctl( - rpc_loc_client_handle_type handle, - rpc_loc_ioctl_e_type ioctl_type, - rpc_loc_ioctl_data_u_type* ioctl_data - ) -{ - LOC_GLUE_CHECK_INIT(int32); - - rpc_loc_ioctl_args args; - args.handle = handle; - args.ioctl_data = ioctl_data; - args.ioctl_type = ioctl_type; - if (ioctl_data != NULL) - { - /* Assign ioctl union discriminator */ - ioctl_data->disc = ioctl_type; - - /* In case the user hasn't filled in other disc fields, - automatically fill them in here */ - switch (ioctl_type) - { - case RPC_LOC_IOCTL_GET_API_VERSION: - case RPC_LOC_IOCTL_SET_FIX_CRITERIA: - case RPC_LOC_IOCTL_GET_FIX_CRITERIA: - case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: - case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: - case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: - case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: - case RPC_LOC_IOCTL_INJECT_UTC_TIME: - case RPC_LOC_IOCTL_INJECT_RTC_VALUE: - case RPC_LOC_IOCTL_INJECT_POSITION: - case RPC_LOC_IOCTL_QUERY_ENGINE_STATE: - case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: - case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: - case RPC_LOC_IOCTL_SET_ENGINE_LOCK: - case RPC_LOC_IOCTL_GET_ENGINE_LOCK: - case RPC_LOC_IOCTL_SET_SBAS_CONFIG: - case RPC_LOC_IOCTL_GET_SBAS_CONFIG: - case RPC_LOC_IOCTL_SET_NMEA_TYPES: - case RPC_LOC_IOCTL_GET_NMEA_TYPES: - break; - case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: - args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc = - args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type; - break; - case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: - break; - case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: - case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: - case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: - case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: - case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: - default: - break; - } /* switch */ - } /* ioctl_data != NULL */ - - rpc_loc_ioctl_rets rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets.loc_ioctl_result; -} - -/* Returns 0 if error */ -int32 loc_api_null(void) -{ - LOC_GLUE_CHECK_INIT(int32); - - int32 rets; - enum clnt_stat stat = RPC_SUCCESS; - - stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt); - LOC_GLUE_CHECK_RESULT(stat, int32); - - return (int32) rets; -} diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c deleted file mode 100644 index 835f6b18..00000000 --- a/loc_api/libloc_api-rpc/gen-3200/loc_api_xdr.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#include "loc_api.h" - -bool_t -xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp) -{ - register int32_t *buf; - - if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0, - sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, objp)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask)) - return FALSE; - if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) - return FALSE; - if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type)) - return FALSE; - if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_boolean (xdrs, &objp->len_not_null)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_uint32 (xdrs, &objp->toolvers)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->features)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->proghash)) - return FALSE; - if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result)) - return FALSE; - return TRUE; -} - -bool_t -xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp) -{ - register int32_t *buf; - - if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result)) - return FALSE; - if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) - return FALSE; - return TRUE; -} diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api.h b/loc_api/libloc_api-rpc/inc-1240/loc_api.h deleted file mode 100644 index e02648cc..00000000 --- a/loc_api/libloc_api-rpc/inc-1240/loc_api.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _LOC_API_H_RPCGEN -#define _LOC_API_H_RPCGEN - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct { - u_int rpc_loc_api_api_versions_return_type_len; - rpc_uint32 *rpc_loc_api_api_versions_return_type_val; -} rpc_loc_api_api_versions_return_type; - -typedef rpc_uint32 rpc_loc_event_cb_f_type; - -struct rpc_loc_open_args { - rpc_loc_event_mask_type event_reg_mask; - rpc_loc_event_cb_f_type event_callback; -}; -typedef struct rpc_loc_open_args rpc_loc_open_args; - -struct rpc_loc_close_args { - rpc_loc_client_handle_type handle; -}; -typedef struct rpc_loc_close_args rpc_loc_close_args; - -struct rpc_loc_start_fix_args { - rpc_loc_client_handle_type handle; -}; -typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args; - -struct rpc_loc_stop_fix_args { - rpc_loc_client_handle_type handle; -}; -typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args; - -struct rpc_loc_ioctl_args { - rpc_loc_client_handle_type handle; - rpc_loc_ioctl_e_type ioctl_type; - rpc_loc_ioctl_data_u_type *ioctl_data; -}; -typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args; - -struct rpc_loc_api_api_version_s_args { - rpc_boolean len_not_null; -}; -typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args; - -struct rpc_loc_api_rpc_glue_code_info_remote_rets { - rpc_uint32 toolvers; - rpc_uint32 features; - rpc_uint32 proghash; - rpc_uint32 cbproghash; -}; -typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets; - -struct rpc_loc_open_rets { - rpc_loc_client_handle_type loc_open_result; -}; -typedef struct rpc_loc_open_rets rpc_loc_open_rets; - -struct rpc_loc_close_rets { - rpc_int32 loc_close_result; -}; -typedef struct rpc_loc_close_rets rpc_loc_close_rets; - -struct rpc_loc_start_fix_rets { - rpc_int32 loc_start_fix_result; -}; -typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets; - -struct rpc_loc_stop_fix_rets { - rpc_int32 loc_stop_fix_result; -}; -typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets; - -struct rpc_loc_ioctl_rets { - rpc_int32 loc_ioctl_result; -}; -typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets; - -struct rpc_loc_api_api_versions_rets { - rpc_loc_api_api_versions_return_type loc_api_api_versions_result; - rpc_uint32 *len; -}; -typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets; -#define LOC_APIVERS 0x00040002 - -#define LOC_APIPROG 0x3000008c -#define LOC_APIVERS_0001 0x00040001 - -#if defined(__STDC__) || defined(__cplusplus) -#define rpc_loc_api_null 0 -extern enum clnt_stat rpc_loc_api_null_0x00040001(void *, void *, CLIENT *); -extern bool_t rpc_loc_api_null_0x00040001_svc(void *, void *, struct svc_req *); -#define rpc_loc_api_rpc_glue_code_info_remote 1 -extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *); -extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *); -#define rpc_loc_open 2 -extern enum clnt_stat rpc_loc_open_0x00040001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *); -extern bool_t rpc_loc_open_0x00040001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *); -#define rpc_loc_close 3 -extern enum clnt_stat rpc_loc_close_0x00040001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *); -extern bool_t rpc_loc_close_0x00040001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *); -#define rpc_loc_start_fix 4 -extern enum clnt_stat rpc_loc_start_fix_0x00040001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *); -extern bool_t rpc_loc_start_fix_0x00040001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *); -#define rpc_loc_stop_fix 5 -extern enum clnt_stat rpc_loc_stop_fix_0x00040001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *); -extern bool_t rpc_loc_stop_fix_0x00040001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *); -#define rpc_loc_ioctl 6 -extern enum clnt_stat rpc_loc_ioctl_0x00040001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *); -extern bool_t rpc_loc_ioctl_0x00040001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *); -#define rpc_loc_api_api_versions 0xFFFFFFFF -extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(void *, rpc_loc_api_api_versions_rets *, CLIENT *); -extern bool_t rpc_loc_api_api_versions_0x00040001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *); -extern int loc_apiprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); - -#else /* K&R C */ -#define rpc_loc_api_null 0 -extern enum clnt_stat rpc_loc_api_null_0x00040001(); -extern bool_t rpc_loc_api_null_0x00040001_svc(); -#define rpc_loc_api_rpc_glue_code_info_remote 1 -extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00040001(); -extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00040001_svc(); -#define rpc_loc_open 2 -extern enum clnt_stat rpc_loc_open_0x00040001(); -extern bool_t rpc_loc_open_0x00040001_svc(); -#define rpc_loc_close 3 -extern enum clnt_stat rpc_loc_close_0x00040001(); -extern bool_t rpc_loc_close_0x00040001_svc(); -#define rpc_loc_start_fix 4 -extern enum clnt_stat rpc_loc_start_fix_0x00040001(); -extern bool_t rpc_loc_start_fix_0x00040001_svc(); -#define rpc_loc_stop_fix 5 -extern enum clnt_stat rpc_loc_stop_fix_0x00040001(); -extern bool_t rpc_loc_stop_fix_0x00040001_svc(); -#define rpc_loc_ioctl 6 -extern enum clnt_stat rpc_loc_ioctl_0x00040001(); -extern bool_t rpc_loc_ioctl_0x00040001_svc(); -#define rpc_loc_api_api_versions 0xFFFFFFFF -extern enum clnt_stat rpc_loc_api_api_versions_0x00040001(); -extern bool_t rpc_loc_api_api_versions_0x00040001_svc(); -extern int loc_apiprog_0x00040001_freeresult (); -#endif /* K&R C */ -#define LOC_APIVERS_0002 0x00040002 - -#if defined(__STDC__) || defined(__cplusplus) -extern enum clnt_stat rpc_loc_api_null_0x00040002(void *, void *, CLIENT *); -extern bool_t rpc_loc_api_null_0x00040002_svc(void *, void *, struct svc_req *); -extern int loc_apiprog_0x00040002_freeresult (SVCXPRT *, xdrproc_t, caddr_t); - -#else /* K&R C */ -extern enum clnt_stat rpc_loc_api_null_0x00040002(); -extern bool_t rpc_loc_api_null_0x00040002_svc(); -extern int loc_apiprog_0x00040002_freeresult (); -#endif /* K&R C */ - -/* the xdr functions */ - -#if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*); -extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*); -extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*); -extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*); -extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*); -extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*); -extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*); -extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*); -extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*); -extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*); -extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*); -extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*); -extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*); -extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*); -extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*); - -#else /* K&R C */ -extern bool_t xdr_rpc_loc_api_api_versions_return_type (); -extern bool_t xdr_rpc_loc_event_cb_f_type (); -extern bool_t xdr_rpc_loc_open_args (); -extern bool_t xdr_rpc_loc_close_args (); -extern bool_t xdr_rpc_loc_start_fix_args (); -extern bool_t xdr_rpc_loc_stop_fix_args (); -extern bool_t xdr_rpc_loc_ioctl_args (); -extern bool_t xdr_rpc_loc_api_api_version_s_args (); -extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (); -extern bool_t xdr_rpc_loc_open_rets (); -extern bool_t xdr_rpc_loc_close_rets (); -extern bool_t xdr_rpc_loc_start_fix_rets (); -extern bool_t xdr_rpc_loc_stop_fix_rets (); -extern bool_t xdr_rpc_loc_ioctl_rets (); -extern bool_t xdr_rpc_loc_api_api_versions_rets (); - -#endif /* K&R C */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_LOC_API_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h deleted file mode 100644 index 67ac0846..00000000 --- a/loc_api/libloc_api-rpc/inc-1240/loc_api_cb.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _LOC_API_CB_H_RPCGEN -#define _LOC_API_CB_H_RPCGEN - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -struct rpc_loc_event_cb_f_type_args { - rpc_uint32 cb_id; - rpc_loc_client_handle_type loc_handle; - rpc_loc_event_mask_type loc_event; - rpc_loc_event_payload_u_type *loc_event_payload; -}; -typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args; - -struct rpc_loc_event_cb_f_type_rets { - rpc_int32 loc_event_cb_f_type_result; -}; -typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets; -#define LOC_APICBVERS 0x00040002 - -#define LOC_APICBPROG 0x3100008c -#define LOC_APICBVERS_0001 0x00040001 - -#if defined(__STDC__) || defined(__cplusplus) -#define rpc_loc_event_cb_f_type 1 -extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *); -extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *); -extern int loc_apicbprog_0x00040001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); - -#else /* K&R C */ -#define rpc_loc_event_cb_f_type 1 -extern enum clnt_stat rpc_loc_event_cb_f_type_0x00040001(); -extern bool_t rpc_loc_event_cb_f_type_0x00040001_svc(); -extern int loc_apicbprog_0x00040001_freeresult (); -#endif /* K&R C */ - -/* the xdr functions */ - -#if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*); -extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*); - -#else /* K&R C */ -extern bool_t xdr_rpc_loc_event_cb_f_type_args (); -extern bool_t xdr_rpc_loc_event_cb_f_type_rets (); - -#endif /* K&R C */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_LOC_API_CB_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h deleted file mode 100644 index 6ff3baf1..00000000 --- a/loc_api/libloc_api-rpc/inc-1240/loc_api_common.h +++ /dev/null @@ -1,1154 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _LOC_API_COMMON_H_RPCGEN -#define _LOC_API_COMMON_H_RPCGEN - -#include -#include "loc_api_fixup.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define LOC_API_TOOLVERS 0x00040024 -#define LOC_API_FEATURES 0x00000001 -#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 -#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200 -#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 -#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 -#define RPC_LOC_EVENT_RESERVED 0x8000000000000000 -#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 -#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 -#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 -#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 -#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 -#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00040001 -#define RPC_LOC_OPEN_VERSION 0x00040001 -#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00040001 -#define RPC_LOC_API_NULL_VERSION 0x00040001 -#define RPC_LOC_STOP_FIX_VERSION 0x00040001 -#define RPC_LOC_IOCTL_VERSION 0x00040001 -#define RPC_LOC_START_FIX_VERSION 0x00040001 -#define RPC_LOC_CLOSE_VERSION 0x00040001 -#define RPC_LOC_API_API_VERSIONS_VERSION 0x00040001 -#define RPC_LOC_API_API_MAJOR_NUM 0x0004 -#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0 - -typedef bool_t rpc_boolean; - -typedef u_long rpc_uint32; - -typedef u_short rpc_uint16; - -typedef u_char rpc_uint8; - -typedef long rpc_int32; - -typedef u_char rpc_byte; - -typedef u_quad_t rpc_uint64; - -typedef rpc_int32 rpc_loc_client_handle_type; - -typedef rpc_uint64 rpc_loc_event_mask_type; - -typedef rpc_uint64 rpc_loc_position_valid_mask_type; - -typedef rpc_uint32 rpc_loc_pos_technology_mask_type; - -enum rpc_loc_session_status_e_type { - RPC_LOC_SESS_STATUS_SUCCESS = 0, - RPC_LOC_SESS_STATUS_IN_PROGESS = 1, - RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, - RPC_LOC_SESS_STATUS_TIMEOUT = 3, - RPC_LOC_SESS_STATUS_USER_END = 4, - RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, - RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, - RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, - RPC_LOC_SESS_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type; - -struct rpc_loc_calendar_time_s_type { - rpc_uint16 year; - u_char month; - u_char day_of_week; - u_char day; - u_char hour; - u_char minute; - u_char second; - rpc_uint16 millisecond; -}; -typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type; - -struct rpc_loc_parsed_position_s_type { - rpc_loc_position_valid_mask_type valid_mask; - rpc_loc_session_status_e_type session_status; - rpc_loc_calendar_time_s_type timestamp_calendar; - rpc_uint64 timestamp_utc; - rpc_uint8 leap_seconds; - float time_unc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float speed_horizontal; - float speed_vertical; - float heading; - float hor_unc_circular; - float hor_unc_ellipse_semi_major; - float hor_unc_ellipse_semi_minor; - float hor_unc_ellipse_orient_azimuth; - float vert_unc; - float speed_unc; - float heading_unc; - u_char confidence_horizontal; - u_char confidence_vertical; - float magnetic_deviation; - rpc_loc_pos_technology_mask_type technology_mask; -}; -typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type; - -enum rpc_loc_sv_system_e_type { - RPC_LOC_SV_SYSTEM_GPS = 1, - RPC_LOC_SV_SYSTEM_GALILEO = 2, - RPC_LOC_SV_SYSTEM_SBAS = 3, - RPC_LOC_SV_SYSTEM_COMPASS = 4, - RPC_LOC_SV_SYSTEM_GLONASS = 5, - RPC_LOC_SV_SYSTEM_MAX = 268435456, -}; -typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type; - -enum rpc_loc_sv_status_e_type { - RPC_LOC_SV_STATUS_IDLE = 1, - RPC_LOC_SV_STATUS_SEARCH = 2, - RPC_LOC_SV_STATUS_TRACK = 3, - RPC_LOC_SV_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type; - -typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; - -struct rpc_loc_sv_info_s_type { - rpc_loc_sv_info_valid_mask_type valid_mask; - rpc_loc_sv_system_e_type system; - rpc_uint8 prn; - rpc_uint8 health_status; - rpc_loc_sv_status_e_type process_status; - rpc_boolean has_eph; - rpc_boolean has_alm; - float elevation; - float azimuth; - float snr; -}; -typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type; - -typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; - -struct rpc_loc_gnss_info_s_type { - rpc_loc_gnss_info_valid_mask_type valid_mask; - float position_dop; - float horizontal_dop; - float vertical_dop; - rpc_boolean altitude_assumed; - rpc_uint16 sv_count; - struct { - u_int sv_list_len; - rpc_loc_sv_info_s_type *sv_list_val; - } sv_list; -}; -typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type; - -struct rpc_loc_nmea_report_s_type { - rpc_uint16 length; - char nmea_sentences[1200]; -}; -typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type; - -enum rpc_loc_status_event_e_type { - RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, - RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2, - RPC_LOC_STATUS_EVENT_MAX = 268435456, -}; -typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type; - -enum rpc_loc_engine_state_e_type { - RPC_LOC_ENGINE_STATE_ON = 1, - RPC_LOC_ENGINE_STATE_OFF = 2, - RPC_LOC_ENGINE_STATE_MAX = 268435456, -}; -typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type; - -enum rpc_loc_fix_session_state_e_type { - RPC_LOC_FIX_SESSION_STATE_BEGIN = 1, - RPC_LOC_FIX_SESSION_STATE_END = 2, - RPC_LOC_FIX_SESSION_STATE_MAX = 268435456, -}; -typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type; - -struct rpc_loc_status_event_payload_u_type { - rpc_loc_status_event_e_type disc; - union { - rpc_loc_engine_state_e_type engine_state; - rpc_loc_fix_session_state_e_type fix_session_state; - } rpc_loc_status_event_payload_u_type_u; -}; -typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type; - -struct rpc_loc_status_event_s_type { - rpc_loc_status_event_e_type event; - rpc_loc_status_event_payload_u_type payload; -}; -typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type; - -enum rpc_loc_server_addr_e_type { - RPC_LOC_SERVER_ADDR_IPV4 = 1, - RPC_LOC_SERVER_ADDR_URL = 2, - RPC_LOC_SERVER_ADDR_MAX = 268435456, -}; -typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type; - -struct rpc_loc_server_addr_ipv4_type { - rpc_uint32 addr; - rpc_uint16 port; -}; -typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type; - -struct rpc_loc_server_addr_url_type { - rpc_uint16 length; - char addr[256]; -}; -typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type; - -struct rpc_loc_server_addr_u_type { - rpc_loc_server_addr_e_type disc; - union { - rpc_loc_server_addr_ipv4_type ipv4; - rpc_loc_server_addr_url_type url; - } rpc_loc_server_addr_u_type_u; -}; -typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type; - -struct rpc_loc_server_info_s_type { - rpc_loc_server_addr_e_type addr_type; - rpc_loc_server_addr_u_type addr_info; -}; -typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type; - -enum rpc_loc_ni_notify_verify_e_type { - RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, - RPC_LOC_NI_USER_NOTIFY_ONLY = 2, - RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, - RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, - RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, - RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type; - -enum rpc_loc_ni_event_e_type { - RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, - RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, - RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, - RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4, - RPC_LOC_NI_EVENT_MAX = 268435456, -}; -typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type; - -enum rpc_loc_ni_datacoding_scheme_e_type { - RPC_LOC_NI_PRESUPL_ISO646IRV = 0, - RPC_LOC_NI_PRESUPL_ISO8859 = 1, - RPC_LOC_NI_PRESUPL_UTF8 = 2, - RPC_LOC_NI_PRESUPL_UTF16 = 3, - RPC_LOC_NI_PRESUPL_UCS2 = 4, - RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, - RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, - RPC_LOC_NI_PRESUPL_JIS = 7, - RPC_LOC_NI_PRESUPL_EUC = 8, - RPC_LOC_NI_PRESUPL_GB2312 = 9, - RPC_LOC_NI_PRESUPL_CNS11643 = 10, - RPC_LOC_NI_PRESUPL_KSC1001 = 11, - RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, - RPC_LOC_NI_SS_GERMAN = 12, - RPC_LOC_NI_SS_ENGLISH = 13, - RPC_LOC_NI_SS_ITALIAN = 14, - RPC_LOC_NI_SS_FRENCH = 15, - RPC_LOC_NI_SS_SPANISH = 16, - RPC_LOC_NI_SS_DUTCH = 17, - RPC_LOC_NI_SS_SWEDISH = 18, - RPC_LOC_NI_SS_DANISH = 19, - RPC_LOC_NI_SS_PORTUGUESE = 20, - RPC_LOC_NI_SS_FINNISH = 21, - RPC_LOC_NI_SS_NORWEGIAN = 22, - RPC_LOC_NI_SS_GREEK = 23, - RPC_LOC_NI_SS_TURKISH = 24, - RPC_LOC_NI_SS_HUNGARIAN = 25, - RPC_LOC_NI_SS_POLISH = 26, - RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, - RPC_LOC_NI_SUPL_UTF8 = 28, - RPC_LOC_NI_SUPL_UCS2 = 29, - RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, - RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647, -}; -typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type; - -enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { - RPC_LOC_NI_VX_OCTET = 0, - RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, - RPC_LOC_NI_VX_ASCII = 2, - RPC_LOC_NI_VX_IA5 = 3, - RPC_LOC_NI_VX_UNICODE = 4, - RPC_LOC_NI_VX_SHIFT_JIS = 5, - RPC_LOC_NI_VX_KOREAN = 6, - RPC_LOC_NI_VX_LATIN_HEBREW = 7, - RPC_LOC_NI_VX_LATIN = 8, - RPC_LOC_NI_VX_GSM = 9, - RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type; - -enum rpc_loc_ni_vx_pos_mode_e_type { - RPC_LOC_VX_MS_ASSISTED_ONLY = 1, - RPC_LOC_VX_MS_BASED_ONLY = 2, - RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, - RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, - RPC_LOC_VX_POS_MODE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type; - -struct rpc_loc_ni_vx_requester_id_s_type { - u_char requester_id_length; - char requester_id[200]; -}; -typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type; - -struct rpc_loc_ni_vx_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - u_char pos_qos_incl; - u_char pos_qos; - rpc_uint32 num_fixes; - rpc_uint32 tbf; - rpc_loc_ni_vx_pos_mode_e_type pos_mode; - rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; - rpc_loc_ni_vx_requester_id_s_type requester_id; - rpc_uint16 user_resp_timer_val; -}; -typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type; - -enum rpc_loc_ni_supl_pos_method_e_type { - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, - RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, - RPC_LOC_NI_POSMETHOD_AFLT = 6, - RPC_LOC_NI_POSMETHOD_ECID = 7, - RPC_LOC_NI_POSMETHOD_EOTD = 8, - RPC_LOC_NI_POSMETHOD_OTDOA = 9, - RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, - RPC_LOC_NI_POSMETHOD_MAX = 268435456, -}; -typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type; - -struct rpc_loc_ni_supl_slp_session_id_s_type { - u_char presence; - char session_id[4]; - rpc_loc_server_info_s_type slp_address; -}; -typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type; - -struct rpc_loc_ni_requestor_id_s_type { - u_char data_coding_scheme; - char requestor_id_string[200]; - u_char string_len; -}; -typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type; - -struct rpc_loc_ni_supl_client_name_s_type { - u_char data_coding_scheme; - char client_name_string[64]; - u_char string_len; -}; -typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type; - -struct rpc_loc_ni_supl_qop_s_type { - u_char bit_mask; - u_char horacc; - u_char veracc; - rpc_uint16 maxLocAge; - u_char delay; -}; -typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type; - -struct rpc_loc_ni_supl_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - rpc_uint16 flags; - rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; - char supl_hash[8]; - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_supl_pos_method_e_type pos_method; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_supl_client_name_s_type client_name; - rpc_loc_ni_supl_qop_s_type supl_qop; - rpc_uint16 user_response_timer; -}; -typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type; - -struct rpc_loc_ni_ext_client_address_s_type { - u_char ext_client_address_len; - char ext_client_address[20]; -}; -typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type; - -enum rpc_loc_ni_location_type_e_type { - RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, - RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, - RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, - RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type; - -struct rpc_loc_ni_deferred_location_s_type { - u_char unused_bits; - u_char ms_available; -}; -typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type; - -struct rpc_loc_ni_codeword_string_s_type { - u_char data_coding_scheme; - char lcs_codeword_string[20]; - u_char string_len; -}; -typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type; - -struct rpc_loc_ni_service_type_id_s_type { - u_char lcs_service_type_id; -}; -typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type; - -struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - u_char invoke_id; - rpc_uint16 flags; - u_char notification_length; - char notification_text[64]; - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_ext_client_address_s_type ext_client_address_data; - rpc_loc_ni_location_type_e_type location_type; - rpc_loc_ni_deferred_location_s_type deferred_location; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_codeword_string_s_type codeword_string; - rpc_loc_ni_service_type_id_s_type service_type_id; - rpc_uint16 user_response_timer; -}; -typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type; - -enum rpc_loc_ni_service_interaction_e_type { - RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1, - RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456, -}; -typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type; - -struct rpc_loc_ni_vx_service_interaction_req_s_type { - rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req; - rpc_loc_ni_service_interaction_e_type service_interation_type; -}; -typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type; - -struct rpc_loc_ni_event_payload_u_type { - rpc_loc_ni_event_e_type disc; - union { - rpc_loc_ni_vx_notify_verify_req_s_type vx_req; - rpc_loc_ni_supl_notify_verify_req_s_type supl_req; - rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; - rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req; - } rpc_loc_ni_event_payload_u_type_u; -}; -typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type; - -struct rpc_loc_ni_event_s_type { - rpc_loc_ni_event_e_type event; - rpc_loc_ni_event_payload_u_type payload; -}; -typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type; - -enum rpc_loc_assist_data_request_e_type { - RPC_LOC_ASSIST_DATA_TIME_REQ = 1, - RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, - RPC_LOC_ASSIST_DATA_MAX = 268435456, -}; -typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type; - -typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr; - -typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; - -struct rpc_loc_time_download_source_s_type { - rpc_uint32 delay_threshold; - rpc_struct_loc_time_download_source_s_type_servers servers; -}; -typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type; - -typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; - -typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; - -struct rpc_loc_predicted_orbits_data_source_s_type { - rpc_uint32 max_file_size; - rpc_uint32 max_part_size; - rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; -}; -typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type; - -struct rpc_loc_assist_data_request_payload_u_type { - rpc_loc_assist_data_request_e_type disc; - union { - rpc_loc_time_download_source_s_type time_download; - rpc_loc_predicted_orbits_data_source_s_type data_download; - } rpc_loc_assist_data_request_payload_u_type_u; -}; -typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type; - -struct rpc_loc_assist_data_request_s_type { - rpc_loc_assist_data_request_e_type event; - rpc_loc_assist_data_request_payload_u_type payload; -}; -typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type; - -typedef rpc_uint32 rpc_loc_server_connection_handle; - -enum rpc_loc_server_protocol_e_type { - RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, - RPC_LOC_SERVER_PROTOCOL_SUPL = 1, - RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, - RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, - RPC_LOC_SERVER_PROTOCOL_MAX = 16777216, -}; -typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type; - -enum rpc_loc_server_request_e_type { - RPC_LOC_SERVER_REQUEST_OPEN = 1, - RPC_LOC_SERVER_REQUEST_CLOSE = 2, - RPC_LOC_SERVER_REQUEST_MAX = 268435456, -}; -typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type; - -struct rpc_loc_server_open_req_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_protocol_e_type protocol; -}; -typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type; - -struct rpc_loc_server_close_req_s_type { - rpc_loc_server_connection_handle conn_handle; -}; -typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type; - -struct rpc_loc_server_request_u_type { - rpc_loc_server_request_e_type disc; - union { - rpc_loc_server_open_req_s_type open_req; - rpc_loc_server_close_req_s_type close_req; - } rpc_loc_server_request_u_type_u; -}; -typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type; - -struct rpc_loc_server_request_s_type { - rpc_loc_server_request_e_type event; - rpc_loc_server_request_u_type payload; -}; -typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type; - -enum rpc_loc_qwip_request_e_type { - RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0, - RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1, - RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2, - RPC_LOC_QWIP_SUSPEND = 0 + 3, - RPC_LOC_QWIP_REQUEST_MAX = 268435456, -}; -typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type; - -struct rpc_loc_qwip_request_s_type { - rpc_loc_qwip_request_e_type request_type; - rpc_uint16 tbf_ms; -}; -typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type; - -struct rpc_loc_reserved_payload_s_type { - rpc_uint16 data_size; - struct { - u_int data_len; - char *data_val; - } data; -}; -typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type; - -enum rpc_loc_ioctl_e_type { - RPC_LOC_IOCTL_GET_API_VERSION = 1, - RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, - RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, - RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, - RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, - RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, - RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, - RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, - RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, - RPC_LOC_IOCTL_INJECT_POSITION = 407, - RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, - RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, - RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, - RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411, - RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412, - RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413, - RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, - RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, - RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, - RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, - RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, - RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, - RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, - RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, - RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, - RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, - RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, - RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, - RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, - RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, - RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, - RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, - RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, - RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, - RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, - RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824, -}; -typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type; - -struct rpc_loc_api_version_s_type { - u_char major; - u_char minor; -}; -typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type; - -enum rpc_loc_fix_recurrence_e_type { - RPC_LOC_PERIODIC_FIX = 1, - RPC_LOC_SINGLE_FIX = 2, - RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type; - -enum rpc_loc_operation_mode_e_type { - RPC_LOC_OPER_MODE_DEFAULT = 1, - RPC_LOC_OPER_MODE_MSB = 2, - RPC_LOC_OPER_MODE_MSA = 3, - RPC_LOC_OPER_MODE_STANDALONE = 4, - RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, - RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, - RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, - RPC_LOC_OPER_MODE_CELL_ID = 8, - RPC_LOC_OPER_MODE_MAX = 268435456, -}; -typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type; - -enum rpc_loc_notify_e_type { - RPC_LOC_NOTIFY_ON_INTERVAL = 1, - RPC_LOC_NOTIFY_ON_DISTANCE = 2, - RPC_LOC_NOTIFY_ON_ANY = 3, - RPC_LOC_NOTIFY_ON_ALL = 4, - RPC_LOC_NOTIFY_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type; - -struct rpc_loc_fix_criteria_s_type { - rpc_uint32 valid_mask; - rpc_loc_fix_recurrence_e_type recurrence_type; - rpc_loc_operation_mode_e_type preferred_operation_mode; - rpc_uint32 preferred_accuracy; - rpc_uint32 preferred_response_time; - rpc_boolean intermediate_pos_report_enabled; - rpc_loc_notify_e_type notify_type; - rpc_uint32 min_interval; - float min_distance; - rpc_uint32 min_dist_sample_interval; -}; -typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type; - -enum rpc_loc_ni_user_resp_e_type { - RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456, -}; -typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type; - -struct rpc_loc_user_verify_s_type { - rpc_loc_ni_user_resp_e_type user_resp; - rpc_loc_ni_event_s_type ni_event_pass_back; -}; -typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type; - -enum rpc_loc_predicted_orbits_data_format_e_type { - RPC_LOC_PREDICTED_ORBITS_XTRA = 0, - RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456, -}; -typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type; - -struct rpc_loc_predicted_orbits_data_s_type { - rpc_loc_predicted_orbits_data_format_e_type format_type; - rpc_uint32 total_size; - rpc_uint8 total_parts; - rpc_uint8 part; - rpc_uint16 part_len; - struct { - u_int data_ptr_len; - char *data_ptr_val; - } data_ptr; -}; -typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type; - -struct rpc_loc_predicted_orbits_data_validity_report_s_type { - rpc_uint64 start_time_utc; - rpc_uint16 valid_duration_hrs; -}; -typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type; - -struct rpc_loc_predicted_orbits_auto_download_config_s_type { - rpc_boolean enable; - u_char auto_check_every_hrs; -}; -typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type; - -struct rpc_loc_assist_data_time_s_type { - rpc_uint64 time_utc; - rpc_uint32 uncertainty; -}; -typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type; - -typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; - -struct rpc_loc_assist_data_pos_s_type { - rpc_loc_assist_pos_valid_mask_type valid_mask; - rpc_uint64 timestamp_utc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float hor_unc_circular; - float vert_unc; - u_char confidence_horizontal; - u_char confidence_vertical; - rpc_int32 timestamp_age; -}; -typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type; - -enum rpc_loc_server_open_status_e_type { - RPC_LOC_SERVER_OPEN_SUCCESS = 1, - RPC_LOC_SERVER_OPEN_FAIL = 2, - RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type; - -struct rpc_loc_server_open_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_open_status_e_type open_status; - char apn_name[100]; -}; -typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type; - -enum rpc_loc_server_close_status_e_type { - RPC_LOC_SERVER_CLOSE_SUCCESS = 1, - RPC_LOC_SERVER_CLOSE_FAIL = 2, - RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type; - -struct rpc_loc_server_close_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_close_status_e_type close_status; -}; -typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type; - -struct rpc_loc_wiper_fix_time_s_type { - rpc_uint32 slow_clock_count; -}; -typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type; - -struct rpc_loc_wiper_fix_pos_s_type { - rpc_int32 lat; - rpc_int32 lon; - rpc_uint16 HEPE; - rpc_uint8 num_of_aps_used; - rpc_uint8 fix_error_code; -}; -typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type; - -struct rpc_loc_wiper_ap_info_s_type { - char mac_addr[6]; - rpc_int32 rssi; - rpc_uint16 channel; - rpc_uint8 ap_qualifier; -}; -typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type; - -struct rpc_loc_wiper_ap_set_s_type { - rpc_uint8 num_of_aps; - rpc_loc_wiper_ap_info_s_type ap_info[50]; -}; -typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type; - -struct rpc_loc_wiper_position_report_s_type { - rpc_uint8 wiper_valid_info_flag; - rpc_loc_wiper_fix_time_s_type wiper_fix_time; - rpc_loc_wiper_fix_pos_s_type wiper_fix_position; - rpc_loc_wiper_ap_set_s_type wiper_ap_set; -}; -typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type; - -enum rpc_loc_wiper_status_e_type { - RPC_LOC_WIPER_STATUS_AVAILABLE = 1, - RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2, - RPC_LOC_WIPER_STATUS_E_SIZE = 268435456, -}; -typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type; - -enum rpc_loc_fs_operation_e_type { - RPC_LOC_FS_CREATE_WRITE_FILE = 1, - RPC_LOC_FS_APPEND_FILE = 2, - RPC_LOC_FS_DELETE_FILE = 3, - RPC_LOC_FS_READ_FILE = 4, - RPC_LOC_FS_MAX = 268435456, -}; -typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type; - -struct rpc_loc_efs_data_s_type { - char filename[64]; - rpc_loc_fs_operation_e_type operation; - rpc_uint32 total_size; - struct { - u_int data_ptr_len; - char *data_ptr_val; - } data_ptr; - rpc_uint32 part_len; - rpc_uint8 part; - rpc_uint8 total_parts; - rpc_uint32 reserved; -}; -typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type; - -enum rpc_loc_lock_e_type { - RPC_LOC_LOCK_NONE = 1, - RPC_LOC_LOCK_MI = 2, - RPC_LOC_LOCK_MT = 3, - RPC_LOC_LOCK_ALL = 4, - RPC_LOC_LOCK_MAX = 268435456, -}; -typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type; - -typedef rpc_uint32 rpc_loc_nmea_sentence_type; - -typedef rpc_uint32 rpc_loc_assist_data_type; - -struct rpc_loc_assist_data_delete_s_type { - rpc_loc_assist_data_type type; - rpc_uint32 reserved[8]; -}; -typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type; - -struct rpc_loc_ioctl_data_u_type { - rpc_loc_ioctl_e_type disc; - union { - rpc_loc_fix_criteria_s_type fix_criteria; - rpc_loc_user_verify_s_type user_verify_resp; - rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; - rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; - rpc_loc_assist_data_time_s_type assistance_data_time; - rpc_loc_assist_data_pos_s_type assistance_data_position; - rpc_loc_server_open_status_s_type conn_open_status; - rpc_loc_server_close_status_s_type conn_close_status; - rpc_loc_wiper_position_report_s_type wiper_pos; - rpc_loc_wiper_status_e_type wiper_status; - rpc_loc_lock_e_type engine_lock; - rpc_boolean sbas_mode; - rpc_loc_nmea_sentence_type nmea_types; - rpc_boolean on_demand_lpm; - rpc_loc_server_info_s_type server_addr; - rpc_loc_assist_data_delete_s_type assist_data_delete; - rpc_loc_efs_data_s_type efs_data; - } rpc_loc_ioctl_data_u_type_u; -}; -typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type; - -struct rpc_loc_ioctl_callback_data_u_type { - rpc_loc_ioctl_e_type disc; - union { - rpc_loc_api_version_s_type api_version; - rpc_loc_fix_criteria_s_type fix_criteria; - rpc_loc_lock_e_type engine_lock; - rpc_boolean sbas_mode; - rpc_loc_nmea_sentence_type nmea_types; - rpc_boolean on_demand_lpm; - rpc_loc_server_info_s_type server_addr; - rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; - rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; - } rpc_loc_ioctl_callback_data_u_type_u; -}; -typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type; - -struct rpc_loc_ioctl_callback_s_type { - rpc_loc_ioctl_e_type type; - rpc_int32 status; - rpc_loc_ioctl_callback_data_u_type data; -}; -typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type; - -struct rpc_loc_event_payload_u_type { - u_quad_t disc; - union { - rpc_loc_parsed_position_s_type parsed_location_report; - rpc_loc_gnss_info_s_type gnss_report; - rpc_loc_nmea_report_s_type nmea_report; - rpc_loc_ni_event_s_type ni_request; - rpc_loc_assist_data_request_s_type assist_data_request; - rpc_loc_server_request_s_type loc_server_request; - rpc_loc_ioctl_callback_s_type ioctl_report; - rpc_loc_status_event_s_type status_report; - rpc_loc_qwip_request_s_type qwip_request; - rpc_loc_reserved_payload_s_type reserved; - } rpc_loc_event_payload_u_type_u; -}; -typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type; - -/* the xdr functions */ - -#if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*); -extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*); -extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*); -extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*); -extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*); -extern bool_t xdr_rpc_byte (XDR *, rpc_byte*); -extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*); -extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*); -extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*); -extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*); -extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*); -extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*); -extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*); -extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*); -extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*); -extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*); -extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*); -extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*); -extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*); -extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*); -extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*); -extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*); -extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*); -extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*); -extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*); -extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*); -extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*); -extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*); -extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*); -extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*); -extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*); -extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*); -extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*); -extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*); -extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*); -extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*); -extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*); -extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*); -extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*); -extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*); -extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*); -extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*); -extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*); -extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*); -extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*); -extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*); -extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers); -extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers); -extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*); -extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*); -extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*); -extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*); -extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*); -extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*); -extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*); -extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*); -extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*); -extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*); -extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*); -extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*); -extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*); -extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*); -extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*); -extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*); -extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*); -extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*); -extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*); -extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*); -extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*); -extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*); -extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*); -extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*); -extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*); -extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*); -extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*); -extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*); -extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*); -extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*); -extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*); -extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*); -extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*); -extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*); -extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*); -extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*); -extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*); -extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*); -extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*); -extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*); -extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*); -extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*); -extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*); -extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*); - -#else /* K&R C */ -extern bool_t xdr_rpc_boolean (); -extern bool_t xdr_rpc_uint32 (); -extern bool_t xdr_rpc_uint16 (); -extern bool_t xdr_rpc_uint8 (); -extern bool_t xdr_rpc_int32 (); -extern bool_t xdr_rpc_byte (); -extern bool_t xdr_rpc_uint64 (); -extern bool_t xdr_rpc_loc_client_handle_type (); -extern bool_t xdr_rpc_loc_event_mask_type (); -extern bool_t xdr_rpc_loc_position_valid_mask_type (); -extern bool_t xdr_rpc_loc_pos_technology_mask_type (); -extern bool_t xdr_rpc_loc_session_status_e_type (); -extern bool_t xdr_rpc_loc_calendar_time_s_type (); -extern bool_t xdr_rpc_loc_parsed_position_s_type (); -extern bool_t xdr_rpc_loc_sv_system_e_type (); -extern bool_t xdr_rpc_loc_sv_status_e_type (); -extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (); -extern bool_t xdr_rpc_loc_sv_info_s_type (); -extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (); -extern bool_t xdr_rpc_loc_gnss_info_s_type (); -extern bool_t xdr_rpc_loc_nmea_report_s_type (); -extern bool_t xdr_rpc_loc_status_event_e_type (); -extern bool_t xdr_rpc_loc_engine_state_e_type (); -extern bool_t xdr_rpc_loc_fix_session_state_e_type (); -extern bool_t xdr_rpc_loc_status_event_payload_u_type (); -extern bool_t xdr_rpc_loc_status_event_s_type (); -extern bool_t xdr_rpc_loc_server_addr_e_type (); -extern bool_t xdr_rpc_loc_server_addr_ipv4_type (); -extern bool_t xdr_rpc_loc_server_addr_url_type (); -extern bool_t xdr_rpc_loc_server_addr_u_type (); -extern bool_t xdr_rpc_loc_server_info_s_type (); -extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (); -extern bool_t xdr_rpc_loc_ni_event_e_type (); -extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (); -extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (); -extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (); -extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (); -extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (); -extern bool_t xdr_rpc_loc_ni_location_type_e_type (); -extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (); -extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (); -extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (); -extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (); -extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (); -extern bool_t xdr_rpc_loc_ni_event_payload_u_type (); -extern bool_t xdr_rpc_loc_ni_event_s_type (); -extern bool_t xdr_rpc_loc_assist_data_request_e_type (); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (); -extern bool_t xdr_rpc_loc_time_download_source_s_type (); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (); -extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (); -extern bool_t xdr_rpc_loc_assist_data_request_s_type (); -extern bool_t xdr_rpc_loc_server_connection_handle (); -extern bool_t xdr_rpc_loc_server_protocol_e_type (); -extern bool_t xdr_rpc_loc_server_request_e_type (); -extern bool_t xdr_rpc_loc_server_open_req_s_type (); -extern bool_t xdr_rpc_loc_server_close_req_s_type (); -extern bool_t xdr_rpc_loc_server_request_u_type (); -extern bool_t xdr_rpc_loc_server_request_s_type (); -extern bool_t xdr_rpc_loc_qwip_request_e_type (); -extern bool_t xdr_rpc_loc_qwip_request_s_type (); -extern bool_t xdr_rpc_loc_reserved_payload_s_type (); -extern bool_t xdr_rpc_loc_ioctl_e_type (); -extern bool_t xdr_rpc_loc_api_version_s_type (); -extern bool_t xdr_rpc_loc_fix_recurrence_e_type (); -extern bool_t xdr_rpc_loc_operation_mode_e_type (); -extern bool_t xdr_rpc_loc_notify_e_type (); -extern bool_t xdr_rpc_loc_fix_criteria_s_type (); -extern bool_t xdr_rpc_loc_ni_user_resp_e_type (); -extern bool_t xdr_rpc_loc_user_verify_s_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (); -extern bool_t xdr_rpc_loc_assist_data_time_s_type (); -extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (); -extern bool_t xdr_rpc_loc_assist_data_pos_s_type (); -extern bool_t xdr_rpc_loc_server_open_status_e_type (); -extern bool_t xdr_rpc_loc_server_open_status_s_type (); -extern bool_t xdr_rpc_loc_server_close_status_e_type (); -extern bool_t xdr_rpc_loc_server_close_status_s_type (); -extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (); -extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (); -extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (); -extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (); -extern bool_t xdr_rpc_loc_wiper_position_report_s_type (); -extern bool_t xdr_rpc_loc_wiper_status_e_type (); -extern bool_t xdr_rpc_loc_fs_operation_e_type (); -extern bool_t xdr_rpc_loc_efs_data_s_type (); -extern bool_t xdr_rpc_loc_lock_e_type (); -extern bool_t xdr_rpc_loc_nmea_sentence_type (); -extern bool_t xdr_rpc_loc_assist_data_type (); -extern bool_t xdr_rpc_loc_assist_data_delete_s_type (); -extern bool_t xdr_rpc_loc_ioctl_data_u_type (); -extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (); -extern bool_t xdr_rpc_loc_ioctl_callback_s_type (); -extern bool_t xdr_rpc_loc_event_payload_u_type (); - -#endif /* K&R C */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_LOC_API_COMMON_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h deleted file mode 100644 index e62eb367..00000000 --- a/loc_api/libloc_api-rpc/inc-1240/loc_api_fixup.h +++ /dev/null @@ -1,188 +0,0 @@ -/****************************************************************************** - @file: loc_api_fixup.h - @brief: Loc API Android RPC amendment header - - DESCRIPTION - Loc API Android RPC amendment header - - INITIALIZATION AND SEQUENCING REQUIREMENTS - - ----------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------------- - ******************************************************************************/ - -#ifndef LOC_API_FIXUP_H -#define LOC_API_FIXUP_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef NULLPROC -#define NULLPROC 0 -#endif /* NULLPROC */ - -#ifdef ADD_XDR_FLOAT - -extern bool_t xdr_float (XDR *__xdrs, float *__fp); -extern bool_t xdr_double (XDR *__xdrs, double *__dp); - -#endif /* ADD_XDR_FLOAT */ - -#ifdef ADD_XDR_BOOL -extern bool_t xdr_bool(XDR *__xdrs, int *__bp); -#endif /* ADD_XDR_BOOL */ - -#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1 -#define RPC_LOC_API_MINOR_VERSION_NUMBER 0 - -// Return value for loc_open in case of failure. -#define RPC_LOC_CLIENT_HANDLE_INVALID -1 - -// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl -// These are also the status for the ioctl callback -#define RPC_LOC_API_SUCCESS 0 -#define RPC_LOC_API_GENERAL_FAILURE 1 -#define RPC_LOC_API_UNSUPPORTED 2 -#define RPC_LOC_API_INVALID_HANDLE 4 -#define RPC_LOC_API_INVALID_PARAMETER 5 -#define RPC_LOC_API_ENGINE_BUSY 6 -#define RPC_LOC_API_PHONE_OFFLINE 7 -#define RPC_LOC_API_TIMEOUT 8 - -// Special return value for loc api calls in case of RCP failure -#define RPC_LOC_API_RPC_FAILURE (-1234) - -#define RPC_LOC_API_MAX_SV_COUNT 80 -#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200 - -// Maximum server address that will be used in location API -#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256 -#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3 -#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3 - -#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type -#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report -#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate -#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate -#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request -#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request -#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server -#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl -#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state - - -#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001 -#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002 -#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004 -#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008 -#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010 -#define RPC_LOC_POS_VALID_LATITUDE 0x00000020 -#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040 -#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080 -#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100 -#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200 -#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400 -#define RPC_LOC_POS_VALID_HEADING 0x00000800 -#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000 -#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000 -#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000 -#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000 -#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000 -#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000 -#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000 -#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000 -#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000 -#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000 -#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000 - -#define RPC_LOC_POS_TECH_SATELLITE 0x00000001 -#define RPC_LOC_POS_TECH_CELLID 0x00000002 -#define RPC_LOC_POS_TECH_WIFI 0x00000004 - -#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001 -#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002 -#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004 -#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008 -#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010 -#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020 -#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040 -#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080 -#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100 - -#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001 -#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002 -#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004 -#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008 -#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010 -#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020 - -#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200 -#define RPC_LOC_NI_SUPL_HASH_LENGTH 8 -#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4 -#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64 -#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20 -#define RPC_LOC_NI_CODEWORD_LENGTH 20 - -#define RPC_LOC_NI_SUPL_QOP_VALID 0x01 -#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02 -#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04 -#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08 - -#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001 -#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002 -#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004 -#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008 -#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010 -#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020 -#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040 -#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080 -#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100 - -#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001 -#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002 -#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004 -#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008 -#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010 -#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020 -#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040 -#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080 -#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100 - -#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF - -#define RPC_LOC_NMEA_MASK_ALL 0xffff -#define RPC_LOC_NMEA_MASK_GGA 0x0001 -#define RPC_LOC_NMEA_MASK_RMC 0x0002 -#define RPC_LOC_NMEA_MASK_GSV 0x0004 -#define RPC_LOC_NMEA_MASK_GSA 0x0008 -#define RPC_LOC_NMEA_MASK_VTG 0x0010 - -/* flags for notification */ -#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001 -#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002 -#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010 -#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020 -#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040 -#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080 -#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100 - -#ifdef __cplusplus -} -#endif - -#endif /* LOC_API_FIXUP_H */ diff --git a/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h deleted file mode 100644 index 92d4e150..00000000 --- a/loc_api/libloc_api-rpc/inc-1240/loc_apicb_appinit.h +++ /dev/null @@ -1,34 +0,0 @@ -/* ------------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------- - */ - -#ifndef LOC_APICB_APPINIT_H -#define LOC_APICB_APPINIT_H - -#ifdef __cplusplus -extern "C" -{ -#endif - - /* Initialization function for callbacks */ -extern int loc_apicb_app_init(); -extern void loc_apicb_app_deinit(); - -#ifdef __cplusplus -} -#endif - -#endif /* LOC_APICB_APPINIT_H */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api.h b/loc_api/libloc_api-rpc/inc-3200/loc_api.h deleted file mode 100644 index 8998aca4..00000000 --- a/loc_api/libloc_api-rpc/inc-3200/loc_api.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _LOC_API_H_RPCGEN -#define _LOC_API_H_RPCGEN - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct { - u_int rpc_loc_api_api_versions_return_type_len; - rpc_uint32 *rpc_loc_api_api_versions_return_type_val; -} rpc_loc_api_api_versions_return_type; - -typedef rpc_uint32 rpc_loc_event_cb_f_type; - -struct rpc_loc_open_args { - rpc_loc_event_mask_type event_reg_mask; - rpc_loc_event_cb_f_type event_callback; -}; -typedef struct rpc_loc_open_args rpc_loc_open_args; - -struct rpc_loc_close_args { - rpc_loc_client_handle_type handle; -}; -typedef struct rpc_loc_close_args rpc_loc_close_args; - -struct rpc_loc_start_fix_args { - rpc_loc_client_handle_type handle; -}; -typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args; - -struct rpc_loc_stop_fix_args { - rpc_loc_client_handle_type handle; -}; -typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args; - -struct rpc_loc_ioctl_args { - rpc_loc_client_handle_type handle; - rpc_loc_ioctl_e_type ioctl_type; - rpc_loc_ioctl_data_u_type *ioctl_data; -}; -typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args; - -struct rpc_loc_api_api_version_s_args { - rpc_boolean len_not_null; -}; -typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args; - -struct rpc_loc_api_rpc_glue_code_info_remote_rets { - rpc_uint32 toolvers; - rpc_uint32 features; - rpc_uint32 proghash; - rpc_uint32 cbproghash; -}; -typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets; - -struct rpc_loc_open_rets { - rpc_loc_client_handle_type loc_open_result; -}; -typedef struct rpc_loc_open_rets rpc_loc_open_rets; - -struct rpc_loc_close_rets { - rpc_int32 loc_close_result; -}; -typedef struct rpc_loc_close_rets rpc_loc_close_rets; - -struct rpc_loc_start_fix_rets { - rpc_int32 loc_start_fix_result; -}; -typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets; - -struct rpc_loc_stop_fix_rets { - rpc_int32 loc_stop_fix_result; -}; -typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets; - -struct rpc_loc_ioctl_rets { - rpc_int32 loc_ioctl_result; -}; -typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets; - -struct rpc_loc_api_api_versions_rets { - rpc_loc_api_api_versions_return_type loc_api_api_versions_result; - rpc_uint32 *len; -}; -typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets; -#define LOC_APIVERS 0x00010001 - -#define LOC_APIPROG 0x3000008c -#define LOC_APIVERS_0001 0x00010001 - -#if defined(__STDC__) || defined(__cplusplus) -#define rpc_loc_api_null 0 -extern enum clnt_stat rpc_loc_api_null_0x00010001(void *, void *, CLIENT *); -extern bool_t rpc_loc_api_null_0x00010001_svc(void *, void *, struct svc_req *); -#define rpc_loc_api_rpc_glue_code_info_remote 1 -extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *); -extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *); -#define rpc_loc_open 2 -extern enum clnt_stat rpc_loc_open_0x00010001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *); -extern bool_t rpc_loc_open_0x00010001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *); -#define rpc_loc_close 3 -extern enum clnt_stat rpc_loc_close_0x00010001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *); -extern bool_t rpc_loc_close_0x00010001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *); -#define rpc_loc_start_fix 4 -extern enum clnt_stat rpc_loc_start_fix_0x00010001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *); -extern bool_t rpc_loc_start_fix_0x00010001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *); -#define rpc_loc_stop_fix 5 -extern enum clnt_stat rpc_loc_stop_fix_0x00010001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *); -extern bool_t rpc_loc_stop_fix_0x00010001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *); -#define rpc_loc_ioctl 6 -extern enum clnt_stat rpc_loc_ioctl_0x00010001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *); -extern bool_t rpc_loc_ioctl_0x00010001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *); -#define rpc_loc_api_api_versions 0xFFFFFFFF -extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(void *, rpc_loc_api_api_versions_rets *, CLIENT *); -extern bool_t rpc_loc_api_api_versions_0x00010001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *); -extern int loc_apiprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); - -#else /* K&R C */ -#define rpc_loc_api_null 0 -extern enum clnt_stat rpc_loc_api_null_0x00010001(); -extern bool_t rpc_loc_api_null_0x00010001_svc(); -#define rpc_loc_api_rpc_glue_code_info_remote 1 -extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00010001(); -extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00010001_svc(); -#define rpc_loc_open 2 -extern enum clnt_stat rpc_loc_open_0x00010001(); -extern bool_t rpc_loc_open_0x00010001_svc(); -#define rpc_loc_close 3 -extern enum clnt_stat rpc_loc_close_0x00010001(); -extern bool_t rpc_loc_close_0x00010001_svc(); -#define rpc_loc_start_fix 4 -extern enum clnt_stat rpc_loc_start_fix_0x00010001(); -extern bool_t rpc_loc_start_fix_0x00010001_svc(); -#define rpc_loc_stop_fix 5 -extern enum clnt_stat rpc_loc_stop_fix_0x00010001(); -extern bool_t rpc_loc_stop_fix_0x00010001_svc(); -#define rpc_loc_ioctl 6 -extern enum clnt_stat rpc_loc_ioctl_0x00010001(); -extern bool_t rpc_loc_ioctl_0x00010001_svc(); -#define rpc_loc_api_api_versions 0xFFFFFFFF -extern enum clnt_stat rpc_loc_api_api_versions_0x00010001(); -extern bool_t rpc_loc_api_api_versions_0x00010001_svc(); -extern int loc_apiprog_0x00010001_freeresult (); -#endif /* K&R C */ - -/* the xdr functions */ - -#if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*); -extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*); -extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*); -extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*); -extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*); -extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*); -extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*); -extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*); -extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*); -extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*); -extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*); -extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*); -extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*); -extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*); -extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*); - -#else /* K&R C */ -extern bool_t xdr_rpc_loc_api_api_versions_return_type (); -extern bool_t xdr_rpc_loc_event_cb_f_type (); -extern bool_t xdr_rpc_loc_open_args (); -extern bool_t xdr_rpc_loc_close_args (); -extern bool_t xdr_rpc_loc_start_fix_args (); -extern bool_t xdr_rpc_loc_stop_fix_args (); -extern bool_t xdr_rpc_loc_ioctl_args (); -extern bool_t xdr_rpc_loc_api_api_version_s_args (); -extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (); -extern bool_t xdr_rpc_loc_open_rets (); -extern bool_t xdr_rpc_loc_close_rets (); -extern bool_t xdr_rpc_loc_start_fix_rets (); -extern bool_t xdr_rpc_loc_stop_fix_rets (); -extern bool_t xdr_rpc_loc_ioctl_rets (); -extern bool_t xdr_rpc_loc_api_api_versions_rets (); - -#endif /* K&R C */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_LOC_API_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h deleted file mode 100644 index 4f2f8f91..00000000 --- a/loc_api/libloc_api-rpc/inc-3200/loc_api_cb.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _LOC_API_CB_H_RPCGEN -#define _LOC_API_CB_H_RPCGEN - -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -struct rpc_loc_event_cb_f_type_args { - rpc_uint32 cb_id; - rpc_loc_client_handle_type loc_handle; - rpc_loc_event_mask_type loc_event; - rpc_loc_event_payload_u_type *loc_event_payload; -}; -typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args; - -struct rpc_loc_event_cb_f_type_rets { - rpc_int32 loc_event_cb_f_type_result; -}; -typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets; -#define LOC_APICBVERS 0x00010001 - -#define LOC_APICBPROG 0x3100008c -#define LOC_APICBVERS_0001 0x00010001 - -#if defined(__STDC__) || defined(__cplusplus) -#define rpc_loc_event_cb_f_type 1 -extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *); -extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *); -extern int loc_apicbprog_0x00010001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); - -#else /* K&R C */ -#define rpc_loc_event_cb_f_type 1 -extern enum clnt_stat rpc_loc_event_cb_f_type_0x00010001(); -extern bool_t rpc_loc_event_cb_f_type_0x00010001_svc(); -extern int loc_apicbprog_0x00010001_freeresult (); -#endif /* K&R C */ - -/* the xdr functions */ - -#if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*); -extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*); - -#else /* K&R C */ -extern bool_t xdr_rpc_loc_event_cb_f_type_args (); -extern bool_t xdr_rpc_loc_event_cb_f_type_rets (); - -#endif /* K&R C */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_LOC_API_CB_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h deleted file mode 100644 index 04be079f..00000000 --- a/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h +++ /dev/null @@ -1,1031 +0,0 @@ -/* - * Please do not edit this file. - * It was generated using rpcgen. - */ - -#ifndef _LOC_API_COMMON_H_RPCGEN -#define _LOC_API_COMMON_H_RPCGEN - -#include -#include "loc_api_fixup.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 -#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 -#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 -#define RPC_LOC_EVENT_RESERVED 0x8000000000000000 -#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 -#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 -#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 -#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 -#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 -#define RPC_LOC_OPEN_VERSION 0x00010001 -#define RPC_LOC_CLOSE_VERSION 0x00010001 -#define RPC_LOC_START_FIX_VERSION 0x00010001 -#define RPC_LOC_STOP_FIX_VERSION 0x00010001 -#define RPC_LOC_IOCTL_VERSION 0x00010001 -#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00010001 -#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0 -#define RPC_LOC_API_API_MAJOR_NUM 0x0001 - -typedef bool_t rpc_boolean; - -typedef u_long rpc_uint32; - -typedef u_short rpc_uint16; - -typedef u_char rpc_uint8; - -typedef long rpc_int32; - -typedef u_char rpc_byte; - -typedef u_quad_t rpc_uint64; - -typedef rpc_int32 rpc_loc_client_handle_type; - -typedef rpc_uint64 rpc_loc_event_mask_type; - -typedef rpc_uint64 rpc_loc_position_valid_mask_type; - -typedef rpc_uint32 rpc_loc_pos_technology_mask_type; - -enum rpc_loc_session_status_e_type { - RPC_LOC_SESS_STATUS_SUCCESS = 0, - RPC_LOC_SESS_STATUS_IN_PROGESS = 1, - RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, - RPC_LOC_SESS_STATUS_TIMEOUT = 3, - RPC_LOC_SESS_STATUS_USER_END = 4, - RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, - RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, - RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, - RPC_LOC_SESS_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type; - -struct rpc_loc_calendar_time_s_type { - rpc_uint16 year; - u_char month; - u_char day_of_week; - u_char day; - u_char hour; - u_char minute; - u_char second; - rpc_uint16 millisecond; -}; -typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type; - -struct rpc_loc_parsed_position_s_type { - rpc_loc_position_valid_mask_type valid_mask; - rpc_loc_session_status_e_type session_status; - rpc_loc_calendar_time_s_type timestamp_calendar; - rpc_uint64 timestamp_utc; - rpc_uint8 leap_seconds; - float time_unc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float speed_horizontal; - float speed_vertical; - float heading; - float hor_unc_circular; - float hor_unc_ellipse_semi_major; - float hor_unc_ellipse_semi_minor; - float hor_unc_ellipse_orient_azimuth; - float vert_unc; - float speed_unc; - float heading_unc; - u_char confidence_horizontal; - u_char confidence_vertical; - float magnetic_deviation; - rpc_loc_pos_technology_mask_type technology_mask; -}; -typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type; - -enum rpc_loc_sv_system_e_type { - RPC_LOC_SV_SYSTEM_GPS = 1, - RPC_LOC_SV_SYSTEM_GALILEO = 2, - RPC_LOC_SV_SYSTEM_SBAS = 3, - RPC_LOC_SV_SYSTEM_COMPASS = 4, - RPC_LOC_SV_SYSTEM_GLONASS = 5, - RPC_LOC_SV_SYSTEM_MAX = 268435456, -}; -typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type; - -enum rpc_loc_sv_status_e_type { - RPC_LOC_SV_STATUS_IDLE = 1, - RPC_LOC_SV_STATUS_SEARCH = 2, - RPC_LOC_SV_STATUS_TRACK = 3, - RPC_LOC_SV_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type; - -typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; - -struct rpc_loc_sv_info_s_type { - rpc_loc_sv_info_valid_mask_type valid_mask; - rpc_loc_sv_system_e_type system; - rpc_uint8 prn; - rpc_uint8 health_status; - rpc_loc_sv_status_e_type process_status; - rpc_boolean has_eph; - rpc_boolean has_alm; - float elevation; - float azimuth; - float snr; -}; -typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type; - -typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; - -struct rpc_loc_gnss_info_s_type { - rpc_loc_gnss_info_valid_mask_type valid_mask; - float position_dop; - float horizontal_dop; - float vertical_dop; - rpc_boolean altitude_assumed; - rpc_uint16 sv_count; - struct { - u_int sv_list_len; - rpc_loc_sv_info_s_type *sv_list_val; - } sv_list; -}; -typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type; - -struct rpc_loc_nmea_report_s_type { - rpc_uint16 length; - struct { - u_int nmea_sentences_len; - char *nmea_sentences_val; - } nmea_sentences; -}; -typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type; - -enum rpc_loc_status_event_e_type { - RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, - RPC_LOC_STATUS_EVENT_MAX = 268435456, -}; -typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type; - -enum rpc_loc_engine_state_e_type { - RPC_LOC_ENGINE_STATE_ON = 1, - RPC_LOC_ENGINE_STATE_OFF = 2, - RPC_LOC_ENGINE_STATE_MAX = 268435456, -}; -typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type; - -struct rpc_loc_status_event_payload_u_type { - rpc_loc_status_event_e_type disc; - union { - rpc_loc_engine_state_e_type engine_state; - } rpc_loc_status_event_payload_u_type_u; -}; -typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type; - -struct rpc_loc_status_event_s_type { - rpc_loc_status_event_e_type event; - rpc_loc_status_event_payload_u_type payload; -}; -typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type; - -enum rpc_loc_server_addr_e_type { - RPC_LOC_SERVER_ADDR_IPV4 = 1, - RPC_LOC_SERVER_ADDR_URL = 2, - RPC_LOC_SERVER_ADDR_MAX = 268435456, -}; -typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type; - -struct rpc_loc_server_addr_ipv4_type { - rpc_uint32 addr; - rpc_uint16 port; -}; -typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type; - -struct rpc_loc_server_addr_url_type { - rpc_uint16 length; - struct { - u_int addr_len; - char *addr_val; - } addr; -}; -typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type; - -struct rpc_loc_server_addr_u_type { - rpc_loc_server_addr_e_type disc; - union { - rpc_loc_server_addr_ipv4_type ipv4; - rpc_loc_server_addr_url_type url; - } rpc_loc_server_addr_u_type_u; -}; -typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type; - -struct rpc_loc_server_info_s_type { - rpc_loc_server_addr_e_type addr_type; - rpc_loc_server_addr_u_type addr_info; -}; -typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type; - -enum rpc_loc_ni_notify_verify_e_type { - RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, - RPC_LOC_NI_USER_NOTIFY_ONLY = 2, - RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, - RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, - RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, - RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type; - -enum rpc_loc_ni_event_e_type { - RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, - RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, - RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, - RPC_LOC_NI_EVENT_MAX = 268435456, -}; -typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type; - -enum rpc_loc_ni_datacoding_scheme_e_type { - RPC_LOC_NI_PRESUPL_ISO646IRV = 0, - RPC_LOC_NI_PRESUPL_ISO8859 = 1, - RPC_LOC_NI_PRESUPL_UTF8 = 2, - RPC_LOC_NI_PRESUPL_UTF16 = 3, - RPC_LOC_NI_PRESUPL_UCS2 = 4, - RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, - RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, - RPC_LOC_NI_PRESUPL_JIS = 7, - RPC_LOC_NI_PRESUPL_EUC = 8, - RPC_LOC_NI_PRESUPL_GB2312 = 9, - RPC_LOC_NI_PRESUPL_CNS11643 = 10, - RPC_LOC_NI_PRESUPL_KSC1001 = 11, - RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, - RPC_LOC_NI_SS_GERMAN = 12, - RPC_LOC_NI_SS_ENGLISH = 13, - RPC_LOC_NI_SS_ITALIAN = 14, - RPC_LOC_NI_SS_FRENCH = 15, - RPC_LOC_NI_SS_SPANISH = 16, - RPC_LOC_NI_SS_DUTCH = 17, - RPC_LOC_NI_SS_SWEDISH = 18, - RPC_LOC_NI_SS_DANISH = 19, - RPC_LOC_NI_SS_PORTUGUESE = 20, - RPC_LOC_NI_SS_FINNISH = 21, - RPC_LOC_NI_SS_NORWEGIAN = 22, - RPC_LOC_NI_SS_GREEK = 23, - RPC_LOC_NI_SS_TURKISH = 24, - RPC_LOC_NI_SS_HUNGARIAN = 25, - RPC_LOC_NI_SS_POLISH = 26, - RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, - RPC_LOC_NI_SUPL_UTF8 = 28, - RPC_LOC_NI_SUPL_UCS2 = 29, - RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, - RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647, -}; -typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type; - -enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { - RPC_LOC_NI_VX_OCTET = 0, - RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, - RPC_LOC_NI_VX_ASCII = 2, - RPC_LOC_NI_VX_IA5 = 3, - RPC_LOC_NI_VX_UNICODE = 4, - RPC_LOC_NI_VX_SHIFT_JIS = 5, - RPC_LOC_NI_VX_KOREAN = 6, - RPC_LOC_NI_VX_LATIN_HEBREW = 7, - RPC_LOC_NI_VX_LATIN = 8, - RPC_LOC_NI_VX_GSM = 9, - RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type; - -enum rpc_loc_ni_vx_pos_mode_e_type { - RPC_LOC_VX_MS_ASSISTED_ONLY = 1, - RPC_LOC_VX_MS_BASED_ONLY = 2, - RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, - RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, - RPC_LOC_VX_POS_MODE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type; - -struct rpc_loc_ni_vx_requester_id_s_type { - u_char requester_id_length; - char requester_id[200]; -}; -typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type; - -struct rpc_loc_ni_vx_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - u_char pos_qos_incl; - u_char pos_qos; - rpc_uint32 num_fixes; - rpc_uint32 tbf; - rpc_loc_ni_vx_pos_mode_e_type pos_mode; - rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; - rpc_loc_ni_vx_requester_id_s_type requester_id; - rpc_uint16 user_resp_timer_val; -}; -typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type; - -enum rpc_loc_ni_supl_pos_method_e_type { - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, - RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, - RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, - RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, - RPC_LOC_NI_POSMETHOD_AFLT = 6, - RPC_LOC_NI_POSMETHOD_ECID = 7, - RPC_LOC_NI_POSMETHOD_EOTD = 8, - RPC_LOC_NI_POSMETHOD_OTDOA = 9, - RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, - RPC_LOC_NI_POSMETHOD_MAX = 268435456, -}; -typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type; - -struct rpc_loc_ni_supl_slp_session_id_s_type { - u_char presence; - char session_id[4]; - rpc_loc_server_info_s_type slp_address; -}; -typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type; - -struct rpc_loc_ni_requestor_id_s_type { - u_char data_coding_scheme; - struct { - u_int requestor_id_string_len; - char *requestor_id_string_val; - } requestor_id_string; - u_char string_len; -}; -typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type; - -struct rpc_loc_ni_supl_client_name_s_type { - u_char data_coding_scheme; - struct { - u_int client_name_string_len; - char *client_name_string_val; - } client_name_string; - u_char string_len; -}; -typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type; - -struct rpc_loc_ni_supl_qop_s_type { - u_char bit_mask; - u_char horacc; - u_char veracc; - u_char maxLocAge; - u_char delay; -}; -typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type; - -struct rpc_loc_ni_supl_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - rpc_uint16 flags; - rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; - char supl_hash[8]; - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_supl_pos_method_e_type pos_method; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_supl_client_name_s_type client_name; - rpc_loc_ni_supl_qop_s_type supl_qop; - rpc_uint16 user_response_timer; -}; -typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type; - -struct rpc_loc_ni_ext_client_address_s_type { - u_char ext_client_address_len; - struct { - u_int ext_client_address_len; - char *ext_client_address_val; - } ext_client_address; -}; -typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type; - -enum rpc_loc_ni_location_type_e_type { - RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, - RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, - RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, - RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456, -}; -typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type; - -struct rpc_loc_ni_deferred_location_s_type { - u_char unused_bits; - u_char ms_available; -}; -typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type; - -struct rpc_loc_ni_codeword_string_s_type { - u_char data_coding_scheme; - struct { - u_int lcs_codeword_string_len; - char *lcs_codeword_string_val; - } lcs_codeword_string; - u_char string_len; -}; -typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type; - -struct rpc_loc_ni_service_type_id_s_type { - u_char lcs_service_type_id; -}; -typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type; - -struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { - rpc_loc_ni_notify_verify_e_type notification_priv_type; - u_char invoke_id; - rpc_uint16 flags; - u_char notification_length; - struct { - u_int notification_text_len; - char *notification_text_val; - } notification_text; - rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; - rpc_loc_ni_ext_client_address_s_type ext_client_address_data; - rpc_loc_ni_location_type_e_type location_type; - rpc_loc_ni_deferred_location_s_type deferred_location; - rpc_loc_ni_requestor_id_s_type requestor_id; - rpc_loc_ni_codeword_string_s_type codeword_string; - rpc_loc_ni_service_type_id_s_type service_type_id; - rpc_uint16 user_response_timer; -}; -typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type; - -struct rpc_loc_ni_event_payload_u_type { - rpc_loc_ni_event_e_type disc; - union { - rpc_loc_ni_vx_notify_verify_req_s_type vx_req; - rpc_loc_ni_supl_notify_verify_req_s_type supl_req; - rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; - } rpc_loc_ni_event_payload_u_type_u; -}; -typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type; - -struct rpc_loc_ni_event_s_type { - rpc_loc_ni_event_e_type event; - rpc_loc_ni_event_payload_u_type payload; -}; -typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type; - -enum rpc_loc_assist_data_request_e_type { - RPC_LOC_ASSIST_DATA_TIME_REQ = 1, - RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, - RPC_LOC_ASSIST_DATA_MAX = 268435456, -}; -typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type; - -typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr; - -typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; - -struct rpc_loc_time_download_source_s_type { - rpc_uint32 delay_threshold; - rpc_struct_loc_time_download_source_s_type_servers servers; -}; -typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type; - -typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; - -typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; - -struct rpc_loc_predicted_orbits_data_source_s_type { - rpc_uint32 max_file_size; - rpc_uint32 max_part_size; - rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; -}; -typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type; - -struct rpc_loc_assist_data_request_payload_u_type { - rpc_loc_assist_data_request_e_type disc; - union { - rpc_loc_time_download_source_s_type time_download; - rpc_loc_predicted_orbits_data_source_s_type data_download; - } rpc_loc_assist_data_request_payload_u_type_u; -}; -typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type; - -struct rpc_loc_assist_data_request_s_type { - rpc_loc_assist_data_request_e_type event; - rpc_loc_assist_data_request_payload_u_type payload; -}; -typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type; - -typedef rpc_uint32 rpc_loc_server_connection_handle; - -enum rpc_loc_server_protocol_e_type { - RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, - RPC_LOC_SERVER_PROTOCOL_SUPL = 1, - RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, - RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, - RPC_LOC_SERVER_PROTOCOL_MAX = 16777216, -}; -typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type; - -enum rpc_loc_server_request_e_type { - RPC_LOC_SERVER_REQUEST_OPEN = 1, - RPC_LOC_SERVER_REQUEST_CLOSE = 2, - RPC_LOC_SERVER_REQUEST_MAX = 268435456, -}; -typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type; - -struct rpc_loc_server_open_req_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_protocol_e_type protocol; -}; -typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type; - -struct rpc_loc_server_close_req_s_type { - rpc_loc_server_connection_handle conn_handle; -}; -typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type; - -struct rpc_loc_server_request_u_type { - rpc_loc_server_request_e_type disc; - union { - rpc_loc_server_open_req_s_type open_req; - rpc_loc_server_close_req_s_type close_req; - } rpc_loc_server_request_u_type_u; -}; -typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type; - -struct rpc_loc_server_request_s_type { - rpc_loc_server_request_e_type event; - rpc_loc_server_request_u_type payload; -}; -typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type; - -struct rpc_loc_reserved_payload_s_type { - rpc_uint16 data_size; - struct { - u_int data_len; - char *data_val; - } data; -}; -typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type; - -enum rpc_loc_ioctl_e_type { - RPC_LOC_IOCTL_GET_API_VERSION = 1, - RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, - RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, - RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, - RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, - RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, - RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, - RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, - RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, - RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, - RPC_LOC_IOCTL_INJECT_POSITION = 407, - RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, - RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, - RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, - RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, - RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, - RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, - RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, - RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, - RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, - RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, - RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, - RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, - RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, - RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, - RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, - RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, - RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, - RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, - RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, - RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, - RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, - RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, - RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824, -}; -typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type; - -struct rpc_loc_api_version_s_type { - u_char major; - u_char minor; -}; -typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type; - -enum rpc_loc_fix_recurrence_e_type { - RPC_LOC_PERIODIC_FIX = 1, - RPC_LOC_SINGLE_FIX = 2, - RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type; - -enum rpc_loc_operation_mode_e_type { - RPC_LOC_OPER_MODE_DEFAULT = 1, - RPC_LOC_OPER_MODE_MSB = 2, - RPC_LOC_OPER_MODE_MSA = 3, - RPC_LOC_OPER_MODE_STANDALONE = 4, - RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, - RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, - RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, - RPC_LOC_OPER_MODE_MAX = 268435456, -}; -typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type; - -enum rpc_loc_notify_e_type { - RPC_LOC_NOTIFY_ON_INTERVAL = 1, - RPC_LOC_NOTIFY_ON_DISTANCE = 2, - RPC_LOC_NOTIFY_ON_ANY = 3, - RPC_LOC_NOTIFY_ON_ALL = 4, - RPC_LOC_NOTIFY_TYPE_MAX = 268435456, -}; -typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type; - -struct rpc_loc_fix_criteria_s_type { - rpc_uint32 valid_mask; - rpc_loc_fix_recurrence_e_type recurrence_type; - rpc_loc_operation_mode_e_type preferred_operation_mode; - rpc_uint32 preferred_accuracy; - rpc_uint32 preferred_response_time; - rpc_boolean intermediate_pos_report_enabled; - rpc_loc_notify_e_type notify_type; - rpc_uint32 min_interval; - float min_distance; - rpc_uint32 min_dist_sample_interval; -}; -typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type; - -enum rpc_loc_ni_user_resp_e_type { - RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, - RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456, -}; -typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type; - -struct rpc_loc_user_verify_s_type { - rpc_loc_ni_user_resp_e_type user_resp; - rpc_loc_ni_event_s_type ni_event_pass_back; -}; -typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type; - -enum rpc_loc_predicted_orbits_data_format_e_type { - RPC_LOC_PREDICTED_ORBITS_XTRA = 0, - RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456, -}; -typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type; - -struct rpc_loc_predicted_orbits_data_s_type { - rpc_loc_predicted_orbits_data_format_e_type format_type; - rpc_uint32 total_size; - rpc_uint8 total_parts; - rpc_uint8 part; - rpc_uint16 part_len; - struct { - u_int data_ptr_len; - char *data_ptr_val; - } data_ptr; -}; -typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type; - -struct rpc_loc_predicted_orbits_data_validity_report_s_type { - rpc_uint64 start_time_utc; - rpc_uint16 valid_duration_hrs; -}; -typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type; - -struct rpc_loc_predicted_orbits_auto_download_config_s_type { - rpc_boolean enable; - u_char auto_check_every_hrs; -}; -typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type; - -struct rpc_loc_assist_data_time_s_type { - rpc_uint64 time_utc; - rpc_uint32 uncertainty; -}; -typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type; - -typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; - -struct rpc_loc_assist_data_pos_s_type { - rpc_loc_assist_pos_valid_mask_type valid_mask; - rpc_uint64 timestamp_utc; - double latitude; - double longitude; - float altitude_wrt_ellipsoid; - float altitude_wrt_mean_sea_level; - float hor_unc_circular; - float vert_unc; - u_char confidence_horizontal; - u_char confidence_vertical; -}; -typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type; - -enum rpc_loc_server_open_status_e_type { - RPC_LOC_SERVER_OPEN_SUCCESS = 1, - RPC_LOC_SERVER_OPEN_FAIL = 2, - RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type; - -struct rpc_loc_server_open_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_open_status_e_type open_status; - char *apn_name; -}; -typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type; - -enum rpc_loc_server_close_status_e_type { - RPC_LOC_SERVER_CLOSE_SUCCESS = 1, - RPC_LOC_SERVER_CLOSE_FAIL = 2, - RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456, -}; -typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type; - -struct rpc_loc_server_close_status_s_type { - rpc_loc_server_connection_handle conn_handle; - rpc_loc_server_close_status_e_type close_status; -}; -typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type; - -enum rpc_loc_lock_e_type { - RPC_LOC_LOCK_NONE = 1, - RPC_LOC_LOCK_MI = 2, - RPC_LOC_LOCK_MT = 3, - RPC_LOC_LOCK_ALL = 4, - RPC_LOC_LOCK_MAX = 268435456, -}; -typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type; - -typedef rpc_uint32 rpc_loc_nmea_sentence_type; - -typedef rpc_uint32 rpc_loc_assist_data_type; - -struct rpc_loc_assist_data_delete_s_type { - rpc_loc_assist_data_type type; - rpc_uint32 reserved[8]; -}; -typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type; - -struct rpc_loc_ioctl_data_u_type { - rpc_loc_ioctl_e_type disc; - union { - rpc_loc_fix_criteria_s_type fix_criteria; - rpc_loc_user_verify_s_type user_verify_resp; - rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; - rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; - rpc_loc_assist_data_time_s_type assistance_data_time; - rpc_loc_assist_data_pos_s_type assistance_data_position; - rpc_loc_server_open_status_s_type conn_open_status; - rpc_loc_server_close_status_s_type conn_close_status; - rpc_loc_lock_e_type engine_lock; - rpc_boolean sbas_mode; - rpc_loc_nmea_sentence_type nmea_types; - rpc_boolean on_demand_lpm; - rpc_loc_server_info_s_type server_addr; - rpc_loc_assist_data_delete_s_type assist_data_delete; - } rpc_loc_ioctl_data_u_type_u; -}; -typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type; - -struct rpc_loc_ioctl_callback_data_u_type { - rpc_loc_ioctl_e_type disc; - union { - rpc_loc_api_version_s_type api_version; - rpc_loc_fix_criteria_s_type fix_criteria; - rpc_loc_lock_e_type engine_lock; - rpc_boolean sbas_mode; - rpc_loc_nmea_sentence_type nmea_types; - rpc_boolean on_demand_lpm; - rpc_loc_server_info_s_type server_addr; - rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; - rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; - } rpc_loc_ioctl_callback_data_u_type_u; -}; -typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type; - -struct rpc_loc_ioctl_callback_s_type { - rpc_loc_ioctl_e_type type; - rpc_int32 status; - rpc_loc_ioctl_callback_data_u_type data; -}; -typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type; - -struct rpc_loc_event_payload_u_type { - u_quad_t disc; - union { - rpc_loc_parsed_position_s_type parsed_location_report; - rpc_loc_gnss_info_s_type gnss_report; - rpc_loc_nmea_report_s_type nmea_report; - rpc_loc_ni_event_s_type ni_request; - rpc_loc_assist_data_request_s_type assist_data_request; - rpc_loc_server_request_s_type loc_server_request; - rpc_loc_ioctl_callback_s_type ioctl_report; - rpc_loc_status_event_s_type status_report; - rpc_loc_reserved_payload_s_type reserved; - } rpc_loc_event_payload_u_type_u; -}; -typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type; -#define RPC_LOC_API_NULL_VERSION 0x00010001 -#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00010001 - -/* the xdr functions */ - -#if defined(__STDC__) || defined(__cplusplus) -extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*); -extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*); -extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*); -extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*); -extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*); -extern bool_t xdr_rpc_byte (XDR *, rpc_byte*); -extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*); -extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*); -extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*); -extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*); -extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*); -extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*); -extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*); -extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*); -extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*); -extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*); -extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*); -extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*); -extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*); -extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*); -extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*); -extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*); -extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*); -extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*); -extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*); -extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*); -extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*); -extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*); -extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*); -extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*); -extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*); -extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*); -extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*); -extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*); -extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*); -extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*); -extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*); -extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*); -extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*); -extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*); -extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*); -extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*); -extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*); -extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*); -extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*); -extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers); -extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers); -extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*); -extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*); -extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*); -extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*); -extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*); -extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*); -extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*); -extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*); -extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*); -extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*); -extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*); -extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*); -extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*); -extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*); -extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*); -extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*); -extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*); -extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*); -extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*); -extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*); -extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*); -extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*); -extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*); -extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*); -extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*); -extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*); -extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*); -extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*); -extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*); -extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*); -extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*); -extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*); -extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*); -extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*); -extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*); - -#else /* K&R C */ -extern bool_t xdr_rpc_boolean (); -extern bool_t xdr_rpc_uint32 (); -extern bool_t xdr_rpc_uint16 (); -extern bool_t xdr_rpc_uint8 (); -extern bool_t xdr_rpc_int32 (); -extern bool_t xdr_rpc_byte (); -extern bool_t xdr_rpc_uint64 (); -extern bool_t xdr_rpc_loc_client_handle_type (); -extern bool_t xdr_rpc_loc_event_mask_type (); -extern bool_t xdr_rpc_loc_position_valid_mask_type (); -extern bool_t xdr_rpc_loc_pos_technology_mask_type (); -extern bool_t xdr_rpc_loc_session_status_e_type (); -extern bool_t xdr_rpc_loc_calendar_time_s_type (); -extern bool_t xdr_rpc_loc_parsed_position_s_type (); -extern bool_t xdr_rpc_loc_sv_system_e_type (); -extern bool_t xdr_rpc_loc_sv_status_e_type (); -extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (); -extern bool_t xdr_rpc_loc_sv_info_s_type (); -extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (); -extern bool_t xdr_rpc_loc_gnss_info_s_type (); -extern bool_t xdr_rpc_loc_nmea_report_s_type (); -extern bool_t xdr_rpc_loc_status_event_e_type (); -extern bool_t xdr_rpc_loc_engine_state_e_type (); -extern bool_t xdr_rpc_loc_status_event_payload_u_type (); -extern bool_t xdr_rpc_loc_status_event_s_type (); -extern bool_t xdr_rpc_loc_server_addr_e_type (); -extern bool_t xdr_rpc_loc_server_addr_ipv4_type (); -extern bool_t xdr_rpc_loc_server_addr_url_type (); -extern bool_t xdr_rpc_loc_server_addr_u_type (); -extern bool_t xdr_rpc_loc_server_info_s_type (); -extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (); -extern bool_t xdr_rpc_loc_ni_event_e_type (); -extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (); -extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (); -extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (); -extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (); -extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (); -extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (); -extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (); -extern bool_t xdr_rpc_loc_ni_location_type_e_type (); -extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (); -extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (); -extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (); -extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (); -extern bool_t xdr_rpc_loc_ni_event_payload_u_type (); -extern bool_t xdr_rpc_loc_ni_event_s_type (); -extern bool_t xdr_rpc_loc_assist_data_request_e_type (); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (); -extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (); -extern bool_t xdr_rpc_loc_time_download_source_s_type (); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (); -extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (); -extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (); -extern bool_t xdr_rpc_loc_assist_data_request_s_type (); -extern bool_t xdr_rpc_loc_server_connection_handle (); -extern bool_t xdr_rpc_loc_server_protocol_e_type (); -extern bool_t xdr_rpc_loc_server_request_e_type (); -extern bool_t xdr_rpc_loc_server_open_req_s_type (); -extern bool_t xdr_rpc_loc_server_close_req_s_type (); -extern bool_t xdr_rpc_loc_server_request_u_type (); -extern bool_t xdr_rpc_loc_server_request_s_type (); -extern bool_t xdr_rpc_loc_reserved_payload_s_type (); -extern bool_t xdr_rpc_loc_ioctl_e_type (); -extern bool_t xdr_rpc_loc_api_version_s_type (); -extern bool_t xdr_rpc_loc_fix_recurrence_e_type (); -extern bool_t xdr_rpc_loc_operation_mode_e_type (); -extern bool_t xdr_rpc_loc_notify_e_type (); -extern bool_t xdr_rpc_loc_fix_criteria_s_type (); -extern bool_t xdr_rpc_loc_ni_user_resp_e_type (); -extern bool_t xdr_rpc_loc_user_verify_s_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (); -extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (); -extern bool_t xdr_rpc_loc_assist_data_time_s_type (); -extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (); -extern bool_t xdr_rpc_loc_assist_data_pos_s_type (); -extern bool_t xdr_rpc_loc_server_open_status_e_type (); -extern bool_t xdr_rpc_loc_server_open_status_s_type (); -extern bool_t xdr_rpc_loc_server_close_status_e_type (); -extern bool_t xdr_rpc_loc_server_close_status_s_type (); -extern bool_t xdr_rpc_loc_lock_e_type (); -extern bool_t xdr_rpc_loc_nmea_sentence_type (); -extern bool_t xdr_rpc_loc_assist_data_type (); -extern bool_t xdr_rpc_loc_assist_data_delete_s_type (); -extern bool_t xdr_rpc_loc_ioctl_data_u_type (); -extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (); -extern bool_t xdr_rpc_loc_ioctl_callback_s_type (); -extern bool_t xdr_rpc_loc_event_payload_u_type (); - -#endif /* K&R C */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_LOC_API_COMMON_H_RPCGEN */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h deleted file mode 100644 index e62eb367..00000000 --- a/loc_api/libloc_api-rpc/inc-3200/loc_api_fixup.h +++ /dev/null @@ -1,188 +0,0 @@ -/****************************************************************************** - @file: loc_api_fixup.h - @brief: Loc API Android RPC amendment header - - DESCRIPTION - Loc API Android RPC amendment header - - INITIALIZATION AND SEQUENCING REQUIREMENTS - - ----------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------------- - ******************************************************************************/ - -#ifndef LOC_API_FIXUP_H -#define LOC_API_FIXUP_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -#ifndef NULLPROC -#define NULLPROC 0 -#endif /* NULLPROC */ - -#ifdef ADD_XDR_FLOAT - -extern bool_t xdr_float (XDR *__xdrs, float *__fp); -extern bool_t xdr_double (XDR *__xdrs, double *__dp); - -#endif /* ADD_XDR_FLOAT */ - -#ifdef ADD_XDR_BOOL -extern bool_t xdr_bool(XDR *__xdrs, int *__bp); -#endif /* ADD_XDR_BOOL */ - -#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1 -#define RPC_LOC_API_MINOR_VERSION_NUMBER 0 - -// Return value for loc_open in case of failure. -#define RPC_LOC_CLIENT_HANDLE_INVALID -1 - -// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl -// These are also the status for the ioctl callback -#define RPC_LOC_API_SUCCESS 0 -#define RPC_LOC_API_GENERAL_FAILURE 1 -#define RPC_LOC_API_UNSUPPORTED 2 -#define RPC_LOC_API_INVALID_HANDLE 4 -#define RPC_LOC_API_INVALID_PARAMETER 5 -#define RPC_LOC_API_ENGINE_BUSY 6 -#define RPC_LOC_API_PHONE_OFFLINE 7 -#define RPC_LOC_API_TIMEOUT 8 - -// Special return value for loc api calls in case of RCP failure -#define RPC_LOC_API_RPC_FAILURE (-1234) - -#define RPC_LOC_API_MAX_SV_COUNT 80 -#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200 - -// Maximum server address that will be used in location API -#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256 -#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3 -#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3 - -#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type -#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report -#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate -#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate -#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request -#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request -#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server -#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl -#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state - - -#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001 -#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002 -#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004 -#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008 -#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010 -#define RPC_LOC_POS_VALID_LATITUDE 0x00000020 -#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040 -#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080 -#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100 -#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200 -#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400 -#define RPC_LOC_POS_VALID_HEADING 0x00000800 -#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000 -#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000 -#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000 -#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000 -#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000 -#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000 -#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000 -#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000 -#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000 -#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000 -#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000 - -#define RPC_LOC_POS_TECH_SATELLITE 0x00000001 -#define RPC_LOC_POS_TECH_CELLID 0x00000002 -#define RPC_LOC_POS_TECH_WIFI 0x00000004 - -#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001 -#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002 -#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004 -#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008 -#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010 -#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020 -#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040 -#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080 -#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100 - -#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001 -#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002 -#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004 -#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008 -#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010 -#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020 - -#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200 -#define RPC_LOC_NI_SUPL_HASH_LENGTH 8 -#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4 -#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64 -#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20 -#define RPC_LOC_NI_CODEWORD_LENGTH 20 - -#define RPC_LOC_NI_SUPL_QOP_VALID 0x01 -#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02 -#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04 -#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08 - -#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001 -#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002 -#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004 -#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008 -#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010 -#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020 -#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040 -#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080 -#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100 - -#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001 -#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002 -#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004 -#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008 -#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010 -#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020 -#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040 -#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080 -#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100 - -#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF - -#define RPC_LOC_NMEA_MASK_ALL 0xffff -#define RPC_LOC_NMEA_MASK_GGA 0x0001 -#define RPC_LOC_NMEA_MASK_RMC 0x0002 -#define RPC_LOC_NMEA_MASK_GSV 0x0004 -#define RPC_LOC_NMEA_MASK_GSA 0x0008 -#define RPC_LOC_NMEA_MASK_VTG 0x0010 - -/* flags for notification */ -#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001 -#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002 -#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010 -#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020 -#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040 -#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080 -#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100 - -#ifdef __cplusplus -} -#endif - -#endif /* LOC_API_FIXUP_H */ diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h deleted file mode 100644 index 92d4e150..00000000 --- a/loc_api/libloc_api-rpc/inc-3200/loc_apicb_appinit.h +++ /dev/null @@ -1,34 +0,0 @@ -/* ------------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------- - */ - -#ifndef LOC_APICB_APPINIT_H -#define LOC_APICB_APPINIT_H - -#ifdef __cplusplus -extern "C" -{ -#endif - - /* Initialization function for callbacks */ -extern int loc_apicb_app_init(); -extern void loc_apicb_app_deinit(); - -#ifdef __cplusplus -} -#endif - -#endif /* LOC_APICB_APPINIT_H */ diff --git a/loc_api/libloc_api-rpc/inc/debug.h b/loc_api/libloc_api-rpc/inc/debug.h deleted file mode 100644 index a71b23a0..00000000 --- a/loc_api/libloc_api-rpc/inc/debug.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef DEBUG_H -#define DEBUG_H - -#include - -#define LOG_TAG "libgps-rpc" -#include - -#define PRINT(x...) do { \ - fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \ - fprintf(stdout, ##x); \ - LOGD(x); \ - } while(0) - -#ifdef DEBUG -#define D PRINT -#else -#define D(x...) do { } while(0) -#endif - -#ifdef VERBOSE -#define V PRINT -#else -#define V(x...) do { } while(0) -#endif - -#define E(x...) do { \ - fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \ - fprintf(stderr, ##x); \ - LOGE(x); \ - } while(0) - -#define FAILIF(cond, msg...) do { \ - if (__builtin_expect (cond, 0)) { \ - fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \ - fprintf(stderr, ##msg); \ - LOGE(##msg); \ - } \ - } while(0) - -#endif/*DEBUG_H*/ diff --git a/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h b/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h deleted file mode 100644 index ef972bd6..00000000 --- a/loc_api/libloc_api-rpc/inc/loc_api_rpc_glue.h +++ /dev/null @@ -1,100 +0,0 @@ -/****************************************************************************** - @file: loc_api_rpc_glue.h - @brief: Loc API Android glue code header - - DESCRIPTION - Loc API Android glue code header - - INITIALIZATION AND SEQUENCING REQUIREMENTS - - ----------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------------- - ******************************************************************************/ - -/*===================================================================== - EDIT HISTORY FOR MODULE - - This section contains comments describing changes made to the module. - Notice that changes are listed in reverse chronological order. - -when who what, where, why --------- --- ------------------------------------------------------- -03/17/09 dx Initial version - -$Id: //source/qcom/qct/modem/gps/cgps/dev/locationmiddleware/locapi/app-linux/source/test/loc_api_test/loc_api_cb_log.h#4 $ -======================================================================*/ - -#ifndef LOC_API_RPC_GLUE_H -#define LOC_API_RPC_GLUE_H - -/* Include RPC headers */ -#include "loc_api_common.h" -#include "loc_api.h" -#include "loc_api_cb.h" -#include "loc_api_fixup.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Boolean */ -/* Other data types in comdef.h are defined in rpc stubs, so fix it here */ -typedef unsigned char boolean; -#define TRUE 1 -#define FALSE 0 - -extern int loc_api_glue_init(void); -extern int loc_api_null(void); - -typedef int32 (loc_event_cb_f_type)( - rpc_loc_client_handle_type loc_handle, /* handle of the client */ - rpc_loc_event_mask_type loc_event, /* event mask */ - const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ -); - -extern rpc_loc_client_handle_type loc_open( - rpc_loc_event_mask_type event_reg_mask, - loc_event_cb_f_type *event_callback -); - -extern int32 loc_close -( - rpc_loc_client_handle_type handle -); - -extern int32 loc_start_fix -( - rpc_loc_client_handle_type handle -); - -extern int32 loc_stop_fix -( - rpc_loc_client_handle_type handle -); - -extern int32 loc_ioctl -( - rpc_loc_client_handle_type handle, - rpc_loc_ioctl_e_type ioctl_type, - rpc_loc_ioctl_data_u_type* ioctl_data -); - -#ifdef __cplusplus -} -#endif - -#endif /* LOC_API_RPC_GLUE_H */ diff --git a/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c b/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c deleted file mode 100644 index 7fcfd6cb..00000000 --- a/loc_api/libloc_api-rpc/src/loc_apicb_appinit.c +++ /dev/null @@ -1,61 +0,0 @@ -/* ------------------------------------------------------------------------------- -Copyright (c) 2009, QUALCOMM USA, INC. - -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ------------------------------------------------------------------------------- - */ -#include "rpc/rpc.h" -#include "loc_api_common.h" -#include "loc_api.h" -#include "loc_api_cb.h" -#include "loc_api_fixup.h" - -#include "loc_apicb_appinit.h" - -#define RPC_FUNC_VERSION_BASE(a,b) a ## b -#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b) - -static SVCXPRT* svrPort = NULL; - -extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp); - -int loc_apicb_app_init(void) -{ - /* Register a callback server to use the loc_apicbprog_* function */ - if (svrPort == NULL) { - svrPort = svcrtr_create(); - } - if (!svrPort) return -1; - - xprt_register(svrPort); - if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0)) - { - return 0; - } - else - { - return -1; - } -} - -void loc_apicb_app_deinit(void) -{ - if (svrPort == NULL) - { - return; - } - xprt_unregister(svrPort); - svc_destroy(svrPort); - //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001); - svrPort = NULL; -} diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index a1488a02..62905e8c 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -41,7 +41,8 @@ LOCAL_CFLAGS += \ LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core \ - hardware/qcom/gps/loc_api/libloc_api_50001 + hardware/qcom/gps/loc_api/libloc_api_50001 \ + $(TARGET_OUT_HEADERS)/libflp LOCAL_COPY_HEADERS_TO:= libloc_eng/ LOCAL_COPY_HEADERS:= \ @@ -76,6 +77,9 @@ LOCAL_SHARED_LIBRARIES := \ libgps.utils \ libdl +ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false) +endif + LOCAL_SRC_FILES += \ loc.cpp \ gps.c @@ -91,10 +95,11 @@ endif ## Includes LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ - $(TARGET_OUT_HEADERS)/libloc_core + $(TARGET_OUT_HEADERS)/libloc_core \ + $(TARGET_OUT_HEADERS)/libflp LOCAL_PRELINK_MODULE := false -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw +LOCAL_MODULE_RELATIVE_PATH := hw include $(BUILD_SHARED_LIBRARY) diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 0b17b2c3..1d1a59ed 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,10 +29,17 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_EngAdapter" +#include +#include +#include +#include #include #include "loc_eng_msg.h" #include "loc_log.h" +#define CHIPSET_SERIAL_NUMBER_MAX_LEN 16 +#define USER_AGENT_MAX_LEN 512 + using namespace loc_core; LocInternalAdapter::LocInternalAdapter(LocEngAdapter* adapter) : @@ -55,17 +62,22 @@ void LocInternalAdapter::getZppInt() { LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner, ContextBase* context, - MsgTask::tCreate tCreator) : + LocThread::tCreate tCreator) : LocAdapterBase(mask, //Get the AFW context if VzW context has not already been intialized in //loc_ext context == NULL? LocDualContext::getLocFgContext(tCreator, - LocDualContext::mLocationHalName) + NULL, + LocDualContext::mLocationHalName, + false) :context), mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)), mUlp(new UlpProxyBase()), mNavigating(false), - mAgpsEnabled(false), mCPIEnabled(false) + mSupportsAgpsRequests(false), + mSupportsPositionInjection(false), + mSupportsTimeInjection(false), + mPowerVote(0) { memset(&mFixCriteria, 0, sizeof(mFixCriteria)); mFixCriteria.mode = LOC_POSITION_MODE_INVALID; @@ -79,6 +91,173 @@ LocEngAdapter::~LocEngAdapter() LOC_LOGV("LocEngAdapter deleted"); } +void LocEngAdapter::setXtraUserAgent() { + struct LocSetXtraUserAgent : public LocMsg { + const ContextBase* const mContext; + inline LocSetXtraUserAgent(ContextBase* context) : + LocMsg(), mContext(context) { + } + virtual void proc() const { + char release[PROPERTY_VALUE_MAX]; + char manufacture[PROPERTY_VALUE_MAX]; + char model[PROPERTY_VALUE_MAX]; + char board[PROPERTY_VALUE_MAX]; + char brand[PROPERTY_VALUE_MAX]; + char chipsetsn[CHIPSET_SERIAL_NUMBER_MAX_LEN]; + char userAgent[USER_AGENT_MAX_LEN]; + const char defVal[] = "-"; + + property_get("ro.build.version.release", release, defVal); + property_get("ro.product.manufacturer", manufacture, defVal); + property_get("ro.product.model", model, defVal); + property_get("ro.product.board", board, defVal); + property_get("ro.product.brand", brand, defVal); + getChipsetSerialNo(chipsetsn, sizeof(chipsetsn), defVal); + + encodeInPlace(release, PROPERTY_VALUE_MAX); + encodeInPlace(manufacture, PROPERTY_VALUE_MAX); + encodeInPlace(model, PROPERTY_VALUE_MAX); + encodeInPlace(board, PROPERTY_VALUE_MAX); + encodeInPlace(brand, PROPERTY_VALUE_MAX); + + snprintf(userAgent, sizeof(userAgent), "A/%s/%s/%s/%s/-/QCX3/s%u/-/%s/-/%s/-/-/-", + release, manufacture, model, board, + mContext->getIzatDevId(), chipsetsn, brand); + + for (int i = 0; i < sizeof(userAgent) && userAgent[i]; i++) { + if (' ' == userAgent[i]) userAgent[i] = '#'; + } + + saveUserAgentString(userAgent, strlen(userAgent)); + LOC_LOGV("%s] UserAgent %s", __func__, userAgent); + } + + void saveUserAgentString(const char* data, const int len) const { + const char XTRA_FOLDER[] = "/data/misc/location/xtra"; + const char USER_AGENT_FILE[] = "/data/misc/location/xtra/useragent.txt"; + + if (data == NULL || len < 1) { + LOC_LOGE("%s:%d]: invalid input data = %p len = %d", __func__, __LINE__, data, len); + return; + } + + struct stat s; + int err = stat(XTRA_FOLDER, &s); + if (err < 0) { + if (ENOENT == errno) { + if (mkdir(XTRA_FOLDER, 0700) < 0) { + LOC_LOGE("%s:%d]: make XTRA_FOLDER failed", __func__, __LINE__); + return; + } + } else { + LOC_LOGE("%s:%d]: XTRA_FOLDER invalid", __func__, __LINE__); + return; + } + } + + FILE* file = fopen(USER_AGENT_FILE, "wt"); + if (file == NULL) { + LOC_LOGE("%s:%d]: open USER_AGENT_FILE failed", __func__, __LINE__); + return; + } + + size_t written = fwrite(data, 1, len, file); + fclose(file); + file = NULL; + + // set file permission + chmod(USER_AGENT_FILE, 0600); + + if (written != len) { + LOC_LOGE("%s:%d]: write USER_AGENT_FILE failed", __func__, __LINE__); + } + } + + void getChipsetSerialNo(char buf[], int buflen, const char def[]) const { + const char SOC_SERIAL_NUMBER[] = "/sys/devices/soc0/serial_number"; + + FILE* file = fopen(SOC_SERIAL_NUMBER, "rt"); + if (file == NULL) { + // use default upon unreadable file + strlcpy(buf, def, buflen); + + } else { + size_t size = fread(buf, 1, buflen - 1, file); + if (size == 0) { + // use default upon empty file + strlcpy(buf, def, buflen); + + } else { + buf[size] = '\0'; + } + + fclose(file); + + // remove trailing spaces + size_t len = strlen(buf); + while (--len >= 0 && isspace(buf[len])) { + buf[len] = '\0'; + } + } + + return; + } + + /** + * encode the given string value such that all separator characters ('/','+','|','%') + * in the string are repaced by their corresponding encodings (%2F","%2B","%7C", "%25") + */ + static void encodeInPlace(char value[], const int size) { + char buffer[size]; + + struct ENCODE { + const char ch; + const char *code; + }; + + const ENCODE encodings[] = { {'/', "%2F"}, {'+', "%2B"}, {'|', "%7C",}, {'%', "%25"} }; + const int nencodings = (int)sizeof(encodings) / sizeof(encodings[0]); + + int inpos = 0, outpos = 0; + while(value[inpos] != '\0' && outpos < size - 1) { + // check if escaped character + int escchar = 0; + while(escchar < nencodings && encodings[escchar].ch != value[inpos]) { + escchar++; + } + + if (escchar == nencodings) { + // non escaped character + buffer[outpos++] = value[inpos++]; + continue; + } + + // escaped character + int codepos = 0; + #define NUM_CHARS_IN_CODE 3 + + if (outpos + NUM_CHARS_IN_CODE >= size) { + // skip last character if there is insufficient space + break; + } + + while(outpos < size - 1 && codepos < NUM_CHARS_IN_CODE) { + buffer[outpos++] = encodings[escchar].code[codepos++]; + } + inpos++; + } + + // copy to ouput + value[outpos] = '\0'; + while(--outpos >= 0) { + value[outpos] = buffer[outpos]; + } + } + }; + + sendMsg(new LocSetXtraUserAgent(mContext)); +} + void LocInternalAdapter::setUlpProxy(UlpProxyBase* ulp) { struct LocSetUlpProxy : public LocMsg { LocAdapterBase* mAdapter; @@ -123,6 +302,48 @@ void LocEngAdapter::setUlpProxy(UlpProxyBase* ulp) mUlp = ulp; } +int LocEngAdapter::setGpsLockMsg(LOC_GPS_LOCK_MASK lockMask) +{ + struct LocEngAdapterGpsLock : public LocMsg { + LocEngAdapter* mAdapter; + LOC_GPS_LOCK_MASK mLockMask; + inline LocEngAdapterGpsLock(LocEngAdapter* adapter, LOC_GPS_LOCK_MASK lockMask) : + LocMsg(), mAdapter(adapter), mLockMask(lockMask) + { + locallog(); + } + inline virtual void proc() const { + mAdapter->setGpsLock(mLockMask); + } + inline void locallog() const { + LOC_LOGV("LocEngAdapterGpsLock - mLockMask: %x", mLockMask); + } + inline virtual void log() const { + locallog(); + } + }; + sendMsg(new LocEngAdapterGpsLock(this, lockMask)); + return 0; +} + +void LocEngAdapter::requestPowerVote() +{ + if (getPowerVoteRight()) { + /* Power voting without engine lock: + * 101: vote down, 102-104 - vote up + * These codes are used not to confuse with actual engine lock + * functionality, that can't be used in SSR scenario, as it + * conflicts with initialization sequence. + */ + bool powerUp = getPowerVote(); + LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp); + setGpsLock(powerUp ? 103 : 101); + } + + delete mUlp; + mUlp = ulp; +} + void LocInternalAdapter::reportPosition(UlpLocation &location, GpsLocationExtended &locationExtended, void* locationExt, @@ -157,14 +378,14 @@ void LocEngAdapter::reportPosition(UlpLocation &location, } } -void LocInternalAdapter::reportSv(GpsSvStatus &svStatus, +void LocInternalAdapter::reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt){ sendMsg(new LocEngReportSv(mLocEngAdapter, svStatus, locationExtended, svExt)); } -void LocEngAdapter::reportSv(GpsSvStatus &svStatus, +void LocEngAdapter::reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt) { @@ -210,84 +431,84 @@ bool LocEngAdapter::reportXtraServer(const char* url1, const char* url3, const int maxlength) { - if (mAgpsEnabled) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngReportXtraServer(mOwner, url1, url2, url3, maxlength)); } - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type) { - if (mAgpsEnabled) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngRequestATL(mOwner, connHandle, agps_type)); } - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::releaseATL(int connHandle) { - if (mAgpsEnabled) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngReleaseATL(mOwner, connHandle)); } - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestXtraData() { - if (mAgpsEnabled) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngRequestXtra(mOwner)); } - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestTime() { - if (mAgpsEnabled) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngRequestTime(mOwner)); } - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data) { - if (mAgpsEnabled) { + if (mSupportsAgpsRequests) { notif.size = sizeof(notif); notif.timeout = LOC_NI_NO_RESPONSE_TIME; sendMsg(new LocEngRequestNi(mOwner, notif, data)); } - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestSuplES(int connHandle) { - if (mAgpsEnabled) + if (mSupportsAgpsRequests) sendMsg(new LocEngRequestSuplEs(mOwner, connHandle)); - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::reportDataCallOpened() { - if(mAgpsEnabled) + if(mSupportsAgpsRequests) sendMsg(new LocEngSuplEsOpened(mOwner)); - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::reportDataCallClosed() { - if(mAgpsEnabled) + if(mSupportsAgpsRequests) sendMsg(new LocEngSuplEsClosed(mOwner)); - return mAgpsEnabled; + return mSupportsAgpsRequests; } inline @@ -301,3 +522,80 @@ void LocEngAdapter::handleEngineUpEvent() { sendMsg(new LocEngUp(mOwner)); } + +enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time, + int64_t timeReference, + int uncertainty) +{ + loc_api_adapter_err result = LOC_API_ADAPTER_ERR_SUCCESS; + + LOC_LOGD("%s:%d]: mSupportsTimeInjection is %d", + __func__, __LINE__, mSupportsTimeInjection); + + if (mSupportsTimeInjection) { + LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__); + result = mLocApi->setTime(time, timeReference, uncertainty); + } else { + mSupportsTimeInjection = true; + } + return result; +} + +enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check) +{ + enum loc_api_adapter_err ret; + ENTRY_LOG(); + enum xtra_version_check eCheck; + switch (check) { + case 0: + eCheck = DISABLED; + break; + case 1: + eCheck = AUTO; + break; + case 2: + eCheck = XTRA2; + break; + case 3: + eCheck = XTRA3; + break; + default: + eCheck = DISABLED; + } + ret = mLocApi->setXtraVersionCheck(eCheck); + EXIT_LOG(%d, ret); + return ret; +} + +void LocEngAdapter::reportGpsMeasurementData(GpsData &gpsMeasurementData) +{ + sendMsg(new LocEngReportGpsMeasurement(mOwner, + gpsMeasurementData)); +} + +/* + Update Registration Mask + */ +void LocEngAdapter::updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, + loc_registration_mask_status isEnabled) +{ + LOC_LOGD("entering %s", __func__); + int result = LOC_API_ADAPTER_ERR_FAILURE; + result = mLocApi->updateRegistrationMask(event, isEnabled); + if (result == LOC_API_ADAPTER_ERR_SUCCESS) { + LOC_LOGD("%s] update registration mask succeed.", __func__); + } else { + LOC_LOGE("%s] update registration mask failed.", __func__); + } +} + +/* + Set Gnss Constellation Config + */ +bool LocEngAdapter::gnssConstellationConfig() +{ + LOC_LOGD("entering %s", __func__); + bool result = false; + result = mLocApi->gnssConstellationConfig(); + return result; +} diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index ea04f077..72b780d1 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -54,7 +54,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GpsSvStatus &svStatus, + virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -73,25 +73,37 @@ class LocEngAdapter : public LocAdapterBase { UlpProxyBase* mUlp; LocPosMode mFixCriteria; bool mNavigating; + // mPowerVote is encoded as + // mPowerVote & 0x20 -- powerVoteRight + // mPowerVote & 0x10 -- power On / Off + unsigned int mPowerVote; + static const unsigned int POWER_VOTE_RIGHT = 0x20; + static const unsigned int POWER_VOTE_VALUE = 0x10; public: - bool mAgpsEnabled; - bool mCPIEnabled; + bool mSupportsAgpsRequests; + bool mSupportsPositionInjection; + bool mSupportsTimeInjection; LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, - void* owner,ContextBase* context, - MsgTask::tCreate tCreator); + void* owner, ContextBase* context, + LocThread::tCreate tCreator); virtual ~LocEngAdapter(); virtual void setUlpProxy(UlpProxyBase* ulp); + void setXtraUserAgent(); inline void requestUlp(unsigned long capabilities) { mContext->requestUlp(mInternalAdapter, capabilities); } inline LocInternalAdapter* getInternalAdapter() { return mInternalAdapter; } inline UlpProxyBase* getUlpProxy() { return mUlp; } inline void* getOwner() { return mOwner; } - inline bool hasAgpsExt() { return mContext->hasAgpsExt(); } - inline bool hasCPIExt() { return mContext->hasCPIExt(); } + inline bool hasAgpsExtendedCapabilities() { + return mContext->hasAgpsExtendedCapabilities(); + } + inline bool hasCPIExtendedCapabilities() { + return mContext->hasCPIExtendedCapabilities(); + } inline const MsgTask* getMsgTask() { return mMsgTask; } inline enum loc_api_adapter_err @@ -124,11 +136,6 @@ public: { return mLocApi->injectPosition(latitude, longitude, accuracy); } - inline enum loc_api_adapter_err - setTime(GpsUtcTime time, int64_t timeReference, int uncertainty) - { - return mLocApi->setTime(time, timeReference, uncertainty); - } inline enum loc_api_adapter_err setXtraData(char* data, int length) { @@ -184,9 +191,9 @@ public: return mLocApi->setLPPConfig(profile); } inline enum loc_api_adapter_err - setSensorControlConfig(int sensorUsage) + setSensorControlConfig(int sensorUsage, int sensorProvider) { - return mLocApi->setSensorControlConfig(sensorUsage); + return mLocApi->setSensorControlConfig(sensorUsage, sensorProvider); } inline enum loc_api_adapter_err setSensorProperties(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk, @@ -242,9 +249,18 @@ public: inline enum loc_api_adapter_err getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask) { - return mLocApi->getZppFix(zppLoc, tech_mask); + return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask); + } + enum loc_api_adapter_err setTime(GpsUtcTime time, + int64_t timeReference, + int uncertainty); + enum loc_api_adapter_err setXtraVersionCheck(int check); + inline virtual void installAGpsCert(const DerEncodedCertificate* pData, + size_t length, + uint32_t slotBitMask) + { + mLocApi->installAGpsCert(pData, length, slotBitMask); } - virtual void handleEngineDownEvent(); virtual void handleEngineUpEvent(); virtual void reportPosition(UlpLocation &location, @@ -252,7 +268,7 @@ public: void* locationExt, enum loc_sess_status status, LocPosTechMask loc_technology_mask); - virtual void reportSv(GpsSvStatus &svStatus, + virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); virtual void reportStatus(GpsStatusValue status); @@ -267,6 +283,7 @@ public: virtual bool requestSuplES(int connHandle); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); + virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData); inline const LocPosMode& getPositionMode() const {return mFixCriteria;} @@ -274,16 +291,40 @@ public: { return mNavigating; } void setInSession(bool inSession); + // Permit/prohibit power voting + inline void setPowerVoteRight(bool powerVoteRight) { + mPowerVote = powerVoteRight ? (mPowerVote | POWER_VOTE_RIGHT) : + (mPowerVote & ~POWER_VOTE_RIGHT); + } + inline bool getPowerVoteRight() const { + return (mPowerVote & POWER_VOTE_RIGHT) != 0 ; + } + // Set the power voting up/down and do actual operation if permitted + inline void setPowerVote(bool powerOn) { + mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) : + (mPowerVote & ~POWER_VOTE_VALUE); + requestPowerVote(); + mContext->modemPowerVote(powerOn); + } + inline bool getPowerVote() const { + return (mPowerVote & POWER_VOTE_VALUE) != 0 ; + } + // Do power voting according to last settings if permitted + void requestPowerVote(); + /*Values for lock 1 = Do not lock any position sessions 2 = Lock MI position sessions 3 = Lock MT position sessions 4 = Lock all position sessions */ - inline int setGpsLock(unsigned int lock) + inline int setGpsLock(LOC_GPS_LOCK_MASK lock) { return mLocApi->setGpsLock(lock); } + + int setGpsLockMsg(LOC_GPS_LOCK_MASK lock); + /* Returns Current value of GPS lock on success @@ -293,6 +334,17 @@ public: { return mLocApi->getGpsLock(); } + + /* + Update Registration Mask + */ + void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, + loc_registration_mask_status isEnabled); + + /* + Set Gnss Constellation Config + */ + bool gnssConstellationConfig(); }; #endif //LOC_API_ENG_ADAPTER_H diff --git a/loc_api/libloc_api_50001/gps.c b/loc_api/libloc_api_50001/gps.c index 46596aa4..29f20f42 100644 --- a/loc_api/libloc_api_50001/gps.c +++ b/loc_api/libloc_api_50001/gps.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2015 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 83249f40..7411dc5a 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -47,6 +47,8 @@ using namespace loc_core; +#define LOC_PM_CLIENT_NAME "GPS" + //Globals defns static gps_location_callback gps_loc_cb = NULL; static gps_sv_status_callback gps_sv_cb = NULL; @@ -68,7 +70,6 @@ static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence re uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); static const void* loc_get_extension(const char* name); - // Defines the GpsInterface in gps.h static const GpsInterface sLocEngInterface = { @@ -90,6 +91,7 @@ static int loc_agps_open(const char* apn); static int loc_agps_closed(); static int loc_agps_open_failed(); static int loc_agps_set_server(AGpsType type, const char *hostname, int port); +static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType); static const AGpsInterface sLocEngAGpsInterface = { @@ -98,7 +100,8 @@ static const AGpsInterface sLocEngAGpsInterface = loc_agps_open, loc_agps_closed, loc_agps_open_failed, - loc_agps_set_server + loc_agps_set_server, + loc_agps_open_with_apniptype }; static int loc_xtra_init(GpsXtraCallbacks* callbacks); @@ -114,13 +117,23 @@ static const GpsXtraInterface sLocEngXTRAInterface = static void loc_ni_init(GpsNiCallbacks *callbacks); static void loc_ni_respond(int notif_id, GpsUserResponseType user_response); -const GpsNiInterface sLocEngNiInterface = +static const GpsNiInterface sLocEngNiInterface = { sizeof(GpsNiInterface), loc_ni_init, loc_ni_respond, }; +static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks); +static void loc_gps_measurement_close(); + +static const GpsMeasurementInterface sLocEngGpsMeasurementInterface = +{ + sizeof(GpsMeasurementInterface), + loc_gps_measurement_init, + loc_gps_measurement_close +}; + static void loc_agps_ril_init( AGpsRilCallbacks* callbacks ); static void loc_agps_ril_set_ref_location(const AGpsRefLocation *agps_reflocation, size_t sz_struct); static void loc_agps_ril_set_set_id(AGpsSetIDType type, const char* setid); @@ -139,9 +152,29 @@ static const AGpsRilInterface sLocEngAGpsRilInterface = loc_agps_ril_update_network_availability }; +static int loc_agps_install_certificates(const DerEncodedCertificate* certificates, + size_t length); +static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints, + size_t length); + +static const SuplCertificateInterface sLocEngAGpsCertInterface = +{ + sizeof(SuplCertificateInterface), + loc_agps_install_certificates, + loc_agps_revoke_certificates +}; + +static void loc_configuration_update(const char* config_data, int32_t length); + +static const GnssConfigurationInterface sLocEngConfigInterface = +{ + sizeof(GnssConfigurationInterface), + loc_configuration_update +}; + static loc_eng_data_s_type loc_afw_data; static int gss_fd = -1; - +static int sGnssType = GNSS_UNKNOWN; /*=========================================================================== FUNCTION gps_get_hardware_interface @@ -194,10 +227,11 @@ extern "C" const GpsInterface* get_gps_interface() target = loc_get_target(); LOC_LOGD("Target name check returned %s", loc_get_target_name(target)); - int gnssType = getTargetGnssType(target); - switch (gnssType) + sGnssType = getTargetGnssType(target); + switch (sGnssType) { case GNSS_GSS: + case GNSS_AUTO: //APQ8064 gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); gss_fd = open("/dev/gss", O_RDONLY); @@ -270,16 +304,31 @@ static int loc_init(GpsCallbacks* callbacks) callbacks->create_thread_cb, /* create_thread_cb */ NULL, /* location_ext_parser */ NULL, /* sv_ext_parser */ - callbacks->request_utc_time_cb /* request_utc_time_cb */}; + callbacks->request_utc_time_cb, /* request_utc_time_cb */ + }; gps_loc_cb = callbacks->location_cb; gps_sv_cb = callbacks->sv_status_cb; retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL); - loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES); - loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt(); - loc_afw_data.adapter->mCPIEnabled = !loc_afw_data.adapter->hasCPIExt(); + loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities(); + loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities(); + loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities(); + loc_afw_data.adapter->setGpsLockMsg(0); + loc_afw_data.adapter->requestUlp(getCarrierCapabilities()); + loc_afw_data.adapter->setXtraUserAgent(); + if(retVal) { + LOC_LOGE("loc_eng_init() fail!"); + goto err; + } + + loc_afw_data.adapter->setPowerVoteRight(loc_get_target() == TARGET_QCA1530); + loc_afw_data.adapter->setPowerVote(true); + + LOC_LOGD("loc_eng_init() success!"); + +err: EXIT_LOG(%d, retVal); return retVal; } @@ -303,19 +352,14 @@ SIDE EFFECTS static void loc_cleanup() { ENTRY_LOG(); + + loc_afw_data.adapter->setPowerVote(false); + loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK); + loc_eng_cleanup(loc_afw_data); gps_loc_cb = NULL; gps_sv_cb = NULL; -/* - if (gss_fd >= 0) - { - close(gss_fd); - gss_fd = -1; - LOC_LOGD("GSS shutdown.\n"); - } -*/ - EXIT_LOG(%s, VOID_RET); } @@ -462,33 +506,11 @@ SIDE EFFECTS ===========================================================================*/ static int loc_inject_location(double latitude, double longitude, float accuracy) { - static bool initialized = false; - static bool enable_cpi = true; - accuracy = 1000; ENTRY_LOG(); - if(!initialized) - { - char value[PROPERTY_VALUE_MAX]; - memset(value, 0, sizeof(value)); - (void)platform_lib_abstraction_property_get("persist.gps.qc_nlp_in_use", value, "0"); - if(0 == strcmp(value, "1")) - { - enable_cpi = false; - LOC_LOGI("GPS HAL coarse position injection disabled"); - } - else - { - LOC_LOGI("GPS HAL coarse position injection enabled"); - } - initialized = true; - } - int ret_val = 0; - if(enable_cpi) - { - ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy); - } + ret_val = loc_eng_inject_location(loc_afw_data, latitude, longitude, accuracy); + EXIT_LOG(%d, ret_val); return ret_val; } @@ -544,7 +566,7 @@ const GpsGeofencingInterface* get_geofence_interface(void) } dlerror(); /* Clear any existing error */ get_gps_geofence_interface = (get_gps_geofence_interface_function)dlsym(handle, "gps_geofence_get_interface"); - if ((error = dlerror()) != NULL) { + if ((error = dlerror()) != NULL || NULL == get_gps_geofence_interface) { LOC_LOGE ("%s, dlsym for get_gps_geofence_interface failed, error = %s\n", __func__, error); goto exit; } @@ -604,6 +626,18 @@ const void* loc_get_extension(const char* name) ret_val = get_geofence_interface(); } } + else if (strcmp(name, SUPL_CERTIFICATE_INTERFACE) == 0) + { + ret_val = &sLocEngAGpsCertInterface; + } + else if (strcmp(name, GNSS_CONFIGURATION_INTERFACE) == 0) + { + ret_val = &sLocEngConfigInterface; + } + else if (strcmp(name, GPS_MEASUREMENT_INTERFACE) == 0) + { + ret_val = &sLocEngGpsMeasurementInterface; + } else { LOC_LOGE ("get_extension: Invalid interface passed in\n"); @@ -663,6 +697,50 @@ static int loc_agps_open(const char* apn) return ret_val; } +/*=========================================================================== +FUNCTION loc_agps_open_with_apniptype + +DESCRIPTION + This function is called when on-demand data connection opening is successful. +It should inform ARM 9 about the data open result. + +DEPENDENCIES + NONE + +RETURN VALUE + 0 + +SIDE EFFECTS + N/A + +===========================================================================*/ +static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType) +{ + ENTRY_LOG(); + AGpsType agpsType = AGPS_TYPE_SUPL; + AGpsBearerType bearerType; + + switch (apnIpType) { + case APN_IP_IPV4: + bearerType = AGPS_APN_BEARER_IPV4; + break; + case APN_IP_IPV6: + bearerType = AGPS_APN_BEARER_IPV6; + break; + case APN_IP_IPV4V6: + bearerType = AGPS_APN_BEARER_IPV4V6; + break; + default: + bearerType = AGPS_APN_BEARER_INVALID; + break; + } + + int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType); + + EXIT_LOG(%d, ret_val); + return ret_val; +} + /*=========================================================================== FUNCTION loc_agps_closed @@ -775,7 +853,10 @@ SIDE EFFECTS static int loc_xtra_init(GpsXtraCallbacks* callbacks) { ENTRY_LOG(); - int ret_val = loc_eng_xtra_init(loc_afw_data, (GpsXtraExtCallbacks*)callbacks); + GpsXtraExtCallbacks extCallbacks; + memset(&extCallbacks, 0, sizeof(extCallbacks)); + extCallbacks.download_request_cb = callbacks->download_request_cb; + int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks); EXIT_LOG(%d, ret_val); return ret_val; @@ -811,6 +892,56 @@ static int loc_xtra_inject_data(char* data, int length) return ret_val; } +/*=========================================================================== +FUNCTION loc_gps_measurement_init + +DESCRIPTION + This function initializes the gps measurement interface + +DEPENDENCIES + NONE + +RETURN VALUE + None + +SIDE EFFECTS + N/A + +===========================================================================*/ +static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks) +{ + ENTRY_LOG(); + int ret_val = loc_eng_gps_measurement_init(loc_afw_data, + callbacks); + + EXIT_LOG(%d, ret_val); + return ret_val; +} + +/*=========================================================================== +FUNCTION loc_gps_measurement_close + +DESCRIPTION + This function closes the gps measurement interface + +DEPENDENCIES + NONE + +RETURN VALUE + None + +SIDE EFFECTS + N/A + +===========================================================================*/ +static void loc_gps_measurement_close() +{ + ENTRY_LOG(); + loc_eng_gps_measurement_close(loc_afw_data); + + EXIT_LOG(%s, VOID_RET); +} + /*=========================================================================== FUNCTION loc_ni_init @@ -888,6 +1019,40 @@ static void loc_agps_ril_update_network_availability(int available, const char* EXIT_LOG(%s, VOID_RET); } +static int loc_agps_install_certificates(const DerEncodedCertificate* certificates, + size_t length) +{ + ENTRY_LOG(); + int ret_val = loc_eng_agps_install_certificates(loc_afw_data, certificates, length); + EXIT_LOG(%d, ret_val); + return ret_val; +} +static int loc_agps_revoke_certificates(const Sha1CertificateFingerprint* fingerprints, + size_t length) +{ + ENTRY_LOG(); + LOC_LOGE("%s:%d]: agps_revoke_certificates not supported"); + int ret_val = AGPS_CERTIFICATE_ERROR_GENERIC; + EXIT_LOG(%d, ret_val); + return ret_val; +} + +static void loc_configuration_update(const char* config_data, int32_t length) +{ + ENTRY_LOG(); + loc_eng_configuration_update(loc_afw_data, config_data, length); + switch (sGnssType) + { + case GNSS_GSS: + case GNSS_AUTO: + case GNSS_QCA1530: + //APQ + gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); + break; + } + EXIT_LOG(%s, VOID_RET); +} + static void local_loc_cb(UlpLocation* location, void* locExt) { ENTRY_LOG(); @@ -910,3 +1075,4 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt) } EXIT_LOG(%s, VOID_RET); } + diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h index 8f41659a..41b968c4 100644 --- a/loc_api/libloc_api_50001/loc.h +++ b/loc_api/libloc_api_50001/loc.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 19c54a0f..de72aa8d 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-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 @@ -87,13 +87,27 @@ loc_gps_cfg_s_type gps_conf; loc_sap_cfg_s_type sap_conf; /* Parameter spec table */ -static loc_param_s_type loc_parameter_table[] = +static const loc_param_s_type gps_conf_table[] = { + {"GPS_LOCK", &gps_conf.GPS_LOCK, NULL, 'n'}, + {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'}, + {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, + {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, + {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'}, + {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'}, {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'}, {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'}, {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'}, - {"SUPL_VER", &gps_conf.SUPL_VER, NULL, 'n'}, {"CAPABILITIES", &gps_conf.CAPABILITIES, NULL, 'n'}, + {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, NULL, 'n'}, + {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'}, + {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'}, + {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'}, + {"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'}, +}; + +static const loc_param_s_type sap_conf_table[] = +{ {"GYRO_BIAS_RANDOM_WALK", &sap_conf.GYRO_BIAS_RANDOM_WALK, &sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, 'f'}, {"ACCEL_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, {"ANGLE_RANDOM_WALK_SPECTRAL_DENSITY", &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, &sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, 'f'}, @@ -110,23 +124,29 @@ static loc_param_s_type loc_parameter_table[] = {"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'}, {"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'}, {"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'}, - {"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'}, - {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, - {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, - {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'}, - {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'}, - {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'} + {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'} }; static void loc_default_parameters(void) { - /* defaults */ + /*Defaults for gps.conf*/ gps_conf.INTERMEDIATE_POS = 0; gps_conf.ACCURACY_THRES = 0; gps_conf.NMEA_PROVIDER = 0; + gps_conf.GPS_LOCK = 0; gps_conf.SUPL_VER = 0x10000; + gps_conf.SUPL_MODE = 0x3; gps_conf.CAPABILITIES = 0x7; + /* LTE Positioning Profile configuration is disable by default*/ + gps_conf.LPP_PROFILE = 0; + /*By default no positioning protocol is selected on A-GLONASS system*/ + gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0; + /*XTRA version check is disabled by default*/ + gps_conf.XTRA_VERSION_CHECK=0; + /*Use emergency PDN by default*/ + gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1; + /*Defaults for sap.conf*/ sap_conf.GYRO_BIAS_RANDOM_WALK = 0; sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC = 2; sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH = 5; @@ -139,25 +159,22 @@ static void loc_default_parameters(void) sap_conf.SENSOR_CONTROL_MODE = 0; /* AUTO */ sap_conf.SENSOR_USAGE = 0; /* Enabled */ sap_conf.SENSOR_ALGORITHM_CONFIG_MASK = 0; /* INS Disabled = FALSE*/ - /* Values MUST be set by OEMs in configuration for sensor-assisted navigation to work. There are NO default values */ sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY = 0; sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY = 0; sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY = 0; sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY = 0; - sap_conf.GYRO_BIAS_RANDOM_WALK_VALID = 0; sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID = 0; + /* default provider is SSC */ + sap_conf.SENSOR_PROVIDER = 1; - /* LTE Positioning Profile configuration is disable by default*/ - gps_conf.LPP_PROFILE = 0; - - /*By default no positioning protocol is selected on A-GLONASS system*/ - gps_conf.A_GLONASS_POS_PROTOCOL_SELECT = 0; + /* None of the 10 slots for agps certificates are writable by default */ + gps_conf.AGPS_CERT_WRITABLE_MASK = 0; } // 2nd half of init(), singled out for @@ -181,7 +198,6 @@ static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ; static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data); static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data); static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data); - static void deleteAidingData(loc_eng_data_s_type &logEng); static AgpsStateMachine* getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType); @@ -200,7 +216,6 @@ static void* noProc(void* data) return NULL; } - /********************************************************************* * definitions of the static messages used in the file *********************************************************************/ @@ -321,7 +336,6 @@ void LocEngGetZpp::send() const { mAdapter->sendMsg(this); } -// case LOC_ENG_MSG_SET_TIME: struct LocEngSetTime : public LocMsg { LocEngAdapter* mAdapter; const GpsUtcTime mTime; @@ -470,6 +484,24 @@ struct LocEngSuplVer : public LocMsg { } }; +struct LocEngSuplMode : public LocMsg { + UlpProxyBase* mUlp; + + inline LocEngSuplMode(UlpProxyBase* ulp) : + LocMsg(), mUlp(ulp) + { + locallog(); + } + inline virtual void proc() const { + mUlp->setCapabilities(getCarrierCapabilities()); + } + inline void locallog() const { + } + inline virtual void log() const { + locallog(); + } +}; + // case LOC_ENG_MSG_LPP_CONFIG: struct LocEngLppConfig : public LocMsg { LocEngAdapter* mAdapter; @@ -495,18 +527,20 @@ struct LocEngLppConfig : public LocMsg { struct LocEngSensorControlConfig : public LocMsg { LocEngAdapter* mAdapter; const int mSensorsDisabled; + const int mSensorProvider; inline LocEngSensorControlConfig(LocEngAdapter* adapter, - int sensorsDisabled) : - LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled) + int sensorsDisabled, int sensorProvider) : + LocMsg(), mAdapter(adapter), mSensorsDisabled(sensorsDisabled), + mSensorProvider(sensorProvider) { locallog(); } inline virtual void proc() const { - mAdapter->setSensorControlConfig(mSensorsDisabled); + mAdapter->setSensorControlConfig(mSensorsDisabled, mSensorProvider); } inline void locallog() const { - LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d", - mSensorsDisabled); + LOC_LOGV("LocEngSensorControlConfig - Sensors Disabled: %d, Sensor Provider: %d", + mSensorsDisabled, mSensorProvider); } inline virtual void log() const { locallog(); @@ -750,8 +784,13 @@ void LocEngReportPosition::proc() const { locEng->adapter->setInSession(false); } + LOC_LOGV("LocEngReportPosition::proc() - generateNmea: %d, position source: %d, " + "engine_status: %d, isInSession: %d", + locEng->generateNmea, mLocation.position_source, + locEng->engine_status, locEng->adapter->isInSession()); + if (locEng->generateNmea && - mLocation.position_source == ULP_LOCATION_IS_FROM_GNSS) + locEng->adapter->isInSession()) { unsigned char generate_nmea = reported && (mStatus != LOC_SESS_FAILURE); @@ -770,16 +809,7 @@ void LocEngReportPosition::proc() const { } } void LocEngReportPosition::locallog() const { - LOC_LOGV("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n " - "altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n " - "timestamp: %lld\n rawDataSize: %d\n rawData: %p\n Session" - " status: %d\n Technology mask: %u", - mLocation.gpsLocation.flags, mLocation.position_source, - mLocation.gpsLocation.latitude, mLocation.gpsLocation.longitude, - mLocation.gpsLocation.altitude, mLocation.gpsLocation.speed, - mLocation.gpsLocation.bearing, mLocation.gpsLocation.accuracy, - mLocation.gpsLocation.timestamp, mLocation.rawDataSize, - mLocation.rawData, mStatus, mTechMask); + LOC_LOGV("LocEngReportPosition"); } void LocEngReportPosition::log() const { locallog(); @@ -791,7 +821,7 @@ void LocEngReportPosition::send() const { // case LOC_ENG_MSG_REPORT_SV: LocEngReportSv::LocEngReportSv(LocAdapterBase* adapter, - GpsSvStatus &sv, + GnssSvStatus &sv, GpsLocationExtended &locExtended, void* svExt) : LocMsg(), mAdapter(adapter), mSvStatus(sv), @@ -820,19 +850,7 @@ void LocEngReportSv::proc() const { } } void LocEngReportSv::locallog() const { - LOC_LOGV("num sv: %d\n ephemeris mask: %dxn almanac mask: %x\n " - "used in fix mask: %x\n sv: prn snr " - "elevation azimuth", - mSvStatus.num_svs, mSvStatus.ephemeris_mask, - mSvStatus.almanac_mask, mSvStatus.used_in_fix_mask); - for (int i = 0; i < mSvStatus.num_svs && i < GPS_MAX_SVS; i++) { - LOC_LOGV(" %d: %d %f %f %f\n ", - i, - mSvStatus.sv_list[i].prn, - mSvStatus.sv_list[i].snr, - mSvStatus.sv_list[i].elevation, - mSvStatus.sv_list[i].azimuth); - } + LOC_LOGV("%s:%d] LocEngReportSv",__func__, __LINE__); } inline void LocEngReportSv::log() const { locallog(); @@ -1069,7 +1087,17 @@ void LocEngRequestSuplEs::proc() const { AgpsStateMachine* sm = locEng->ds_nif; DSSubscriber s(sm, mID); sm->subscribeRsrc((Subscriber*)&s); - } else { + } + else if (locEng->agnss_nif) { + AgpsStateMachine *sm = locEng->agnss_nif; + ATLSubscriber s(mID, + sm, + locEng->adapter, + false); + sm->subscribeRsrc((Subscriber*)&s); + LOC_LOGD("%s:%d]: Using regular ATL for SUPL ES", __func__, __LINE__); + } + else { locEng->adapter->atlOpenStatus(mID, 0, NULL, -1, -1); } } @@ -1315,6 +1343,33 @@ struct LocEngEnableData : public LocMsg { // case LOC_ENG_MSG_INJECT_XTRA_DATA: // loc_eng_xtra.cpp +// case LOC_ENG_MSG_SET_CAPABILITIES: +struct LocEngSetCapabilities : public LocMsg { + loc_eng_data_s_type* mLocEng; + inline LocEngSetCapabilities(loc_eng_data_s_type* locEng) : + LocMsg(), mLocEng(locEng) + { + locallog(); + } + inline virtual void proc() const { + if (NULL != mLocEng->set_capabilities_cb) { + LOC_LOGV("calling set_capabilities_cb 0x%x", + gps_conf.CAPABILITIES); + mLocEng->set_capabilities_cb(gps_conf.CAPABILITIES); + } else { + LOC_LOGV("set_capabilities_cb is NULL.\n"); + } + } + inline void locallog() const + { + LOC_LOGV("LocEngSetCapabilities"); + } + inline virtual void log() const + { + locallog(); + } +}; + // case LOC_ENG_MSG_LOC_INIT: struct LocEngInit : public LocMsg { loc_eng_data_s_type* mLocEng; @@ -1325,6 +1380,8 @@ struct LocEngInit : public LocMsg { } inline virtual void proc() const { loc_eng_reinit(*mLocEng); + // set the capabilities + mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng)); } inline void locallog() const { @@ -1367,7 +1424,7 @@ struct LocEngAtlOpenSuccess : public LocMsg { mStateMachine->onRsrcEvent(RSRC_GRANTED); } inline void locallog() const { - LOC_LOGV("LocEngAtlClosed agps type: %s\n apn: %s\n" + LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n" " bearer type: %s", loc_get_agps_type_name(mStateMachine->getType()), mAPN, @@ -1468,6 +1525,144 @@ struct LocEngDataClientInit : public LocMsg { } }; +struct LocEngInstallAGpsCert : public LocMsg { + LocEngAdapter* mpAdapter; + const size_t mNumberOfCerts; + const uint32_t mSlotBitMask; + DerEncodedCertificate* mpData; + inline LocEngInstallAGpsCert(LocEngAdapter* adapter, + const DerEncodedCertificate* pData, + size_t numberOfCerts, + uint32_t slotBitMask) : + LocMsg(), mpAdapter(adapter), + mNumberOfCerts(numberOfCerts), mSlotBitMask(slotBitMask), + mpData(new DerEncodedCertificate[mNumberOfCerts]) + { + for (int i=0; i < mNumberOfCerts; i++) { + mpData[i].data = new u_char[pData[i].length]; + if (mpData[i].data) { + memcpy(mpData[i].data, (void*)pData[i].data, pData[i].length); + mpData[i].length = pData[i].length; + } else { + LOC_LOGE("malloc failed for cert#%d", i); + break; + } + } + locallog(); + } + inline ~LocEngInstallAGpsCert() + { + for (int i=0; i < mNumberOfCerts; i++) { + if (mpData[i].data) { + delete[] mpData[i].data; + } + } + delete[] mpData; + } + inline virtual void proc() const { + mpAdapter->installAGpsCert(mpData, mNumberOfCerts, mSlotBitMask); + } + inline void locallog() const { + LOC_LOGV("LocEngInstallAGpsCert - certs=%u mask=%u", + mNumberOfCerts, mSlotBitMask); + } + inline virtual void log() const { + locallog(); + } +}; + +struct LocEngUpdateRegistrationMask : public LocMsg { + loc_eng_data_s_type* mLocEng; + LOC_API_ADAPTER_EVENT_MASK_T mMask; + loc_registration_mask_status mIsEnabled; + inline LocEngUpdateRegistrationMask(loc_eng_data_s_type* locEng, + LOC_API_ADAPTER_EVENT_MASK_T mask, + loc_registration_mask_status isEnabled) : + LocMsg(), mLocEng(locEng), mMask(mask), mIsEnabled(isEnabled) { + locallog(); + } + inline virtual void proc() const { + loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng; + locEng->adapter->updateRegistrationMask(mMask, + mIsEnabled); + } + void locallog() const { + LOC_LOGV("LocEngUpdateRegistrationMask\n"); + } + virtual void log() const { + locallog(); + } +}; + +struct LocEngGnssConstellationConfig : public LocMsg { + LocEngAdapter* mAdapter; + inline LocEngGnssConstellationConfig(LocEngAdapter* adapter) : + LocMsg(), mAdapter(adapter) { + locallog(); + } + inline virtual void proc() const { + if (mAdapter->gnssConstellationConfig()) { + LOC_LOGV("Modem supports GNSS measurements\n"); + gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS; + } else { + LOC_LOGV("Modem does not support GNSS measurements\n"); + } + } + void locallog() const { + LOC_LOGV("LocEngGnssConstellationConfig\n"); + } + virtual void log() const { + locallog(); + } +}; + +// case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT: +LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng, + GpsData &gpsData) : + LocMsg(), mLocEng(locEng), mGpsData(gpsData) +{ + locallog(); +} +void LocEngReportGpsMeasurement::proc() const { + loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng; + if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) + { + if (locEng->gps_measurement_cb != NULL) { + locEng->gps_measurement_cb((GpsData*)&(mGpsData)); + } + } +} +void LocEngReportGpsMeasurement::locallog() const { + IF_LOC_LOGV { + LOC_LOGV("%s:%d]: Received in GPS HAL." + "GNSS Measurements count: %d \n", + __func__, __LINE__, mGpsData.measurement_count); + for (int i =0; i< mGpsData.measurement_count && i < GPS_MAX_SVS; i++) { + LOC_LOGV(" GNSS measurement data in GPS HAL: \n" + " GPS_HAL => Measurement ID | prn | time_offset_ns | state |" + " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |" + " pseudorange_rate_uncertainty_mps |" + " accumulated_delta_range_state | flags \n" + " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n", + i, + mGpsData.measurements[i].prn, + mGpsData.measurements[i].time_offset_ns, + mGpsData.measurements[i].state, + mGpsData.measurements[i].received_gps_tow_ns, + mGpsData.measurements[i].c_n0_dbhz, + mGpsData.measurements[i].pseudorange_rate_mps, + mGpsData.measurements[i].pseudorange_rate_uncertainty_mps, + mGpsData.measurements[i].accumulated_delta_range_state, + mGpsData.measurements[i].flags); + } + LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n" + " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type, + mGpsData.clock.time_ns); + } +} +inline void LocEngReportGpsMeasurement::log() const { + locallog(); +} /********************************************************************* * Initialization checking macros @@ -1482,6 +1677,24 @@ struct LocEngDataClientInit : public LocMsg { } #define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret) +uint32_t getCarrierCapabilities() { + #define carrierMSA (uint32_t)0x2 + #define carrierMSB (uint32_t)0x1 + #define gpsConfMSA (uint32_t)0x4 + #define gpsConfMSB (uint32_t)0x2 + uint32_t capabilities = gps_conf.CAPABILITIES; + if ((gps_conf.SUPL_MODE & carrierMSA) != carrierMSA) { + capabilities &= ~gpsConfMSA; + } + if ((gps_conf.SUPL_MODE & carrierMSB) != carrierMSB) { + capabilities &= ~gpsConfMSB; + } + + LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x", + gps_conf.CAPABILITIES, gps_conf.SUPL_MODE, capabilities); + return capabilities; +} + /*=========================================================================== FUNCTION loc_eng_init @@ -1518,15 +1731,12 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, memset(&loc_eng_data, 0, sizeof (loc_eng_data)); - if (NULL != callbacks->set_capabilities_cb) { - callbacks->set_capabilities_cb(gps_conf.CAPABILITIES); - } - // Save callbacks loc_eng_data.location_cb = callbacks->location_cb; loc_eng_data.sv_status_cb = callbacks->sv_status_cb; loc_eng_data.status_cb = callbacks->status_cb; loc_eng_data.nmea_cb = callbacks->nmea_cb; + loc_eng_data.set_capabilities_cb = callbacks->set_capabilities_cb; loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb; loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb; loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb; @@ -1535,7 +1745,6 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ? callbacks->sv_ext_parser : noProc; loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS; - // initial states taken care of by the memset above // loc_eng_data.engine_status -- GPS_STATUS_NONE; // loc_eng_data.fix_session_status -- GPS_STATUS_NONE; @@ -1553,7 +1762,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.adapter = new LocEngAdapter(event, &loc_eng_data, context, - (MsgTask::tCreate)callbacks->create_thread_cb); + (LocThread::tCreate)callbacks->create_thread_cb); LOC_LOGD("loc_eng_init created client, id = %p\n", loc_eng_data.adapter); @@ -1567,51 +1776,51 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data) { ENTRY_LOG(); int ret_val = LOC_API_ADAPTER_ERR_SUCCESS; + LocEngAdapter* adapter = loc_eng_data.adapter; - if (LOC_API_ADAPTER_ERR_SUCCESS == ret_val) { - LOC_LOGD("loc_eng_reinit reinit() successful"); + adapter->sendMsg(new LocEngGnssConstellationConfig(adapter)); + adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER)); + adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE)); + adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE, + sap_conf.SENSOR_PROVIDER)); + adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); - LocEngAdapter* adapter = loc_eng_data.adapter; - adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER)); - adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE)); - adapter->sendMsg(new LocEngSensorControlConfig(adapter, sap_conf.SENSOR_USAGE)); - adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); - - /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */ - if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID || - sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || - sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) - { - adapter->sendMsg(new LocEngSensorProperties(adapter, - sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, - sap_conf.GYRO_BIAS_RANDOM_WALK, - sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, - sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, - sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, - sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, - sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY)); - } - - adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter, - sap_conf.SENSOR_CONTROL_MODE, - sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, - sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, - sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, - sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, - sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, - sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, - sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, - sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, - sap_conf.SENSOR_ALGORITHM_CONFIG_MASK)); - - adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0))); + /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */ + if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID || + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID || + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID ) { + adapter->sendMsg(new LocEngSensorProperties(adapter, + sap_conf.GYRO_BIAS_RANDOM_WALK_VALID, + sap_conf.GYRO_BIAS_RANDOM_WALK, + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.ANGLE_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.RATE_RANDOM_WALK_SPECTRAL_DENSITY, + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID, + sap_conf.VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY)); } + adapter->sendMsg(new LocEngSensorPerfControlConfig(adapter, + sap_conf.SENSOR_CONTROL_MODE, + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH, + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC, + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH, + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC, + sap_conf.SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH, + sap_conf.SENSOR_ACCEL_BATCHES_PER_SEC_HIGH, + sap_conf.SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH, + sap_conf.SENSOR_GYRO_BATCHES_PER_SEC_HIGH, + sap_conf.SENSOR_ALGORITHM_CONFIG_MASK)); + + adapter->sendMsg(new LocEngEnableData(adapter, NULL, 0, (agpsStatus ? 1:0))); + + loc_eng_xtra_version_check(loc_eng_data, gps_conf.XTRA_VERSION_CHECK); + + LOC_LOGD("loc_eng_reinit reinit() successful"); EXIT_LOG(%d, ret_val); return ret_val; } @@ -1711,10 +1920,11 @@ static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data) ret_val = loc_eng_data.adapter->startFix(); if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS || - ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN) + ret_val == LOC_API_ADAPTER_ERR_ENGINE_DOWN || + ret_val == LOC_API_ADAPTER_ERR_PHONE_OFFLINE || + ret_val == LOC_API_ADAPTER_ERR_INTERNAL) { loc_eng_data.adapter->setInSession(TRUE); - loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_BEGIN); } } @@ -1760,11 +1970,6 @@ static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data) if (loc_eng_data.adapter->isInSession()) { ret_val = loc_eng_data.adapter->stopFix(); - if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS) - { - loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END); - } - loc_eng_data.adapter->setInSession(FALSE); } @@ -1817,14 +2022,12 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); - int gnssType = getTargetGnssType(loc_get_target()); - - // The position mode for GSS/QCA1530 can only be standalone - bool is1530 = gnssType == GNSS_QCA1530; - bool isAPQ = gnssType == GNSS_GSS; - if ((isAPQ || is1530) && params.mode != LOC_POSITION_MODE_STANDALONE) { + // The position mode for AUTO/GSS/QCA1530 can only be standalone + if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) && + !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) && + (params.mode != LOC_POSITION_MODE_STANDALONE)) { params.mode = LOC_POSITION_MODE_STANDALONE; - LOC_LOGD("Position mode changed to standalone for target with GSS/qca1530."); + LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530."); } if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params)) @@ -1890,7 +2093,7 @@ int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); LocEngAdapter* adapter = loc_eng_data.adapter; - if(!adapter->mCPIEnabled) + if(adapter->mSupportsPositionInjection) { adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude, accuracy)); @@ -2096,18 +2299,17 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call AGPS_TYPE_WIFI, true); - int gnssType = getTargetGnssType(loc_get_target()); - bool isAPQ = (gnssType == GNSS_GSS); - bool is1530 = (gnssType == GNSS_QCA1530); - if (!isAPQ && !is1530) { + if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || + (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) { loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps, (void *)loc_eng_data.agps_status_cb, AGPS_TYPE_SUPL, false); - if (adapter->mAgpsEnabled) { - loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); - + if (adapter->mSupportsAgpsRequests) { + if(gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) { + loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); + } loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb, NULL, NULL, &loc_eng_data); } @@ -2139,7 +2341,9 @@ getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) { break; } case AGPS_TYPE_SUPL_ES: { - stateMachine = locEng.ds_nif; + locEng.ds_nif ? + stateMachine = locEng.ds_nif: + stateMachine = locEng.agnss_nif; break; } default: @@ -2319,7 +2523,14 @@ static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data, if (LOC_AGPS_SUPL_SERVER == type) { char url[MAX_URL_LEN]; - unsigned int len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port); + unsigned int len = 0; + const char nohost[] = "NONE"; + if (hostname == NULL || + strncasecmp(nohost, hostname, sizeof(nohost)) == 0) { + url[0] = NULL; + } else { + len = snprintf(url, sizeof(url), "%s:%u", hostname, (unsigned) port); + } if (sizeof(url) > len) { adapter->sendMsg(new LocEngSetServerUrl(adapter, url, len)); @@ -2369,29 +2580,29 @@ int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG_CALLFLOW(); int ret_val = 0; + LOC_LOGV("save the address, type: %d, hostname: %s, port: %d", + (int) type, hostname, port); + switch (type) + { + case LOC_AGPS_SUPL_SERVER: + strlcpy(loc_eng_data.supl_host_buf, hostname, + sizeof(loc_eng_data.supl_host_buf)); + loc_eng_data.supl_port_buf = port; + loc_eng_data.supl_host_set = 1; + break; + case LOC_AGPS_CDMA_PDE_SERVER: + strlcpy(loc_eng_data.c2k_host_buf, hostname, + sizeof(loc_eng_data.c2k_host_buf)); + loc_eng_data.c2k_port_buf = port; + loc_eng_data.c2k_host_set = 1; + break; + default: + LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type); + } + if (NULL != loc_eng_data.adapter) { ret_val = loc_eng_set_server(loc_eng_data, type, hostname, port); - } else { - LOC_LOGW("set_server called before init. save the address, type: %d, hostname: %s, port: %d", - (int) type, hostname, port); - switch (type) - { - case LOC_AGPS_SUPL_SERVER: - strlcpy(loc_eng_data.supl_host_buf, hostname, - sizeof(loc_eng_data.supl_host_buf)); - loc_eng_data.supl_port_buf = port; - loc_eng_data.supl_host_set = 1; - break; - case LOC_AGPS_CDMA_PDE_SERVER: - strlcpy(loc_eng_data.c2k_host_buf, hostname, - sizeof(loc_eng_data.c2k_host_buf)); - loc_eng_data.c2k_port_buf = port; - loc_eng_data.c2k_host_set = 1; - break; - default: - LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type); - } } EXIT_LOG(%d, ret_val); @@ -2438,6 +2649,93 @@ void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_d EXIT_LOG(%s, VOID_RET); } +int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data, + const DerEncodedCertificate* certificates, + size_t numberOfCerts) +{ + ENTRY_LOG_CALLFLOW(); + int ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS; + + uint32_t slotBitMask = gps_conf.AGPS_CERT_WRITABLE_MASK; + uint32_t slotCount = 0; + for (uint32_t slotBitMaskCounter=slotBitMask; slotBitMaskCounter; slotCount++) { + slotBitMaskCounter &= slotBitMaskCounter - 1; + } + LOC_LOGD("SlotBitMask=%u SlotCount=%u NumberOfCerts=%u", + slotBitMask, slotCount, numberOfCerts); + + LocEngAdapter* adapter = loc_eng_data.adapter; + + if (numberOfCerts == 0) { + LOC_LOGE("No certs to install, since numberOfCerts is zero"); + ret_val = AGPS_CERTIFICATE_OPERATION_SUCCESS; + } else if (!adapter) { + LOC_LOGE("adapter is null!"); + ret_val = AGPS_CERTIFICATE_ERROR_GENERIC; + } else if (slotCount < numberOfCerts) { + LOC_LOGE("Not enough cert slots (%u) to install %u certs!", + slotCount, numberOfCerts); + ret_val = AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES; + } else { + for (int i=0; i < numberOfCerts; ++i) + { + if (certificates[i].length > AGPS_CERTIFICATE_MAX_LENGTH) { + LOC_LOGE("cert#(%u) length of %u is too big! greater than %u", + certificates[i].length, AGPS_CERTIFICATE_MAX_LENGTH); + ret_val = AGPS_CERTIFICATE_ERROR_GENERIC; + break; + } + } + + if (ret_val == AGPS_CERTIFICATE_OPERATION_SUCCESS) { + adapter->sendMsg(new LocEngInstallAGpsCert(adapter, + certificates, + numberOfCerts, + slotBitMask)); + } + } + + EXIT_LOG(%d, ret_val); + return ret_val; +} + +void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, + const char* config_data, int32_t length) +{ + ENTRY_LOG_CALLFLOW(); + + if (config_data && length > 0) { + loc_gps_cfg_s_type gps_conf_tmp = gps_conf; + UTIL_UPDATE_CONF(config_data, length, gps_conf_table); + LocEngAdapter* adapter = loc_eng_data.adapter; + + // it is possible that HAL is not init'ed at this time + if (adapter) { + if (gps_conf_tmp.SUPL_VER != gps_conf.SUPL_VER) { + adapter->sendMsg(new LocEngSuplVer(adapter, gps_conf.SUPL_VER)); + } + if (gps_conf_tmp.LPP_PROFILE != gps_conf.LPP_PROFILE) { + adapter->sendMsg(new LocEngLppConfig(adapter, gps_conf.LPP_PROFILE)); + } + if (gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT != gps_conf.A_GLONASS_POS_PROTOCOL_SELECT) { + adapter->sendMsg(new LocEngAGlonassProtocol(adapter, + gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); + } + if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) { + adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy())); + } + } + + gps_conf_tmp.SUPL_VER = gps_conf.SUPL_VER; + gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE; + gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT; + gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK; + gps_conf = gps_conf_tmp; + } + + EXIT_LOG(%s, VOID_RET); +} + /*=========================================================================== FUNCTION loc_eng_report_status @@ -2537,6 +2835,8 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ENTRY_LOG(); loc_eng_reinit(loc_eng_data); + loc_eng_data.adapter->requestPowerVote(); + if (loc_eng_data.agps_status_cb != NULL) { if (loc_eng_data.agnss_nif) loc_eng_data.agnss_nif->dropAllSubscribers(); @@ -2546,14 +2846,11 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) loc_eng_agps_reinit(loc_eng_data); } - loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_ON); - // modem is back up. If we crashed in the middle of navigating, we restart. if (loc_eng_data.adapter->isInSession()) { // This sets the copy in adapter to modem - loc_eng_data.adapter->setPositionMode(NULL); loc_eng_data.adapter->setInSession(false); - loc_eng_start_handler(loc_eng_data); + loc_eng_data.adapter->sendMsg(new LocEngStartFix(loc_eng_data.adapter)); } EXIT_LOG(%s, VOID_RET); } @@ -2583,8 +2880,8 @@ int loc_eng_read_config(void) loc_default_parameters(); // We only want to parse the conf file once. This is a good place to ensure that. // In fact one day the conf file should go into context. - UTIL_READ_CONF(GPS_CONF_FILE, loc_parameter_table); - UTIL_READ_CONF(SAP_CONF_FILE, loc_parameter_table); + UTIL_READ_CONF(GPS_CONF_FILE, gps_conf_table); + UTIL_READ_CONF(SAP_CONF_FILE, sap_conf_table); configAlreadyRead = true; } else { LOC_LOGV("GPS Config file has already been read\n"); @@ -2593,3 +2890,80 @@ int loc_eng_read_config(void) EXIT_LOG(%d, 0); return 0; } + +/*=========================================================================== +FUNCTION loc_eng_gps_measurement_init + +DESCRIPTION + Initialize gps measurement module. + +DEPENDENCIES + N/A + +RETURN VALUE + 0: success + +SIDE EFFECTS + N/A + +===========================================================================*/ +int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data, + GpsMeasurementCallbacks* callbacks) +{ + ENTRY_LOG_CALLFLOW(); + + STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb), + "gps measurement already initialized", + return GPS_MEASUREMENT_ERROR_ALREADY_INIT); + STATE_CHECK((callbacks != NULL), + "callbacks can not be NULL", + return GPS_MEASUREMENT_ERROR_GENERIC); + STATE_CHECK(loc_eng_data.adapter, + "GpsInterface must be initialized first", + return GPS_MEASUREMENT_ERROR_GENERIC); + + // updated the mask + LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; + loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask( + &loc_eng_data, + event, + LOC_REGISTRATION_MASK_ENABLED)); + // set up the callback + loc_eng_data.gps_measurement_cb = callbacks->measurement_callback; + LOC_LOGD ("%s, event masks updated successfully", __func__); + + return GPS_MEASUREMENT_OPERATION_SUCCESS; +} + +/*=========================================================================== +FUNCTION loc_eng_gps_measurement_close + +DESCRIPTION + Close gps measurement module. + +DEPENDENCIES + N/A + +RETURN VALUE + N/A + +SIDE EFFECTS + N/A + +===========================================================================*/ +void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data) +{ + ENTRY_LOG_CALLFLOW(); + + INIT_CHECK(loc_eng_data.adapter, return); + + // updated the mask + LOC_API_ADAPTER_EVENT_MASK_T event = LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT; + loc_eng_data.adapter->sendMsg(new LocEngUpdateRegistrationMask( + &loc_eng_data, + event, + LOC_REGISTRATION_MASK_DISABLED)); + // set up the callback + loc_eng_data.gps_measurement_cb = NULL; + EXIT_LOG(%d, 0); +} diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index c1dc8af5..92814f8d 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -89,9 +89,11 @@ typedef struct loc_eng_data_s agps_status_extended agps_status_cb; gps_nmea_callback nmea_cb; gps_ni_notify_callback ni_notify_cb; + gps_set_capabilities set_capabilities_cb; gps_acquire_wakelock acquire_wakelock_cb; gps_release_wakelock release_wakelock_cb; gps_request_utc_time request_utc_time_cb; + gps_measurement_callback gps_measurement_cb; boolean intermediateFix; AGpsStatusValue agps_status; loc_eng_xtra_data_s_type xtra_module_data; @@ -137,36 +139,50 @@ typedef struct loc_eng_data_s } loc_eng_data_s_type; /* GPS.conf support */ +/* NOTE: the implementaiton of the parser casts number + fields to 32 bit. To ensure all 'n' fields working, + they must all be 32 bit fields. */ typedef struct loc_gps_cfg_s { - unsigned long INTERMEDIATE_POS; - unsigned long ACCURACY_THRES; - unsigned long SUPL_VER; - unsigned long CAPABILITIES; - unsigned long QUIPC_ENABLED; - unsigned long LPP_PROFILE; - uint8_t NMEA_PROVIDER; - unsigned long A_GLONASS_POS_PROTOCOL_SELECT; - char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH]; - char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH]; - char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH]; + uint32_t INTERMEDIATE_POS; + uint32_t ACCURACY_THRES; + uint32_t SUPL_VER; + uint32_t SUPL_MODE; + uint32_t CAPABILITIES; + uint32_t LPP_PROFILE; + uint32_t XTRA_VERSION_CHECK; + char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH]; + uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL; + uint32_t NMEA_PROVIDER; + uint32_t GPS_LOCK; + uint32_t A_GLONASS_POS_PROTOCOL_SELECT; + uint32_t AGPS_CERT_WRITABLE_MASK; } loc_gps_cfg_s_type; +/* NOTE: the implementaiton of the parser casts number + fields to 32 bit. To ensure all 'n' fields working, + they must all be 32 bit fields. */ +/* Meanwhile, *_valid fields are 8 bit fields, and 'f' + fields are double. Rigid as they are, it is the + the status quo, until the parsing mechanism is + change, that is. */ typedef struct { uint8_t GYRO_BIAS_RANDOM_WALK_VALID; double GYRO_BIAS_RANDOM_WALK; - unsigned long SENSOR_ACCEL_BATCHES_PER_SEC; - unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH; - unsigned long SENSOR_GYRO_BATCHES_PER_SEC; - unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH; - unsigned long SENSOR_ACCEL_BATCHES_PER_SEC_HIGH; - unsigned long SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH; - unsigned long SENSOR_GYRO_BATCHES_PER_SEC_HIGH; - unsigned long SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH; - unsigned long SENSOR_CONTROL_MODE; - unsigned long SENSOR_USAGE; - unsigned long SENSOR_ALGORITHM_CONFIG_MASK; + 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; @@ -175,11 +191,16 @@ typedef struct double RATE_RANDOM_WALK_SPECTRAL_DENSITY; uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID; double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY; + uint32_t SENSOR_PROVIDER; } loc_sap_cfg_s_type; extern loc_gps_cfg_s_type gps_conf; extern loc_sap_cfg_s_type sap_conf; + +uint32_t getCarrierCapabilities(); + +//loc_eng functions int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, LOC_API_ADAPTER_EVENT_MASK_T event, @@ -199,35 +220,33 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data, LocPosMode ¶ms); const void* loc_eng_get_extension(loc_eng_data_s_type &loc_eng_data, const char* name); +int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, + LocServerType type, const char *hostname, int port); +void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data); +int loc_eng_read_config(void); + +//loc_eng_agps functions void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* callbacks); int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType, const char* apn, AGpsBearerType bearerType); int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType); int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType); - -int loc_eng_set_server_proxy(loc_eng_data_s_type &loc_eng_data, - LocServerType type, const char *hostname, int port); - - void loc_eng_agps_ril_update_network_availability(loc_eng_data_s_type &loc_eng_data, int avaiable, const char* apn); +int loc_eng_agps_install_certificates(loc_eng_data_s_type &loc_eng_data, + const DerEncodedCertificate* certificates, + size_t length); - -bool loc_eng_inject_raw_command(loc_eng_data_s_type &loc_eng_data, - char* command, int length); - - -void loc_eng_mute_one_session(loc_eng_data_s_type &loc_eng_data); - -int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, +//loc_eng_xtra functions +int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, GpsXtraExtCallbacks* callbacks); - -int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, +int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, char* data, int length); +int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data); +void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, int check); -int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data); - +//loc_eng_ni functions extern void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callbacks); extern void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data, @@ -236,7 +255,12 @@ extern void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, const GpsNiNotification *notif, const void* passThrough); extern void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data); -int loc_eng_read_config(void); + +void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, + const char* config_data, int32_t length); +int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data, + GpsMeasurementCallbacks* callbacks); +void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data); #ifdef __cplusplus } diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp index cf9fe82d..43af70fe 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.cpp +++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp @@ -761,11 +761,11 @@ int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const if (s == NULL) { nifRequest.ipv4_addr = INADDR_NONE; - nifRequest.ipv6_addr[0] = 0; + memset(&nifRequest.addr, 0, sizeof(nifRequest.addr)); nifRequest.ssid[0] = '\0'; nifRequest.password[0] = '\0'; } else { - s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr); + s->setIPAddresses(nifRequest.addr); s->setWifiInfo(nifRequest.ssid, nifRequest.password); } diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h index d68970f3..8b8f9f44 100644 --- a/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/loc_api/libloc_api_50001/loc_eng_agps.h @@ -280,6 +280,7 @@ struct Subscriber { inline virtual ~Subscriber() {} virtual void setIPAddresses(uint32_t &v4, char* v6) = 0; + virtual void setIPAddresses(struct sockaddr_storage& addr) = 0; inline virtual void setWifiInfo(char* ssid, char* password) { ssid[0] = 0; password[0] = 0; } @@ -320,6 +321,9 @@ struct BITSubscriber : public Subscriber { inline virtual void setIPAddresses(uint32_t &v4, char* v6) { v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); } + inline virtual void setIPAddresses(struct sockaddr_storage& addr) + { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ } + virtual Subscriber* clone() { return new BITSubscriber(mStateMachine, ID, mIPv6Addr); @@ -344,6 +348,9 @@ struct ATLSubscriber : public Subscriber { inline virtual void setIPAddresses(uint32_t &v4, char* v6) { v4 = INADDR_NONE; v6[0] = 0; } + inline virtual void setIPAddresses(struct sockaddr_storage& addr) + { addr.ss_family = AF_INET6; } + inline virtual Subscriber* clone() { return new ATLSubscriber(ID, mStateMachine, mLocAdapter, @@ -376,6 +383,9 @@ struct WIFISubscriber : public Subscriber { inline virtual void setIPAddresses(uint32_t &v4, char* v6) {} + inline virtual void setIPAddresses(struct sockaddr_storage& addr) + { addr.ss_family = AF_INET6; } + inline virtual void setWifiInfo(char* ssid, char* password) { if (NULL != mSSID) @@ -409,6 +419,8 @@ struct DSSubscriber : public Subscriber { mIsInactive = false; } inline virtual void setIPAddresses(uint32_t &v4, char* v6) {} + inline virtual void setIPAddresses(struct sockaddr_storage& addr) + { addr.ss_family = AF_INET6; } virtual Subscriber* clone() {return new DSSubscriber(mStateMachine, ID);} virtual bool notifyRsrcStatus(Notification ¬ification); diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp index d24e0c9d..5510fc5c 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp @@ -136,7 +136,7 @@ static int loc_api_server_proc(void *context) free(p_cmsgbuf); LOC_LOGE("%s:%d] fail receiving msg from gpsone_daemon, retry later\n", __func__, __LINE__); usleep(1000); - return 0; + return -1; } LOC_LOGD("%s:%d] received ctrl_type = %d\n", __func__, __LINE__, p_cmsgbuf->ctrl_type); diff --git a/loc_api/libloc_api_50001/loc_eng_dmn_conn.h b/loc_api/libloc_api_50001/loc_eng_dmn_conn.h index c7c100b2..1d8c1428 100644 --- a/loc_api/libloc_api_50001/loc_eng_dmn_conn.h +++ b/loc_api/libloc_api_50001/loc_eng_dmn_conn.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,11 +33,11 @@ #ifdef _ANDROID_ -#define GPSONE_LOC_API_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_q" -#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/gpsone_d/gpsone_loc_api_resp_q" -#define QUIPC_CTRL_Q_PATH "/data/misc/gpsone_d/quipc_ctrl_q" -#define MSAPM_CTRL_Q_PATH "/data/misc/gpsone_d/msapm_ctrl_q" -#define MSAPU_CTRL_Q_PATH "/data/misc/gpsone_d/msapu_ctrl_q" +#define GPSONE_LOC_API_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_q" +#define GPSONE_LOC_API_RESP_Q_PATH "/data/misc/location/gpsone_d/gpsone_loc_api_resp_q" +#define QUIPC_CTRL_Q_PATH "/data/misc/location/gpsone_d/quipc_ctrl_q" +#define MSAPM_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapm_ctrl_q" +#define MSAPU_CTRL_Q_PATH "/data/misc/location/gpsone_d/msapu_ctrl_q" #else diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index 9a8b0e4d..3a1a86b9 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -105,11 +105,11 @@ struct LocEngReportPosition : public LocMsg { struct LocEngReportSv : public LocMsg { LocAdapterBase* mAdapter; - const GpsSvStatus mSvStatus; + const GnssSvStatus mSvStatus; const GpsLocationExtended mLocationExtended; const void* mSvExt; LocEngReportSv(LocAdapterBase* adapter, - GpsSvStatus &sv, + GnssSvStatus &sv, GpsLocationExtended &locExtended, void* svExtended); virtual void proc() const; @@ -289,6 +289,16 @@ struct LocEngGetZpp : public LocMsg { void send() const; }; +struct LocEngReportGpsMeasurement : public LocMsg { + void* mLocEng; + const GpsData mGpsData; + LocEngReportGpsMeasurement(void* locEng, + GpsData &gpsData); + virtual void proc() const; + void locallog() const; + virtual void log() const; +}; + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index cc894481..3b20bbbc 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -115,28 +115,45 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG(); char lcs_addr[32]; // Decoded LCS address for UMTS CP NI loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data; + loc_eng_ni_session_s_type* pSession = NULL; if (NULL == loc_eng_data.ni_notify_cb) { EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet."); return; } - /* If busy, use default or deny */ - if (NULL != loc_eng_ni_data_p->rawRequest) - { - /* XXX Consider sending a NO RESPONSE reply or queue the request */ - LOC_LOGW("loc_eng_ni_request_handler, notification in progress, new NI request ignored, type: %d", - notif->ni_type); - if (NULL != passThrough) { - free((void*)passThrough); + if (notif->ni_type == GPS_NI_TYPE_EMERGENCY_SUPL) { + if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { + LOC_LOGW("loc_eng_ni_request_handler, supl es NI in progress, new supl es NI ignored, type: %d", + notif->ni_type); + if (NULL != passThrough) { + free((void*)passThrough); + } + } else { + pSession = &loc_eng_ni_data_p->sessionEs; + } + } else { + if (NULL != loc_eng_ni_data_p->session.rawRequest || + NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { + LOC_LOGW("loc_eng_ni_request_handler, supl NI in progress, new supl NI ignored, type: %d", + notif->ni_type); + if (NULL != passThrough) { + free((void*)passThrough); + } + } else { + pSession = &loc_eng_ni_data_p->session; } } - else { + + + if (pSession) { /* Save request */ - loc_eng_ni_data_p->rawRequest = (void*)passThrough; + pSession->rawRequest = (void*)passThrough; + pSession->reqID = ++loc_eng_ni_data_p->reqIDCounter; + pSession->adapter = loc_eng_data.adapter; /* Fill in notification */ - ((GpsNiNotification*)notif)->notification_id = loc_eng_ni_data_p->reqID; + ((GpsNiNotification*)notif)->notification_id = pSession->reqID; if (notif->notify_flags == GPS_NI_PRIVACY_OVERRIDE) { @@ -155,16 +172,16 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, /* For robustness, spawn a thread at this point to timeout to clear up the notification status, even though * the OEM layer in java does not do so. **/ - loc_eng_ni_data_p->respTimeLeft = 5 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME); - LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data_p->respTimeLeft); + pSession->respTimeLeft = 5 + (notif->timeout != 0 ? notif->timeout : LOC_NI_NO_RESPONSE_TIME); + LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", pSession->respTimeLeft); int rc = 0; - rc = pthread_create(&loc_eng_ni_data_p->thread, NULL, ni_thread_proc, &loc_eng_data); + rc = pthread_create(&pSession->thread, NULL, ni_thread_proc, pSession); if (rc) { LOC_LOGE("Loc NI thread is not created.\n"); } - rc = pthread_detach(loc_eng_ni_data_p->thread); + rc = pthread_detach(pSession->thread); if (rc) { LOC_LOGE("Loc NI thread is not detached.\n"); @@ -185,61 +202,63 @@ static void* ni_thread_proc(void *args) { ENTRY_LOG(); - loc_eng_data_s_type* loc_eng_data_p = (loc_eng_data_s_type*)args; - loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data_p->loc_eng_ni_data; + loc_eng_ni_session_s_type* pSession = (loc_eng_ni_session_s_type*)args; int rc = 0; /* return code from pthread calls */ struct timeval present_time; struct timespec expire_time; LOC_LOGD("Starting Loc NI thread...\n"); - pthread_mutex_lock(&loc_eng_ni_data_p->tLock); + pthread_mutex_lock(&pSession->tLock); /* Calculate absolute expire time */ gettimeofday(&present_time, NULL); - expire_time.tv_sec = present_time.tv_sec + loc_eng_ni_data_p->respTimeLeft; + expire_time.tv_sec = present_time.tv_sec + pSession->respTimeLeft; expire_time.tv_nsec = present_time.tv_usec * 1000; LOC_LOGD("ni_thread_proc-Time out set for abs time %ld with delay %d sec\n", - (long) expire_time.tv_sec, loc_eng_ni_data_p->respTimeLeft ); + (long) expire_time.tv_sec, pSession->respTimeLeft ); - while (!loc_eng_ni_data_p->respRecvd) + while (!pSession->respRecvd) { - rc = pthread_cond_timedwait(&loc_eng_ni_data_p->tCond, - &loc_eng_ni_data_p->tLock, + rc = pthread_cond_timedwait(&pSession->tCond, + &pSession->tLock, &expire_time); if (rc == ETIMEDOUT) { - loc_eng_ni_data_p->resp = GPS_NI_RESPONSE_NORESP; + pSession->resp = GPS_NI_RESPONSE_NORESP; LOC_LOGD("ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc ); break; } } LOC_LOGD("ni_thread_proc-Java layer has sent us a user response and return value from " "pthread_cond_timedwait = %d\n",rc ); - loc_eng_ni_data_p->respRecvd = FALSE; /* Reset the user response flag for the next session*/ + pSession->respRecvd = FALSE; /* Reset the user response flag for the next session*/ + + LOC_LOGD("pSession->resp is %d\n",pSession->resp); LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() - LocEngAdapter* adapter = loc_eng_data_p->adapter; + LocEngAdapter* adapter = pSession->adapter; LocEngInformNiResponse *msg = NULL; - if (NULL != loc_eng_ni_data_p->rawRequest) { - if (loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE) { - LOC_LOGD("loc_eng_ni_data_p->resp != GPS_NI_RESPONSE_IGNORE \n"); + if (NULL != pSession->rawRequest) { + if (pSession->resp != GPS_NI_RESPONSE_IGNORE) { + LOC_LOGD("pSession->resp != GPS_NI_RESPONSE_IGNORE \n"); msg = new LocEngInformNiResponse(adapter, - loc_eng_ni_data_p->resp, - loc_eng_ni_data_p->rawRequest); + pSession->resp, + pSession->rawRequest); } else { LOC_LOGD("this is the ignore reply for SUPL ES\n"); + free(pSession->rawRequest); } - loc_eng_ni_data_p->rawRequest = NULL; + pSession->rawRequest = NULL; } - pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); + pthread_mutex_unlock(&pSession->tLock); - loc_eng_ni_data_p->respTimeLeft = 0; - loc_eng_ni_data_p->reqID++; + pSession->respTimeLeft = 0; + pSession->reqID = 0; if (NULL != msg) { LOC_LOGD("ni_thread_proc: adapter->sendMsg(msg)\n"); @@ -261,16 +280,28 @@ void loc_eng_ni_reset_on_engine_restart(loc_eng_data_s_type &loc_eng_data) } // only if modem has requested but then died. - if (NULL != loc_eng_ni_data_p->rawRequest) { - free(loc_eng_ni_data_p->rawRequest); - loc_eng_ni_data_p->rawRequest = NULL; + if (NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { + free(loc_eng_ni_data_p->sessionEs.rawRequest); + loc_eng_ni_data_p->sessionEs.rawRequest = NULL; - pthread_mutex_lock(&loc_eng_ni_data_p->tLock); + pthread_mutex_lock(&loc_eng_ni_data_p->sessionEs.tLock); // the goal is to wake up ni_thread_proc // and let it exit. - loc_eng_ni_data_p->respRecvd = TRUE; - pthread_cond_signal(&loc_eng_ni_data_p->tCond); - pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); + loc_eng_ni_data_p->sessionEs.respRecvd = TRUE; + pthread_cond_signal(&loc_eng_ni_data_p->sessionEs.tCond); + pthread_mutex_unlock(&loc_eng_ni_data_p->sessionEs.tLock); + } + + if (NULL != loc_eng_ni_data_p->session.rawRequest) { + free(loc_eng_ni_data_p->session.rawRequest); + loc_eng_ni_data_p->session.rawRequest = NULL; + + pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock); + // the goal is to wake up ni_thread_proc + // and let it exit. + loc_eng_ni_data_p->session.respRecvd = TRUE; + pthread_cond_signal(&loc_eng_ni_data_p->session.tCond); + pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock); } EXIT_LOG(%s, VOID_RET); @@ -304,12 +335,19 @@ void loc_eng_ni_init(loc_eng_data_s_type &loc_eng_data, GpsNiExtCallbacks *callb EXIT_LOG(%s, "loc_eng_ni_init: already inited."); } else { loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data; - loc_eng_ni_data_p->respTimeLeft = 0; - loc_eng_ni_data_p->respRecvd = FALSE; - loc_eng_ni_data_p->rawRequest = NULL; - loc_eng_ni_data_p->reqID = 0; - pthread_cond_init(&loc_eng_ni_data_p->tCond, NULL); - pthread_mutex_init(&loc_eng_ni_data_p->tLock, NULL); + loc_eng_ni_data_p->sessionEs.respTimeLeft = 0; + loc_eng_ni_data_p->sessionEs.respRecvd = FALSE; + loc_eng_ni_data_p->sessionEs.rawRequest = NULL; + loc_eng_ni_data_p->sessionEs.reqID = 0; + pthread_cond_init(&loc_eng_ni_data_p->sessionEs.tCond, NULL); + pthread_mutex_init(&loc_eng_ni_data_p->sessionEs.tLock, NULL); + + loc_eng_ni_data_p->session.respTimeLeft = 0; + loc_eng_ni_data_p->session.respRecvd = FALSE; + loc_eng_ni_data_p->session.rawRequest = NULL; + loc_eng_ni_data_p->session.reqID = 0; + pthread_cond_init(&loc_eng_ni_data_p->session.tCond, NULL); + pthread_mutex_init(&loc_eng_ni_data_p->session.tLock, NULL); loc_eng_data.ni_notify_cb = callbacks->notify_cb; EXIT_LOG(%s, VOID_RET); @@ -337,25 +375,40 @@ void loc_eng_ni_respond(loc_eng_data_s_type &loc_eng_data, { ENTRY_LOG_CALLFLOW(); loc_eng_ni_data_s_type* loc_eng_ni_data_p = &loc_eng_data.loc_eng_ni_data; + loc_eng_ni_session_s_type* pSession = NULL; if (NULL == loc_eng_data.ni_notify_cb) { EXIT_LOG(%s, "loc_eng_ni_init hasn't happened yet."); return; } - if (notif_id == loc_eng_ni_data_p->reqID && - NULL != loc_eng_ni_data_p->rawRequest) - { + if (notif_id == loc_eng_ni_data_p->sessionEs.reqID && + NULL != loc_eng_ni_data_p->sessionEs.rawRequest) { + pSession = &loc_eng_ni_data_p->sessionEs; + // ignore any SUPL NI non-Es session if a SUPL NI ES is accepted + if (user_response == GPS_NI_RESPONSE_ACCEPT && + NULL != loc_eng_ni_data_p->session.rawRequest) { + pthread_mutex_lock(&loc_eng_ni_data_p->session.tLock); + loc_eng_ni_data_p->session.resp = GPS_NI_RESPONSE_IGNORE; + loc_eng_ni_data_p->session.respRecvd = TRUE; + pthread_cond_signal(&loc_eng_ni_data_p->session.tCond); + pthread_mutex_unlock(&loc_eng_ni_data_p->session.tLock); + } + } else if (notif_id == loc_eng_ni_data_p->session.reqID && + NULL != loc_eng_ni_data_p->session.rawRequest) { + pSession = &loc_eng_ni_data_p->session; + } + + if (pSession) { LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id); - pthread_mutex_lock(&loc_eng_ni_data_p->tLock); - loc_eng_ni_data_p->resp = user_response; - loc_eng_ni_data_p->respRecvd = TRUE; - pthread_cond_signal(&loc_eng_ni_data_p->tCond); - pthread_mutex_unlock(&loc_eng_ni_data_p->tLock); + pthread_mutex_lock(&pSession->tLock); + pSession->resp = user_response; + pSession->respRecvd = TRUE; + pthread_cond_signal(&pSession->tCond); + pthread_mutex_unlock(&pSession->tLock); } else { - LOC_LOGE("loc_eng_ni_respond: reqID %d and notif_id %d mismatch or rawRequest %p, response: %d", - loc_eng_ni_data_p->reqID, notif_id, loc_eng_ni_data_p->rawRequest, user_response); + LOC_LOGE("loc_eng_ni_respond: notif_id %d not an active session", notif_id); } EXIT_LOG(%s, VOID_RET); diff --git a/loc_api/libloc_api_50001/loc_eng_ni.h b/loc_api/libloc_api_50001/loc_eng_ni.h index 8c076041..068f5cdd 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.h +++ b/loc_api/libloc_api_50001/loc_eng_ni.h @@ -31,6 +31,7 @@ #define LOC_ENG_NI_H #include +#include #define LOC_NI_NO_RESPONSE_TIME 20 /* secs */ #define LOC_NI_NOTIF_KEY_ADDRESS "Address" @@ -45,6 +46,13 @@ typedef struct { GpsUserResponseType resp; pthread_cond_t tCond; pthread_mutex_t tLock; + LocEngAdapter* adapter; +} loc_eng_ni_session_s_type; + +typedef struct { + loc_eng_ni_session_s_type session; /* SUPL NI Session */ + loc_eng_ni_session_s_type sessionEs; /* Emergency SUPL NI Session */ + int reqIDCounter; } loc_eng_ni_data_s_type; diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 6c9356e4..2a23db32 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/loc_api/libloc_api_50001/loc_eng_nmea.cpp @@ -119,13 +119,17 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, unsigned char generate_nmea) { ENTRY_LOG(); + time_t utcTime(location.gpsLocation.timestamp/1000); + tm * pTm = gmtime(&utcTime); + if (NULL == pTm) { + LOC_LOGE("gmtime failed"); + return; + } char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0}; char* pMarker = sentence; int lengthRemaining = sizeof(sentence); int length = 0; - time_t utcTime(location.gpsLocation.timestamp/1000); - tm * pTm = gmtime(&utcTime); int utcYear = pTm->tm_year % 100; // 2 digit year int utcMonth = pTm->tm_mon + 1; // tm_mon starts at zero int utcDay = pTm->tm_mday; @@ -601,7 +605,7 @@ SIDE EFFECTS ===========================================================================*/ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, - const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended) + const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended) { ENTRY_LOG(); @@ -787,46 +791,24 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, }//if - if (svStatus.used_in_fix_mask == 0) - { // No sv used, so there will be no position report, so send - // blank NMEA sentences - strlcpy(sentence, "$GPGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); + // cache the used in fix mask, as it will be needed to send $GPGSA + // during the position report + loc_eng_data_p->sv_used_mask = svStatus.gps_used_in_fix_mask; - strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); - - strlcpy(sentence, "$GPRMC,,V,,,,,,,,,,N", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); - - strlcpy(sentence, "$GPGGA,,,,,,0,,,,,,,,", sizeof(sentence)); - length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); - loc_eng_nmea_send(sentence, length, loc_eng_data_p); + // For RPC, the DOP are sent during sv report, so cache them + // now to be sent during position report. + // For QMI, the DOP will be in position report. + if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) + { + loc_eng_data_p->pdop = locationExtended.pdop; + loc_eng_data_p->hdop = locationExtended.hdop; + loc_eng_data_p->vdop = locationExtended.vdop; } else - { // cache the used in fix mask, as it will be needed to send $GPGSA - // during the position report - loc_eng_data_p->sv_used_mask = svStatus.used_in_fix_mask; - - // For RPC, the DOP are sent during sv report, so cache them - // now to be sent during position report. - // For QMI, the DOP will be in position report. - if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) - { - loc_eng_data_p->pdop = locationExtended.pdop; - loc_eng_data_p->hdop = locationExtended.hdop; - loc_eng_data_p->vdop = locationExtended.vdop; - } - else - { - loc_eng_data_p->pdop = 0; - loc_eng_data_p->hdop = 0; - loc_eng_data_p->vdop = 0; - } - + { + loc_eng_data_p->pdop = 0; + loc_eng_data_p->hdop = 0; + loc_eng_data_p->vdop = 0; } EXIT_LOG(%d, 0); diff --git a/loc_api/libloc_api_50001/loc_eng_nmea.h b/loc_api/libloc_api_50001/loc_eng_nmea.h index 40c6dbbd..066943aa 100644 --- a/loc_api/libloc_api_50001/loc_eng_nmea.h +++ b/loc_api/libloc_api_50001/loc_eng_nmea.h @@ -31,12 +31,13 @@ #define LOC_ENG_NMEA_H #include +#include #define NMEA_SENTENCE_MAX_LENGTH 200 void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_data_p); int loc_eng_nmea_put_checksum(char *pNmea, int maxSize); -void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GpsSvStatus &svStatus, const GpsLocationExtended &locationExtended); +void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, const GnssSvStatus &svStatus, const GpsLocationExtended &locationExtended); void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, const UlpLocation &location, const GpsLocationExtended &locationExtended, unsigned char generate_nmea); #endif // LOC_ENG_NMEA_H diff --git a/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/loc_api/libloc_api_50001/loc_eng_xtra.cpp index 1459c4c7..9207564b 100644 --- a/loc_api/libloc_api_50001/loc_eng_xtra.cpp +++ b/loc_api/libloc_api_50001/loc_eng_xtra.cpp @@ -81,6 +81,25 @@ struct LocEngInjectXtraData : public LocMsg { } }; +struct LocEngSetXtraVersionCheck : public LocMsg { + LocEngAdapter *mAdapter; + int mCheck; + inline LocEngSetXtraVersionCheck(LocEngAdapter* adapter, + int check): + mAdapter(adapter), mCheck(check) {} + inline virtual void proc() const { + locallog(); + mAdapter->setXtraVersionCheck(mCheck); + } + inline void locallog() const { + LOC_LOGD("%s:%d]: mCheck: %d", + __func__, __LINE__, mCheck); + } + inline virtual void log() const { + locallog(); + } +}; + /*=========================================================================== FUNCTION loc_eng_xtra_init @@ -102,6 +121,7 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, { int ret_val = -1; loc_eng_xtra_data_s_type *xtra_module_data_ptr; + ENTRY_LOG(); if(callbacks == NULL) { LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL"); @@ -112,6 +132,7 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, ret_val = 0; } + EXIT_LOG(%d, ret_val); return ret_val; } @@ -125,8 +146,7 @@ DEPENDENCIES N/A RETURN VALUE - 0: success - >0: failure + 0 SIDE EFFECTS N/A @@ -135,9 +155,10 @@ SIDE EFFECTS int loc_eng_xtra_inject_data(loc_eng_data_s_type &loc_eng_data, char* data, int length) { + ENTRY_LOG(); LocEngAdapter* adapter = loc_eng_data.adapter; adapter->sendMsg(new LocEngInjectXtraData(adapter, data, length)); - + EXIT_LOG(%d, 0); return 0; } /*=========================================================================== @@ -150,7 +171,7 @@ DEPENDENCIES N/A RETURN VALUE - length of server string + 0 SIDE EFFECTS N/A @@ -158,9 +179,34 @@ SIDE EFFECTS ===========================================================================*/ int loc_eng_xtra_request_server(loc_eng_data_s_type &loc_eng_data) { + ENTRY_LOG(); LocEngAdapter* adapter = loc_eng_data.adapter; adapter->sendMsg(new LocEngRequestXtraServer(adapter)); - + EXIT_LOG(%d, 0); return 0; - +} +/*=========================================================================== +FUNCTION loc_eng_xtra_version_check + +DESCRIPTION + Injects the enable/disable value for checking XTRA version + that is specified in gps.conf + +DEPENDENCIES + N/A + +RETURN VALUE + none + +SIDE EFFECTS + N/A + +===========================================================================*/ +void loc_eng_xtra_version_check(loc_eng_data_s_type &loc_eng_data, + int check) +{ + ENTRY_LOG(); + LocEngAdapter *adapter = loc_eng_data.adapter; + adapter->sendMsg(new LocEngSetXtraVersionCheck(adapter, check)); + EXIT_LOG(%d, 0); } diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h index f78303c9..205c9fff 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -82,6 +82,8 @@ extern const char FROM_MODEM[]; extern const char TO_AFW[]; extern const char EXIT_TAG[]; extern const char ENTRY_TAG[]; +extern const char EXIT_ERROR_TAG[]; + /*============================================================================= * * MODULE EXPORTED FUNCTIONS @@ -97,37 +99,47 @@ char* get_timestamp(char* str, unsigned long buf_size); if that value remains unchanged, it means gps.conf did not provide a value and we default to the initial value to use Android's logging levels*/ +#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) + #define LOC_LOGE(...) \ -if ((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("W/"__VA_ARGS__); } +IF_LOC_LOGE { ALOGE("E/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/" __VA_ARGS__); } #define LOC_LOGW(...) \ -if ((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("W/"__VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/"__VA_ARGS__); } +IF_LOC_LOGW { ALOGE("W/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); } #define LOC_LOGI(...) \ -if ((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("I/"__VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/"__VA_ARGS__); } +IF_LOC_LOGI { ALOGE("I/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); } #define LOC_LOGD(...) \ -if ((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("D/"__VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/"__VA_ARGS__); } +IF_LOC_LOGD { ALOGE("D/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); } #define LOC_LOGV(...) \ -if ((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) { ALOGE("V/"__VA_ARGS__); } \ -else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); } +IF_LOC_LOGV { ALOGE("V/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } #else /* DEBUG_DMN_LOC_API */ -#define LOC_LOGE(...) ALOGE("E/"__VA_ARGS__) +#define LOC_LOGE(...) ALOGE("E/" __VA_ARGS__) -#define LOC_LOGW(...) ALOGW("W/"__VA_ARGS__) +#define LOC_LOGW(...) ALOGW("W/" __VA_ARGS__) -#define LOC_LOGI(...) ALOGI("I/"__VA_ARGS__) +#define LOC_LOGI(...) ALOGI("I/" __VA_ARGS__) -#define LOC_LOGD(...) ALOGD("D/"__VA_ARGS__) +#define LOC_LOGD(...) ALOGD("D/" __VA_ARGS__) -#define LOC_LOGV(...) ALOGV("V/"__VA_ARGS__) +#define LOC_LOGV(...) ALOGV("V/" __VA_ARGS__) #endif /* DEBUG_DMN_LOC_API */ @@ -148,12 +160,18 @@ else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/"__VA_ARGS__); } } \ } while(0) - #define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL) #define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL) +#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL) #define ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "") #define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL) +#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \ + if (VAL != 0) { \ + LOG_E(EXIT_ERROR_TAG, __func__, SPEC, VAL); \ + } else { \ + LOG_V(EXIT_TAG, __func__, SPEC, VAL); \ + } // Used for logging callflow from Android Framework diff --git a/utils/Android.mk b/utils/Android.mk index 24ab8a13..37512a58 100644 --- a/utils/Android.mk +++ b/utils/Android.mk @@ -18,19 +18,27 @@ LOCAL_SRC_FILES += \ msg_q.c \ linked_list.c \ loc_target.cpp \ - loc_timer.c \ - ../platform_lib_abstractions/elapsed_millis_since_boot.cpp - + platform_lib_abstractions/elapsed_millis_since_boot.cpp \ + LocHeap.cpp \ + LocTimer.cpp \ + LocThread.cpp \ + MsgTask.cpp \ + loc_misc_utils.cpp LOCAL_CFLAGS += \ -fno-short-enums \ - -D_ANDROID_ + -D_ANDROID_ \ + -std=c++11 + +ifeq ($(TARGET_BUILD_VARIANT),user) + LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER +endif LOCAL_LDFLAGS += -Wl,--export-dynamic ## Includes LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/../platform_lib_abstractions + $(LOCAL_PATH)/platform_lib_abstractions LOCAL_COPY_HEADERS_TO:= gps.utils/ LOCAL_COPY_HEADERS:= \ @@ -39,20 +47,25 @@ LOCAL_COPY_HEADERS:= \ log_util.h \ linked_list.h \ msg_q.h \ + MsgTask.h \ + LocHeap.h \ + LocThread.h \ + LocTimer.h \ loc_target.h \ loc_timer.h \ - ../platform_lib_abstractions/platform_lib_includes.h \ - ../platform_lib_abstractions/platform_lib_time.h \ - ../platform_lib_abstractions/platform_lib_macros.h - + LocSharedLock.h \ + platform_lib_abstractions/platform_lib_includes.h \ + platform_lib_abstractions/platform_lib_time.h \ + platform_lib_abstractions/platform_lib_macros.h \ + loc_misc_utils.h LOCAL_MODULE := libgps.utils +LOCAL_CLANG := false LOCAL_MODULE_TAGS := optional LOCAL_PRELINK_MODULE := false -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) include $(BUILD_SHARED_LIBRARY) endif # not BUILD_TINY_ANDROID endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE diff --git a/utils/LocHeap.cpp b/utils/LocHeap.cpp new file mode 100644 index 00000000..d667f14f --- /dev/null +++ b/utils/LocHeap.cpp @@ -0,0 +1,354 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include + +class LocHeapNode { + friend class LocHeap; + + // size of of the subtree, excluding self, 1 if no subtree + int mSize; + LocHeapNode* mLeft; + LocHeapNode* mRight; + LocRankable* mData; +public: + inline LocHeapNode(LocRankable& data) : + mSize(1), mLeft(NULL), mRight(NULL), mData(&data) {} + ~LocHeapNode(); + + // this only swaps the data of the two nodes, so no + // detach / re-attached is necessary + void swap(LocHeapNode& node); + + LocRankable* detachData(); + + // push a node into the tree stucture, keeping sorted by rank + void push(LocHeapNode& node); + + // pop the head node out of the tree stucture. keeping sorted by rank + static LocHeapNode* pop(LocHeapNode*& top); + + // remove a specific node from the tree + // returns the pointer to the node removed, which would be either the + // same as input (if successfully removed); or NULL (if failed). + static LocHeapNode* remove(LocHeapNode*& top, LocRankable& data); + + // convenience method to compare data ranking + inline bool outRanks(LocHeapNode& node) { return mData->outRanks(*node.mData); } + inline bool outRanks(LocRankable& data) { return mData->outRanks(data); } + + // checks if mSize is correct, AND this node is the highest ranking + // of the entire subtree + bool checkNodes(); + + inline int getSize() { return mSize; } +}; + +inline +LocHeapNode::~LocHeapNode() { + if (mLeft) { + delete mLeft; + mLeft = NULL; + } + if (mRight) { + delete mRight; + mRight = NULL; + } + if (mData) { + mData = NULL; + } +} + +inline +void LocHeapNode::swap(LocHeapNode& node) { + LocRankable* tmpData = node.mData; + node.mData = mData; + mData = tmpData; +} + +inline +LocRankable* LocHeapNode::detachData() { + LocRankable* data = mData; + mData = NULL; + return data; +} + +// push keeps the tree sorted by rank, it also tries to balance the +// tree by adding the new node to the smaller of the subtrees. +// The pointer to the tree and internal links never change. If the +// mData of tree top ranks lower than that of the incoming node, +// mData will be swapped with that of the incoming node to ensure +// ranking, no restructuring the container nodes. +void LocHeapNode::push(LocHeapNode& node) { + // ensure the current node ranks higher than in the incoming one + if (node.outRanks(*this)) { + swap(node); + } + + // now drop the new node (ensured lower than *this) into a subtree + if (NULL == mLeft) { + mLeft = &node; + } else if (NULL == mRight) { + mRight = &node; + } else if (mLeft->mSize <= mRight->mSize) { + mLeft->push(node); + } else { + mRight->push(node); + } + mSize++; +} + +// pop keeps the tree sorted by rank, but it does not try to balance +// the tree. It recursively swaps with the higher ranked top of the +// subtrees. +// The return is a popped out node from leaf level, that has the data +// swapped all the way down from the top. The pinter to the tree and +// internal links will not be changed or restructured, except for the +// node that is popped out. +// If the return pointer == this, this the last node in the tree. +LocHeapNode* LocHeapNode::pop(LocHeapNode*& top) { + // we know the top has the highest ranking at this point, else + // the tree is broken. This top will be popped out. But we need + // a node from the left or right child, whichever ranks higher, + // to replace the current top. This then will need to be done + // recursively to the leaf level. So we swap the mData of the + // current top node all the way down to the leaf level. + LocHeapNode* poppedNode = top; + // top is losing a node in its subtree + top->mSize--; + if (top->mLeft || top->mRight) { + // if mLeft is NULL, mRight for sure is NOT NULL, take that; + // else if mRight is NULL, mLeft for sure is NOT, take that; + // else we take the address of whatever has higher ranking mData + LocHeapNode*& subTop = (NULL == top->mLeft) ? top->mRight : + ((NULL == top->mRight) ? top->mLeft : + (top->mLeft->outRanks(*(top->mRight)) ? top->mLeft : top->mRight)); + // swap mData, the tree top gets updated with the new data. + top->swap(*subTop); + // pop out from the subtree + poppedNode = pop(subTop); + } else { + // if the top has only single node + // detach the poppedNode from the tree + // subTop is the reference of ether mLeft or mRight + // NOT a local stack pointer. so it MUST be NULL'ed here. + top = NULL; + } + + return poppedNode; +} + +// navigating through the tree and find the node that hass the input +// data. Since this is a heap, we do recursive linear search. +// returns the pointer to the node removed, which would be either the +// same as input (if successfully removed); or NULL (if failed). +LocHeapNode* LocHeapNode::remove(LocHeapNode*& top, LocRankable& data) { + LocHeapNode* removedNode = NULL; + // this is the node, by address + if (&data == (LocRankable*)(top->mData)) { + // pop this node out + removedNode = pop(top); + } else if (!data.outRanks(*top->mData)) { + // subtrees might have this node + if (top->mLeft) { + removedNode = remove(top->mLeft, data); + } + // if we did not find in mLeft, and mRight is not empty + if (!removedNode && top->mRight) { + removedNode = remove(top->mRight, data); + } + + // top lost a node in its subtree + if (removedNode) { + top->mSize--; + } + } + + return removedNode; +} + +// checks if mSize is correct, AND this node is the highest ranking +// of the entire subtree +bool LocHeapNode::checkNodes() { + // size of the current subtree + int totalSize = mSize; + if (mLeft) { + // check the consistency of left subtree + if (mLeft->outRanks(*this) || !mLeft->checkNodes()) { + return false; + } + // subtract the size of left subtree (with subtree head) + totalSize -= mLeft->mSize; + } + + if (mRight) { + // check the consistency of right subtree + if (mRight->outRanks(*this) || !mRight->checkNodes()) { + return false; + } + // subtract the size of right subtree (with subtree head) + totalSize -= mRight->mSize; + } + + // for the tree nodes to consistent, totalSize must be 1 now + return totalSize == 1; +} + +LocHeap::~LocHeap() { + if (mTree) { + delete mTree; + } +} + +void LocHeap::push(LocRankable& node) { + LocHeapNode* heapNode = new LocHeapNode(node); + if (!mTree) { + mTree = heapNode; + } else { + mTree->push(*heapNode); + } +} + +LocRankable* LocHeap::peek() { + LocRankable* top = NULL; + if (mTree) { + top = mTree->mData; + } + return top; +} + +LocRankable* LocHeap::pop() { + LocRankable* locNode = NULL; + if (mTree) { + // mTree may become NULL after this call + LocHeapNode* heapNode = LocHeapNode::pop(mTree); + locNode = heapNode->detachData(); + delete heapNode; + } + return locNode; +} + +LocRankable* LocHeap::remove(LocRankable& rankable) { + LocRankable* locNode = NULL; + if (mTree) { + // mTree may become NULL after this call + LocHeapNode* heapNode = LocHeapNode::remove(mTree, rankable); + if (heapNode) { + locNode = heapNode->detachData(); + delete heapNode; + } + } + return locNode; +} + +#ifdef __LOC_UNIT_TEST__ +bool LocHeap::checkTree() { + return ((NULL == mTree) || mTree->checkNodes()); +} +uint32_t LocHeap::getTreeSize() { + return (NULL == mTree) ? 0 : mTree->getSize(); +} +#endif + +#ifdef __LOC_DEBUG__ + +#include +#include +#include + +class LocHeapDebug : public LocHeap { +public: + bool checkTree() { + return ((NULL == mTree) || mTree->checkNodes()); + } + + uint32_t getTreeSize() { + return (NULL == mTree) ? 0 : (mTree->getSize()); + } +}; + +class LocHeapDebugData : public LocRankable { + const int mID; +public: + LocHeapDebugData(int id) : mID(id) {} + inline virtual int ranks(LocRankable& rankable) { + LocHeapDebugData* testData = dynamic_cast(&rankable); + return testData->mID - mID; + } +}; + +// For Linux command line testing: +// compilation: g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../vendor/qcom/proprietary/gps-internal/unit-tests/fakes_for_host -I../../../../system/core/include LocHeap.cpp +// test: valgrind --leak-check=full ./a.out 100 +int main(int argc, char** argv) { + srand(time(NULL)); + int tries = atoi(argv[1]); + int checks = tries >> 3; + LocHeapDebug heap; + int treeSize = 0; + + for (int i = 0; i < tries; i++) { + if (i % checks == 0 && !heap.checkTree()) { + printf("tree check failed before %dth op\n", i); + } + int r = rand(); + + if (r & 1) { + LocHeapDebugData* data = new LocHeapDebugData(r >> 1); + heap.push(dynamic_cast(*data)); + treeSize++; + } else { + LocRankable* rankable = heap.pop(); + if (rankable) { + delete rankable; + } + treeSize ? treeSize-- : 0; + } + + printf("%s: %d == %d\n", (r&1)?"push":"pop", treeSize, heap.getTreeSize()); + if (treeSize != heap.getTreeSize()) { + printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + tries = i+1; + break; + } + } + + if (!heap.checkTree()) { + printf("!!!!!!!!!!tree check failed at the end after %d ops!!!!!!!\n", tries); + } else { + printf("success!\n"); + } + + for (LocRankable* data = heap.pop(); NULL != data; data = heap.pop()) { + delete data; + } + + return 0; +} + +#endif diff --git a/utils/LocHeap.h b/utils/LocHeap.h new file mode 100644 index 00000000..b491948a --- /dev/null +++ b/utils/LocHeap.h @@ -0,0 +1,96 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __LOC_HEAP__ +#define __LOC_HEAP__ + +#include +#include + +// abstract class to be implemented by client to provide a rankable class +class LocRankable { +public: + virtual inline ~LocRankable() {} + + // method to rank objects of such type for sorting purposes. + // The pointer of the input node would be stored in the heap. + // >0 if ranks higher than the input; + // ==0 if equally ranks with the input; + // <0 if ranks lower than the input + virtual int ranks(LocRankable& rankable) = 0; + + // convenient method to rank objects of such type for sorting purposes. + inline bool outRanks(LocRankable& rankable) { return ranks(rankable) > 0; } +}; + +// opaque class to provide service implementation. +class LocHeapNode; + +// a heap whose left and right children are not sorted. It is sorted only vertically, +// i.e. parent always ranks higher than children, if they exist. Ranking algorithm is +// implemented in Rankable. The reason that there is no sort between children is to +// help beter balance the tree with lower cost. When a node is pushed to the tree, +// it is guaranteed that the subtree that is smaller gets to have the new node. +class LocHeap { +protected: + LocHeapNode* mTree; +public: + inline LocHeap() : mTree(NULL) {} + ~LocHeap(); + + // push keeps the tree sorted by rank, it also tries to balance the + // tree by adding the new node to the smaller of the subtrees. + // node is reference to an obj that is managed by client, that client + // creates and destroyes. The destroy should happen after the + // node is popped out from the heap. + void push(LocRankable& node); + + // Peeks the node data on tree top, which has currently the highest ranking + // There is no change the tree structure with this operation + // Returns NULL if the tree is empty, otherwise pointer to the node data of + // the tree top. + LocRankable* peek(); + + // pop keeps the tree sorted by rank, but it does not try to balance + // the tree. + // Return - pointer to the node popped out, or NULL if heap is already empty + LocRankable* pop(); + + // navigating through the tree and find the node that ranks the same + // as the input data, then remove it from the tree. Rank is implemented + // by rankable obj. + // returns the pointer to the node removed; or NULL (if failed). + LocRankable* remove(LocRankable& rankable); + +#ifdef __LOC_UNIT_TEST__ + bool checkTree(); + uint32_t getTreeSize(); +#endif +}; + +#endif //__LOC_HEAP__ diff --git a/utils/LocSharedLock.h b/utils/LocSharedLock.h new file mode 100644 index 00000000..7fe62376 --- /dev/null +++ b/utils/LocSharedLock.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __LOC_SHARED_LOCK__ +#define __LOC_SHARED_LOCK__ + +#include +#include +#include + +// This is a utility created for use cases such that there are more than +// one client who need to share the same lock, but it is not predictable +// which of these clients is to last to go away. This shared lock deletes +// itself when the last client calls its drop() method. To add a cient, +// this share lock's share() method has to be called, so that the obj +// can maintain an accurate client count. +class LocSharedLock { + volatile int32_t mRef; + pthread_mutex_t mMutex; + inline ~LocSharedLock() { pthread_mutex_destroy(&mMutex); } +public: + // first client to create this LockSharedLock + inline LocSharedLock() : mRef(1) { pthread_mutex_init(&mMutex, NULL); } + // following client(s) are to *share()* this lock created by the first client + inline LocSharedLock* share() { android_atomic_inc(&mRef); return this; } + // whe a client no longer needs this shared lock, drop() shall be called. + inline void drop() { if (1 == android_atomic_dec(&mRef)) delete this; } + // locking the lock to enter critical section + inline void lock() { pthread_mutex_lock(&mMutex); } + // unlocking the lock to leave the critical section + inline void unlock() { pthread_mutex_unlock(&mMutex); } +}; + +#endif //__LOC_SHARED_LOCK__ diff --git a/utils/LocThread.cpp b/utils/LocThread.cpp new file mode 100644 index 00000000..19bf101a --- /dev/null +++ b/utils/LocThread.cpp @@ -0,0 +1,264 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include + +class LocThreadDelegate { + LocRunnable* mRunnable; + bool mJoinable; + pthread_t mThandle; + pthread_mutex_t mMutex; + int mRefCount; + ~LocThreadDelegate(); + LocThreadDelegate(LocThread::tCreate creator, const char* threadName, + LocRunnable* runnable, bool joinable); + void destroy(); +public: + static LocThreadDelegate* create(LocThread::tCreate creator, + const char* threadName, LocRunnable* runnable, bool joinable); + void stop(); + // bye() is for the parent thread to go away. if joinable, + // parent must stop the spawned thread, join, and then + // destroy(); if detached, the parent can go straight + // ahead to destroy() + inline void bye() { mJoinable ? stop() : destroy(); } + inline bool isRunning() { return (NULL != mRunnable); } + static void* threadMain(void* arg); +}; + +// it is important to note that internal members must be +// initialized to values as if pthread_create succeeds. +// This is to avoid the race condition between the threads, +// once the thread is created, some of these values will +// be check in the spawned thread, and must set correctly +// then and there. +// However, upon pthread_create failure, the data members +// must be set to indicate failure, e.g. mRunnable, and +// threashold approprietly for destroy(), e.g. mRefCount. +LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator, + const char* threadName, LocRunnable* runnable, bool joinable) : + mRunnable(runnable), mJoinable(joinable), mThandle(NULL), + mMutex(PTHREAD_MUTEX_INITIALIZER), mRefCount(2) { + + // set up thread name, if nothing is passed in + if (!threadName) { + threadName = "LocThread"; + } + + // create the thread here, then if successful + // and a name is given, we set the thread name + if (creator) { + mThandle = creator(threadName, threadMain, this); + } else if (pthread_create(&mThandle, NULL, threadMain, this)) { + // pthread_create() failed + mThandle = NULL; + } + + if (mThandle) { + // set thread name + char lname[16]; + int len = sizeof(lname) - 1; + memcpy(lname, threadName, len); + lname[len] = 0; + // set the thread name here + pthread_setname_np(mThandle, lname); + + // detach, if not joinable + if (!joinable) { + pthread_detach(mThandle); + } + } else { + // must set these values upon failure + mRunnable = NULL; + mJoinable = false; + mRefCount = 1; + } +} + +inline +LocThreadDelegate::~LocThreadDelegate() { + // at this point nothing should need done any more +} + +// factory method so that we could return NULL upon failure +LocThreadDelegate* LocThreadDelegate::create(LocThread::tCreate creator, + const char* threadName, LocRunnable* runnable, bool joinable) { + LocThreadDelegate* thread = NULL; + if (runnable) { + thread = new LocThreadDelegate(creator, threadName, runnable, joinable); + if (thread && !thread->isRunning()) { + thread->destroy(); + thread = NULL; + } + } + + return thread; +} + +// The order is importang +// NULLing mRunnalbe stops the while loop in threadMain() +// join() if mJoinble must come before destroy() call, as +// the obj must remain alive at this time so that mThandle +// remains valud. +void LocThreadDelegate::stop() { + // mRunnable and mJoinable are reset on different triggers. + // mRunnable may get nulled on the spawned thread's way out; + // or here. + // mJouinable (if ever been true) gets falsed when client + // thread triggers stop, with either a stop() + // call or the client releases thread obj handle. + if (mRunnable) { + mRunnable = NULL; + } + if (mJoinable) { + mJoinable = false; + pthread_join(mThandle, NULL); + } + // call destroy() to possibly delete the obj + destroy(); +} + +// method for clients to call to release the obj +// when it is a detached thread, the client thread +// and the spawned thread can both try to destroy() +// asynchronously. And we delete this obj when +// mRefCount becomes 0. +void LocThreadDelegate::destroy() { + // else case shouldn't happen, unless there is a + // leaking obj. But only our code here has such + // obj, so if we test our code well, else case + // will never happen + if (mRefCount > 0) { + // we need a flag on the stack + bool callDelete = false; + + // critical section between threads + pthread_mutex_lock(&mMutex); + // last destroy() call + callDelete = (1 == mRefCount--); + pthread_mutex_unlock(&mMutex); + + // upon last destroy() call we delete this obj + if (callDelete) { + delete this; + } + } +} + +void* LocThreadDelegate::threadMain(void* arg) { + LocThreadDelegate* locThread = (LocThreadDelegate*)(arg); + + if (locThread) { + LocRunnable* runnable = locThread->mRunnable; + + if (runnable) { + if (locThread->isRunning()) { + runnable->prerun(); + } + + while (locThread->isRunning() && runnable->run()); + + if (locThread->isRunning()) { + runnable->postrun(); + } + + // at this time, locThread->mRunnable may or may not be NULL + // NULL it just to be safe and clean, as we want the field + // in the released memory slot to be NULL. + locThread->mRunnable = NULL; + delete runnable; + } + locThread->destroy(); + } + + return NULL; +} + +LocThread::~LocThread() { + if (mThread) { + mThread->bye(); + mThread = NULL; + } +} + +bool LocThread::start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable) { + bool success = false; + if (!mThread) { + mThread = LocThreadDelegate::create(creator, threadName, runnable, joinable); + // true only if thread is created successfully + success = (NULL != mThread); + } + return success; +} + +void LocThread::stop() { + if (mThread) { + mThread->stop(); + mThread = NULL; + } +} + +#ifdef __LOC_DEBUG__ + +#include +#include +#include + +class LocRunnableTest1 : public LocRunnable { + int mID; +public: + LocRunnableTest1(int id) : LocRunnable(), mID(id) {} + virtual bool run() { + printf("LocRunnableTest1: %d\n", mID++); + sleep(1); + return true; + } +}; + +// on linux command line: +// compile: g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -std=c++0x -I. -I../../../../vendor/qcom/proprietary/gps-internal/unit-tests/fakes_for_host -I../../../../system/core/include -lpthread LocThread.cpp +// test detached thread: valgrind ./a.out 0 +// test joinable thread: valgrind ./a.out 1 +int main(int argc, char** argv) { + LocRunnableTest1 test(10); + + LocThread thread; + thread.start("LocThreadTest", test, atoi(argv[1])); + + sleep(10); + + thread.stop(); + + sleep(5); + + return 0; +} + +#endif diff --git a/utils/LocThread.h b/utils/LocThread.h new file mode 100644 index 00000000..2a65d8fa --- /dev/null +++ b/utils/LocThread.h @@ -0,0 +1,92 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef __LOC_THREAD__ +#define __LOC_THREAD__ + +#include +#include + +// abstract class to be implemented by client to provide a runnable class +// which gets scheduled by LocThread +class LocRunnable { +public: + inline LocRunnable() {} + inline virtual ~LocRunnable() {} + + // The method to be implemented by thread clients + // and be scheduled by LocThread + // This method will be repeated called until it returns false; or + // until thread is stopped. + virtual bool run() = 0; + + // The method to be run before thread loop (conditionally repeatedly) + // calls run() + inline virtual void prerun() {} + + // The method to be run after thread loop (conditionally repeatedly) + // calls run() + inline virtual void postrun() {} +}; + +// opaque class to provide service implementation. +class LocThreadDelegate; + +// A utility class to create a thread and run LocRunnable +// caller passes in. +class LocThread { + LocThreadDelegate* mThread; +public: + inline LocThread() : mThread(NULL) {} + virtual ~LocThread(); + + typedef pthread_t (*tCreate)(const char* name, void* (*start)(void*), void* arg); + // client starts thread with a runnable, which implements + // the logics to fun in the created thread context. + // The thread could be either joinable or detached. + // runnable is an obj managed by client. Client creates and + // frees it (but must be after stop() is called, or + // this LocThread obj is deleted). + // The obj will be deleted by LocThread if start() + // returns true. Else it is client's responsibility + // to delete the object + // Returns 0 if success; false if failure. + bool start(tCreate creator, const char* threadName, LocRunnable* runnable, bool joinable = true); + inline bool start(const char* threadName, LocRunnable* runnable, bool joinable = true) { + return start(NULL, threadName, runnable, joinable); + } + + // NOTE: if this is a joinable thread, this stop may block + // for a while until the thread is joined. + void stop(); + + // thread status check + inline bool isRunning() { return NULL != mThread; } +}; + +#endif //__LOC_THREAD__ diff --git a/utils/LocTimer.cpp b/utils/LocTimer.cpp new file mode 100644 index 00000000..70904b2a --- /dev/null +++ b/utils/LocTimer.cpp @@ -0,0 +1,737 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __HOST_UNIT_TEST__ +#define EPOLLWAKEUP 0 +#define CLOCK_BOOTTIME CLOCK_MONOTONIC +#define CLOCK_BOOTTIME_ALARM CLOCK_MONOTONIC +#endif + +/* +There are implementations of 5 classes in this file: +LocTimer, LocTimerDelegate, LocTimerContainer, LocTimerPollTask, LocTimerWrapper + +LocTimer - client front end, interface for client to start / stop timers, also + to provide a callback. +LocTimerDelegate - an internal timer entity, which also is a LocRankable obj. + Its life cycle is different than that of LocTimer. It gets + created when LocTimer::start() is called, and gets deleted + when it expires or clients calls the hosting LocTimer obj's + stop() method. When a LocTimerDelegate obj is ticking, it + stays in the corresponding LocTimerContainer. When expired + or stopped, the obj is removed from the container. Since it + is also a LocRankable obj, and LocTimerContainer also is a + heap, its ranks() implementation decides where it is placed + in the heap. +LocTimerContainer - core of the timer service. It is a container (derived from + LocHeap) for LocTimerDelegate (implements LocRankable) objs. + There are 2 of such containers, one for sw timers (or Linux + timers) one for hw timers (or Linux alarms). It adds one of + each (those that expire the soonest) to kernel via services + provided by LocTimerPollTask. All the heap management on the + LocTimerDelegate objs are done in the MsgTask context, such + that synchronization is ensured. +LocTimerPollTask - is a class that wraps timerfd and epoll POXIS APIs. It also + both implements LocRunnalbe with epoll_wait() in the run() + method. It is also a LocThread client, so as to loop the run + method. +LocTimerWrapper - a LocTimer client itself, to implement the existing C API with + APIs, loc_timer_start() and loc_timer_stop(). + +*/ + +class LocTimerPollTask; + +// This is a multi-functaional class that: +// * extends the LocHeap class for the detection of head update upon add / remove +// events. When that happens, soonest time out changes, so timerfd needs update. +// * contains the timers, and add / remove them into the heap +// * provides and maps 2 of such containers, one for timers (or mSwTimers), one +// for alarms (or mHwTimers); +// * provides a polling thread; +// * provides a MsgTask thread for synchronized add / remove / timer client callback. +class LocTimerContainer : public LocHeap { + // mutex to synchronize getters of static members + static pthread_mutex_t mMutex; + // Container of timers + static LocTimerContainer* mSwTimers; + // Container of alarms + static LocTimerContainer* mHwTimers; + // Msg task to provider msg Q, sender and reader. + static MsgTask* mMsgTask; + // Poll task to provide epoll call and threading to poll. + static LocTimerPollTask* mPollTask; + // timer / alarm fd + int mDevFd; + // ctor + LocTimerContainer(bool wakeOnExpire); + // dtor + ~LocTimerContainer(); + static MsgTask* getMsgTaskLocked(); + static LocTimerPollTask* getPollTaskLocked(); + // extend LocHeap and pop if the top outRanks input + LocTimerDelegate* popIfOutRanks(LocTimerDelegate& timer); + // update the timer POSIX calls with updated soonest timer spec + void updateSoonestTime(LocTimerDelegate* priorTop); + +public: + // factory method to control the creation of mSwTimers / mHwTimers + static LocTimerContainer* get(bool wakeOnExpire); + + LocTimerDelegate* getSoonestTimer(); + int getTimerFd(); + // add a timer / alarm obj into the container + void add(LocTimerDelegate& timer); + // remove a timer / alarm obj from the container + void remove(LocTimerDelegate& timer); + // handling of timer / alarm expiration + void expire(); +}; + +// This class implements the polling thread that epolls imer / alarm fds. +// The LocRunnable::run() contains the actual polling. The other methods +// will be run in the caller's thread context to add / remove timer / alarm +// fds the kernel, while the polling is blocked on epoll_wait() call. +// Since the design is that we have maximally 2 polls, one for all the +// timers; one for all the alarms, we will poll at most on 2 fds. But it +// is possile that all we have are only timers or alarms at one time, so we +// allow dynamically add / remove fds we poll on. The design decision of +// having 1 fd per container of timer / alarm is such that, we may not need +// to make a system call each time a timer / alarm is added / removed, unless +// that changes the "soonest" time out of that of all the timers / alarms. +class LocTimerPollTask : public LocRunnable { + // the epoll fd + const int mFd; + // the thread that calls run() method + LocThread* mThread; + friend class LocThreadDelegate; + // dtor + ~LocTimerPollTask(); +public: + // ctor + LocTimerPollTask(); + // this obj will be deleted once thread is deleted + void destroy(); + // add a container of timers. Each contain has a unique device fd, i.e. + // either timer or alarm fd, and a heap of timers / alarms. It is expected + // that container would have written to the device fd with the soonest + // time out value in the heap at the time of calling this method. So all + // this method does is to add the fd of the input container to the poll + // and also add the pointer of the container to the event data ptr, such + // when poll_wait wakes up on events, we know who is the owner of the fd. + void addPoll(LocTimerContainer& timerContainer); + // remove a fd that is assciated with a container. The expectation is that + // the atual timer would have been removed from the container. + void removePoll(LocTimerContainer& timerContainer); + // The polling thread context will call this method. This is where + // epoll_wait() is blocking and waiting for events.. + virtual bool run(); +}; + +// Internal class of timer obj. It gets born when client calls LocTimer::start(); +// and gets deleted when client calls LocTimer::stop() or when the it expire()'s. +// This class implements LocRankable::ranks() so that when an obj is added into +// the container (of LocHeap), it gets placed in sorted order. +class LocTimerDelegate : public LocRankable { + friend class LocTimerContainer; + friend class LocTimer; + LocTimer* mClient; + LocSharedLock* mLock; + struct timespec mFutureTime; + LocTimerContainer* mContainer; + // not a complete obj, just ctor for LocRankable comparisons + inline LocTimerDelegate(struct timespec& delay) + : mClient(NULL), mLock(NULL), mFutureTime(delay), mContainer(NULL) {} + inline ~LocTimerDelegate() { if (mLock) { mLock->drop(); mLock = NULL; } } +public: + LocTimerDelegate(LocTimer& client, struct timespec& futureTime, bool wakeOnExpire); + void destroyLocked(); + // LocRankable virtual method + virtual int ranks(LocRankable& rankable); + void expire(); + inline struct timespec getFutureTime() { return mFutureTime; } +}; + +/***************************LocTimerContainer methods***************************/ + +// Most of these static recources are created on demand. They however are never +// destoyed. The theory is that there are processes that link to this util lib +// but never use timer, then these resources would never need to be created. +// For those processes that do use timer, it will likely also need to every +// once in a while. It might be cheaper keeping them around. +pthread_mutex_t LocTimerContainer::mMutex = PTHREAD_MUTEX_INITIALIZER; +LocTimerContainer* LocTimerContainer::mSwTimers = NULL; +LocTimerContainer* LocTimerContainer::mHwTimers = NULL; +MsgTask* LocTimerContainer::mMsgTask = NULL; +LocTimerPollTask* LocTimerContainer::mPollTask = NULL; + +// ctor - initialize timer heaps +// A container for swTimer (timer) is created, when wakeOnExpire is true; or +// HwTimer (alarm), when wakeOnExpire is false. +LocTimerContainer::LocTimerContainer(bool wakeOnExpire) : + mDevFd(timerfd_create(wakeOnExpire ? CLOCK_BOOTTIME_ALARM : CLOCK_BOOTTIME, 0)) { + + if ((-1 == mDevFd) && (errno == EINVAL)) { + LOC_LOGW("%s: timerfd_create failure, fallback to CLOCK_MONOTONIC - %s", + __FUNCTION__, strerror(errno)); + mDevFd = timerfd_create(CLOCK_MONOTONIC, 0); + } + + if (-1 != mDevFd) { + // ensure we have the necessary resources created + LocTimerContainer::getPollTaskLocked(); + LocTimerContainer::getMsgTaskLocked(); + } else { + LOC_LOGE("%s: timerfd_create failure - %s", __FUNCTION__, strerror(errno)); + } +} + +// dtor +// we do not ever destroy the static resources. +inline +LocTimerContainer::~LocTimerContainer() { + close(mDevFd); +} + +LocTimerContainer* LocTimerContainer::get(bool wakeOnExpire) { + // get the reference of either mHwTimer or mSwTimers per wakeOnExpire + LocTimerContainer*& container = wakeOnExpire ? mHwTimers : mSwTimers; + // it is cheap to check pointer first than locking mutext unconditionally + if (!container) { + pthread_mutex_lock(&mMutex); + // let's check one more time to be safe + if (!container) { + container = new LocTimerContainer(wakeOnExpire); + // timerfd_create failure + if (-1 == container->getTimerFd()) { + delete container; + container = NULL; + } + } + pthread_mutex_unlock(&mMutex); + } + return container; +} + +MsgTask* LocTimerContainer::getMsgTaskLocked() { + // it is cheap to check pointer first than locking mutext unconditionally + if (!mMsgTask) { + mMsgTask = new MsgTask("LocTimerMsgTask", false); + } + return mMsgTask; +} + +LocTimerPollTask* LocTimerContainer::getPollTaskLocked() { + // it is cheap to check pointer first than locking mutext unconditionally + if (!mPollTask) { + mPollTask = new LocTimerPollTask(); + } + return mPollTask; +} + +inline +LocTimerDelegate* LocTimerContainer::getSoonestTimer() { + return (LocTimerDelegate*)(peek()); +} + +inline +int LocTimerContainer::getTimerFd() { + return mDevFd; +} + +void LocTimerContainer::updateSoonestTime(LocTimerDelegate* priorTop) { + LocTimerDelegate* curTop = getSoonestTimer(); + + // check if top has changed + if (curTop != priorTop) { + struct itimerspec delay = {0}; + bool toSetTime = false; + // if tree is empty now, we remove poll and disarm timer + if (!curTop) { + mPollTask->removePoll(*this); + // setting the values to disarm timer + delay.it_value.tv_sec = 0; + delay.it_value.tv_nsec = 0; + toSetTime = true; + } else if (!priorTop || curTop->outRanks(*priorTop)) { + // do this first to avoid race condition, in case settime is called + // with too small an interval + mPollTask->addPoll(*this); + delay.it_value = curTop->getFutureTime(); + toSetTime = true; + } + if (toSetTime) { + timerfd_settime(getTimerFd(), TFD_TIMER_ABSTIME, &delay, NULL); + } + } +} + +// all the heap management is done in the MsgTask context. +inline +void LocTimerContainer::add(LocTimerDelegate& timer) { + struct MsgTimerPush : public LocMsg { + LocTimerContainer* mTimerContainer; + LocHeapNode* mTree; + LocTimerDelegate* mTimer; + inline MsgTimerPush(LocTimerContainer& container, LocTimerDelegate& timer) : + LocMsg(), mTimerContainer(&container), mTimer(&timer) {} + inline virtual void proc() const { + LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer(); + mTimerContainer->push((LocRankable&)(*mTimer)); + mTimerContainer->updateSoonestTime(priorTop); + } + }; + + mMsgTask->sendMsg(new MsgTimerPush(*this, timer)); +} + +// all the heap management is done in the MsgTask context. +void LocTimerContainer::remove(LocTimerDelegate& timer) { + struct MsgTimerRemove : public LocMsg { + LocTimerContainer* mTimerContainer; + LocTimerDelegate* mTimer; + inline MsgTimerRemove(LocTimerContainer& container, LocTimerDelegate& timer) : + LocMsg(), mTimerContainer(&container), mTimer(&timer) {} + inline virtual void proc() const { + LocTimerDelegate* priorTop = mTimerContainer->getSoonestTimer(); + + // update soonest timer only if mTimer is actually removed from + // mTimerContainer AND mTimer is not priorTop. + if (priorTop == ((LocHeap*)mTimerContainer)->remove((LocRankable&)*mTimer)) { + // if passing in NULL, we tell updateSoonestTime to update + // kernel with the current top timer interval. + mTimerContainer->updateSoonestTime(NULL); + } + // all timers are deleted here, and only here. + delete mTimer; + } + }; + + mMsgTask->sendMsg(new MsgTimerRemove(*this, timer)); +} + +// all the heap management is done in the MsgTask context. +// Upon expire, we check and continuously pop the heap until +// the top node's timeout is in the future. +void LocTimerContainer::expire() { + struct MsgTimerExpire : public LocMsg { + LocTimerContainer* mTimerContainer; + inline MsgTimerExpire(LocTimerContainer& container) : + LocMsg(), mTimerContainer(&container) {} + inline virtual void proc() const { + struct timespec now; + // get time spec of now + clock_gettime(CLOCK_BOOTTIME, &now); + LocTimerDelegate timerOfNow(now); + // pop everything in the heap that outRanks now, i.e. has time older than now + // and then call expire() on that timer. + for (LocTimerDelegate* timer = (LocTimerDelegate*)mTimerContainer->pop(); + NULL != timer; + timer = mTimerContainer->popIfOutRanks(timerOfNow)) { + // the timer delegate obj will be deleted before the return of this call + timer->expire(); + } + mTimerContainer->updateSoonestTime(NULL); + } + }; + + struct itimerspec delay = {0}; + timerfd_settime(getTimerFd(), TFD_TIMER_ABSTIME, &delay, NULL); + mPollTask->removePoll(*this); + mMsgTask->sendMsg(new MsgTimerExpire(*this)); +} + +LocTimerDelegate* LocTimerContainer::popIfOutRanks(LocTimerDelegate& timer) { + LocTimerDelegate* poppedNode = NULL; + if (mTree && !timer.outRanks(*peek())) { + poppedNode = (LocTimerDelegate*)(pop()); + } + + return poppedNode; +} + + +/***************************LocTimerPollTask methods***************************/ + +inline +LocTimerPollTask::LocTimerPollTask() + : mFd(epoll_create(2)), mThread(new LocThread()) { + // before a next call returens, a thread will be created. The run() method + // could already be running in parallel. Also, since each of the objs + // creates a thread, the container will make sure that there will be only + // one of such obj for our timer implementation. + if (!mThread->start("LocTimerPollTask", this)) { + delete mThread; + mThread = NULL; + } +} + +inline +LocTimerPollTask::~LocTimerPollTask() { + // when fs is closed, epoll_wait() should fail run() should return false + // and the spawned thread should exit. + close(mFd); +} + +void LocTimerPollTask::destroy() { + if (mThread) { + LocThread* thread = mThread; + mThread = NULL; + delete thread; + } else { + delete this; + } +} + +void LocTimerPollTask::addPoll(LocTimerContainer& timerContainer) { + struct epoll_event ev; + memset(&ev, 0, sizeof(ev)); + + ev.events = EPOLLIN | EPOLLWAKEUP; + ev.data.fd = timerContainer.getTimerFd(); + // it is important that we set this context pointer with the input + // timer container this is how we know which container should handle + // which expiration. + ev.data.ptr = &timerContainer; + + epoll_ctl(mFd, EPOLL_CTL_ADD, timerContainer.getTimerFd(), &ev); +} + +inline +void LocTimerPollTask::removePoll(LocTimerContainer& timerContainer) { + epoll_ctl(mFd, EPOLL_CTL_DEL, timerContainer.getTimerFd(), NULL); +} + +// The polling thread context will call this method. If run() method needs to +// be repetitvely called, it must return true from the previous call. +bool LocTimerPollTask::run() { + struct epoll_event ev[2]; + + // we have max 2 descriptors to poll from + int fds = epoll_wait(mFd, ev, 2, -1); + + // we pretty much want to continually poll until the fd is closed + bool rerun = (fds > 0) || (errno == EINTR); + + if (fds > 0) { + // we may have 2 events + for (int i = 0; i < fds; i++) { + // each fd has a context pointer associated with the right timer container + LocTimerContainer* container = (LocTimerContainer*)(ev[i].data.ptr); + if (container) { + container->expire(); + } else { + epoll_ctl(mFd, EPOLL_CTL_DEL, ev[i].data.fd, NULL); + } + } + } + + // if rerun is true, we are requesting to be scheduled again + return rerun; +} + +/***************************LocTimerDelegate methods***************************/ + +inline +LocTimerDelegate::LocTimerDelegate(LocTimer& client, struct timespec& futureTime, bool wakeOnExpire) + : mClient(&client), + mLock(mClient->mLock->share()), + mFutureTime(futureTime), + mContainer(LocTimerContainer::get(wakeOnExpire)) { + // adding the timer into the container + mContainer->add(*this); +} + +inline +void LocTimerDelegate::destroyLocked() { + // client handle will likely be deleted soon after this + // method returns. Nulling this handle so that expire() + // won't call the callback on the dead handle any more. + mClient = NULL; + + if (mContainer) { + LocTimerContainer* container = mContainer; + mContainer = NULL; + if (container) { + container->remove(*this); + } + } // else we do not do anything. No such *this* can be + // created and reached here with mContainer ever been + // a non NULL. So *this* must have reached the if clause + // once, and we want it reach there only once. +} + +int LocTimerDelegate::ranks(LocRankable& rankable) { + int rank = -1; + LocTimerDelegate* timer = (LocTimerDelegate*)(&rankable); + if (timer) { + // larger time ranks lower!!! + // IOW, if input obj has bigger tv_sec, this obj outRanks higher + rank = timer->mFutureTime.tv_sec - mFutureTime.tv_sec; + } + return rank; +} + +inline +void LocTimerDelegate::expire() { + // keeping a copy of client pointer to be safe + // when timeOutCallback() is called at the end of this + // method, *this* obj may be already deleted. + LocTimer* client = mClient; + // force a stop, which will lead to delete of this obj + if (client && client->stop()) { + // calling client callback with a pointer save on the stack + // only if stop() returns true, i.e. it hasn't been stopped + // already. + client->timeOutCallback(); + } +} + + +/***************************LocTimer methods***************************/ +LocTimer::LocTimer() : mTimer(NULL), mLock(new LocSharedLock()) { +} + +LocTimer::~LocTimer() { + stop(); + if (mLock) { + mLock->drop(); + mLock = NULL; + } +} + +bool LocTimer::start(unsigned int timeOutInMs, bool wakeOnExpire) { + bool success = false; + mLock->lock(); + if (!mTimer) { + struct timespec futureTime; + clock_gettime(CLOCK_BOOTTIME, &futureTime); + futureTime.tv_sec += timeOutInMs / 1000; + futureTime.tv_nsec += (timeOutInMs % 1000) * 1000000; + if (futureTime.tv_nsec >= 1000000000) { + futureTime.tv_sec += futureTime.tv_nsec / 1000000000; + futureTime.tv_nsec %= 1000000000; + } + mTimer = new LocTimerDelegate(*this, futureTime, wakeOnExpire); + // if mTimer is non 0, success should be 0; or vice versa + success = (NULL != mTimer); + } + mLock->unlock(); + return success; +} + +bool LocTimer::stop() { + bool success = false; + mLock->lock(); + if (mTimer) { + LocTimerDelegate* timer = mTimer; + mTimer = NULL; + if (timer) { + timer->destroyLocked(); + success = true; + } + } + mLock->unlock(); + return success; +} + +/***************************LocTimerWrapper methods***************************/ +////////////////////////////////////////////////////////////////////////// +// This section below wraps for the C style APIs +////////////////////////////////////////////////////////////////////////// +class LocTimerWrapper : public LocTimer { + loc_timer_callback mCb; + void* mCallerData; + LocTimerWrapper* mMe; + static pthread_mutex_t mMutex; + inline ~LocTimerWrapper() { mCb = NULL; mMe = NULL; } +public: + inline LocTimerWrapper(loc_timer_callback cb, void* callerData) : + mCb(cb), mCallerData(callerData), mMe(this) { + } + void destroy() { + pthread_mutex_lock(&mMutex); + if (NULL != mCb && this == mMe) { + delete this; + } + pthread_mutex_unlock(&mMutex); + } + virtual void timeOutCallback() { + loc_timer_callback cb = mCb; + void* callerData = mCallerData; + if (cb) { + cb(callerData, 0); + } + destroy(); + } +}; + +pthread_mutex_t LocTimerWrapper::mMutex = PTHREAD_MUTEX_INITIALIZER; + +void* loc_timer_start(uint64_t msec, loc_timer_callback cb_func, + void *caller_data, bool wake_on_expire) +{ + LocTimerWrapper* locTimerWrapper = NULL; + + if (cb_func) { + locTimerWrapper = new LocTimerWrapper(cb_func, caller_data); + + if (locTimerWrapper) { + locTimerWrapper->start(msec, wake_on_expire); + } + } + + return locTimerWrapper; +} + +void loc_timer_stop(void*& handle) +{ + if (handle) { + LocTimerWrapper* locTimerWrapper = (LocTimerWrapper*)(handle); + locTimerWrapper->destroy(); + handle = NULL; + } +} + +////////////////////////////////////////////////////////////////////////// +// This section above wraps for the C style APIs +////////////////////////////////////////////////////////////////////////// + +#ifdef __LOC_DEBUG__ + +double getDeltaSeconds(struct timespec from, struct timespec to) { + return (double)to.tv_sec + (double)to.tv_nsec / 1000000000 + - from.tv_sec - (double)from.tv_nsec / 1000000000; +} + +struct timespec getNow() { + struct timespec now; + clock_gettime(CLOCK_BOOTTIME, &now); + return now; +} + +class LocTimerTest : public LocTimer, public LocRankable { + int mTimeOut; + const struct timespec mTimeOfBirth; + inline struct timespec getTimerWrapper(int timeout) { + struct timespec now; + clock_gettime(CLOCK_BOOTTIME, &now); + now.tv_sec += timeout; + return now; + } +public: + inline LocTimerTest(int timeout) : LocTimer(), LocRankable(), + mTimeOut(timeout), mTimeOfBirth(getTimerWrapper(0)) {} + inline virtual int ranks(LocRankable& rankable) { + LocTimerTest* timer = dynamic_cast(&rankable); + return timer->mTimeOut - mTimeOut; + } + inline virtual void timeOutCallback() { + printf("timeOutCallback() - "); + deviation(); + } + double deviation() { + struct timespec now = getTimerWrapper(0); + double delta = getDeltaSeconds(mTimeOfBirth, now); + printf("%lf: %lf\n", delta, delta * 100 / mTimeOut); + return delta / mTimeOut; + } +}; + +// For Linux command line testing: +// compilation: +// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../system/core/include -o LocHeap.o LocHeap.cpp +// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -std=c++0x -I. -I../../../../system/core/include -lpthread -o LocThread.o LocThread.cpp +// g++ -D__LOC_HOST_DEBUG__ -D__LOC_DEBUG__ -g -I. -I../../../../system/core/include -o LocTimer.o LocTimer.cpp +int main(int argc, char** argv) { + struct timespec timeOfStart=getNow(); + srand(time(NULL)); + int tries = atoi(argv[1]); + int checks = tries >> 3; + LocTimerTest** timerArray = new LocTimerTest*[tries]; + memset(timerArray, NULL, tries); + + for (int i = 0; i < tries; i++) { + int r = rand() % tries; + LocTimerTest* timer = new LocTimerTest(r); + if (timerArray[r]) { + if (!timer->stop()) { + printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow())); + printf("ERRER: %dth timer, id %d, not running when it should be\n", i, r); + exit(0); + } else { + printf("stop() - %d\n", r); + delete timer; + timerArray[r] = NULL; + } + } else { + if (!timer->start(r, false)) { + printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow())); + printf("ERRER: %dth timer, id %d, running when it should not be\n", i, r); + exit(0); + } else { + printf("stop() - %d\n", r); + timerArray[r] = timer; + } + } + } + + for (int i = 0; i < tries; i++) { + if (timerArray[i]) { + if (!timerArray[i]->stop()) { + printf("%lf:\n", getDeltaSeconds(timeOfStart, getNow())); + printf("ERRER: %dth timer, not running when it should be\n", i); + exit(0); + } else { + printf("stop() - %d\n", i); + delete timerArray[i]; + timerArray[i] = NULL; + } + } + } + + delete[] timerArray; + + return 0; +} + +#endif diff --git a/utils/LocTimer.h b/utils/LocTimer.h new file mode 100644 index 00000000..c1468524 --- /dev/null +++ b/utils/LocTimer.h @@ -0,0 +1,74 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __LOC_TIMER_CPP_H__ +#define __LOC_TIMER_CPP_H__ + +#include +#include + +// opaque class to provide service implementation. +class LocTimerDelegate; +class LocSharedLock; + +// LocTimer client must extend this class and implementthe callback. +// start() / stop() methods are to arm / disarm timer. +class LocTimer +{ + LocTimerDelegate* mTimer; + LocSharedLock* mLock; + // don't really want mLock to be manipulated by clients, yet LocTimer + // has to have a reference to the lock so that the delete of LocTimer + // and LocTimerDelegate can work together on their share resources. + friend class LocTimerDelegate; + +public: + LocTimer(); + virtual ~LocTimer(); + + // timeOutInMs: timeout delay in ms + // wakeOnExpire: true if to wake up CPU (if sleeping) upon timer + // expiration and notify the client. + // false if to wait until next time CPU wakes up (if + // sleeping) and then notify the client. + // return: true on success; + // false on failure, e.g. timer is already running. + bool start(uint32_t timeOutInMs, bool wakeOnExpire); + + // return: true on success; + // false on failure, e.g. timer is not running. + bool stop(); + + // LocTimer client Should implement this method. + // This method is used for timeout calling back to client. This method + // should be short enough (eg: send a message to your own thread). + virtual void timeOutCallback() = 0; +}; + +#endif //__LOC_DELAY_H__ diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp new file mode 100644 index 00000000..f33d6024 --- /dev/null +++ b/utils/MsgTask.cpp @@ -0,0 +1,100 @@ +/* Copyright (c) 2011-2013,2015 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#define LOG_NDDEBUG 0 +#define LOG_TAG "LocSvc_MsgTask" + +#include +#include +#include +#include + +static void LocMsgDestroy(void* msg) { + delete (LocMsg*)msg; +} + +MsgTask::MsgTask(LocThread::tCreate tCreator, + const char* threadName, bool joinable) : + mQ(msg_q_init2()), mThread(new LocThread()) { + if (!mThread->start(tCreator, threadName, this, joinable)) { + delete mThread; + mThread = NULL; + } +} + +MsgTask::MsgTask(const char* threadName, bool joinable) : + mQ(msg_q_init2()), mThread(new LocThread()) { + if (!mThread->start(threadName, this, joinable)) { + delete mThread; + mThread = NULL; + } +} + +MsgTask::~MsgTask() { + msg_q_flush((void*)mQ); + msg_q_destroy((void**)&mQ); +} + +void MsgTask::destroy() { + msg_q_unblock((void*)mQ); + if (mThread) { + LocThread* thread = mThread; + mThread = NULL; + delete thread; + } else { + delete this; + } +} + +void MsgTask::sendMsg(const LocMsg* msg) const { + msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy); +} + +void MsgTask::prerun() { + // make sure we do not run in background scheduling group + set_sched_policy(gettid(), SP_FOREGROUND); +} + +bool MsgTask::run() { + LOC_LOGV("MsgTask::loop() listening ...\n"); + LocMsg* msg; + msq_q_err_type result = msg_q_rcv((void*)mQ, (void **)&msg); + if (eMSG_Q_SUCCESS != result) { + LOC_LOGE("%s:%d] fail receiving msg: %s\n", __func__, __LINE__, + loc_get_msg_q_status(result)); + return false; + } + + msg->log(); + // there is where each individual msg handling is invoked + msg->proc(); + + delete msg; + + return true; +} diff --git a/core/MsgTask.h b/utils/MsgTask.h similarity index 67% rename from core/MsgTask.h rename to utils/MsgTask.h index d09de731..9eb1f567 100644 --- a/core/MsgTask.h +++ b/utils/MsgTask.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2013,2015 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,12 +29,7 @@ #ifndef __MSG_TASK__ #define __MSG_TASK__ -#include -#include -#include -#include - -namespace loc_core { +#include struct LocMsg { inline LocMsg() {} @@ -43,24 +38,30 @@ struct LocMsg { inline virtual void log() const {} }; -class MsgTask { -public: - typedef void* (*tStart)(void*); - typedef pthread_t (*tCreate)(const char* name, tStart start, void* arg); - typedef int (*tAssociate)(); - MsgTask(tCreate tCreator, const char* threadName); - MsgTask(tAssociate tAssociator, const char* threadName); - ~MsgTask(); - void sendMsg(const LocMsg* msg) const; - -private: +class MsgTask : public LocRunnable { const void* mQ; - tAssociate mAssociator; - MsgTask(const void* q, tAssociate associator); - static void* loopMain(void* copy); - void createPThread(const char* name); + LocThread* mThread; + friend class LocThreadDelegate; +protected: + virtual ~MsgTask(); +public: + MsgTask(LocThread::tCreate tCreator, const char* threadName = NULL, bool joinable = true); + MsgTask(const char* threadName = NULL, bool joinable = true); + // this obj will be deleted once thread is deleted + void destroy(); + void sendMsg(const LocMsg* msg) const; + // Overrides of LocRunnable methods + // This method will be repeated called until it returns false; or + // until thread is stopped. + virtual bool run(); + + // The method to be run before thread loop (conditionally repeatedly) + // calls run() + virtual void prerun(); + + // The method to be run after thread loop (conditionally repeatedly) + // calls run() + inline virtual void postrun() {} }; -} // namespace loc_core - #endif //__MSG_TASK__ diff --git a/utils/linked_list.c b/utils/linked_list.c index 1109acd3..acec5b1f 100644 --- a/utils/linked_list.c +++ b/utils/linked_list.c @@ -108,7 +108,7 @@ linked_list_err_type linked_list_destroy(void** list_data) ===========================================================================*/ linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dealloc)(void*)) { - LOC_LOGD("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, data_obj); + LOC_LOGV("%s: Adding to list data_obj = 0x%08X\n", __FUNCTION__, data_obj); if( list_data == NULL ) { LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__); @@ -160,7 +160,7 @@ linked_list_err_type linked_list_add(void* list_data, void *data_obj, void (*dea ===========================================================================*/ linked_list_err_type linked_list_remove(void* list_data, void **data_obj) { - LOC_LOGD("%s: Removing from list\n", __FUNCTION__); + LOC_LOGV("%s: Removing from list\n", __FUNCTION__); if( list_data == NULL ) { LOC_LOGE("%s: Invalid list parameter!\n", __FUNCTION__); @@ -267,7 +267,7 @@ linked_list_err_type linked_list_search(void* list_data, void **data_p, bool (*equal)(void* data_0, void* data), void* data_0, bool rm_if_found) { - LOC_LOGD("%s: Search the list\n", __FUNCTION__); + LOC_LOGV("%s: Search the list\n", __FUNCTION__); if( list_data == NULL || NULL == equal ) { LOC_LOGE("%s: Invalid list parameter! list_data %p equal %p\n", diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 8c76d1fe..967d2f30 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -38,8 +38,9 @@ #include #include #include -#include -#if defined(USE_GLIB) && !defined(OFF_TARGET) +#include +#include +#ifdef USE_GLIB #include #endif #include "platform_lib_includes.h" @@ -51,68 +52,23 @@ *============================================================================*/ /* Parameter data */ -static uint8_t DEBUG_LEVEL = 0xff; -static uint8_t TIMESTAMP = 0; +static uint32_t DEBUG_LEVEL = 0xff; +static uint32_t TIMESTAMP = 0; /* Parameter spec table */ -static loc_param_s_type loc_parameter_table[] = +static const loc_param_s_type loc_param_table[] = { - {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, - {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, + {"DEBUG_LEVEL", &DEBUG_LEVEL, NULL, 'n'}, + {"TIMESTAMP", &TIMESTAMP, NULL, 'n'}, }; -int loc_param_num = sizeof(loc_parameter_table) / sizeof(loc_param_s_type); - -/*=========================================================================== -FUNCTION trim_space - -DESCRIPTION - Removes leading and trailing spaces of the string - -DEPENDENCIES - N/A - -RETURN VALUE - None - -SIDE EFFECTS - N/A -===========================================================================*/ -void trim_space(char *org_string) -{ - char *scan_ptr, *write_ptr; - char *first_nonspace = NULL, *last_nonspace = NULL; - - scan_ptr = write_ptr = org_string; - - while (*scan_ptr) - { - if ( !isspace(*scan_ptr) && first_nonspace == NULL) - { - first_nonspace = scan_ptr; - } - - if (first_nonspace != NULL) - { - *(write_ptr++) = *scan_ptr; - if ( !isspace(*scan_ptr)) - { - last_nonspace = write_ptr; - } - } - - scan_ptr++; - } - - if (last_nonspace) { *last_nonspace = '\0'; } -} +static const int loc_param_num = sizeof(loc_param_table) / sizeof(loc_param_s_type); typedef struct loc_param_v_type { - char* param_name; - - char* param_str_value; - int param_int_value; - double param_double_value; + char* param_name; + char* param_str_value; + int param_int_value; + double param_double_value; }loc_param_v_type; /*=========================================================================== @@ -136,61 +92,267 @@ RETURN VALUE SIDE EFFECTS N/A ===========================================================================*/ -void loc_set_config_entry(loc_param_s_type* config_entry, loc_param_v_type* config_value) +int loc_set_config_entry(const loc_param_s_type* config_entry, loc_param_v_type* config_value) { - if(NULL == config_entry || NULL == config_value) - { - LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__); - return; - } + int ret=-1; + if(NULL == config_entry || NULL == config_value) + { + LOC_LOGE("%s: INVALID config entry or parameter", __FUNCTION__); + return ret; + } - if (strcmp(config_entry->param_name, config_value->param_name) == 0 && - config_entry->param_ptr) - { - switch (config_entry->param_type) - { - case 's': - if (strcmp(config_value->param_str_value, "NULL") == 0) - { - *((char*)config_entry->param_ptr) = '\0'; - } - else { - strlcpy((char*) config_entry->param_ptr, - config_value->param_str_value, - LOC_MAX_PARAM_STRING + 1); - } - /* Log INI values */ - LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__, config_entry->param_name, (char*)config_entry->param_ptr); + if (strcmp(config_entry->param_name, config_value->param_name) == 0 && + config_entry->param_ptr) + { + switch (config_entry->param_type) + { + case 's': + if (strcmp(config_value->param_str_value, "NULL") == 0) + { + *((char*)config_entry->param_ptr) = '\0'; + } + else { + strlcpy((char*) config_entry->param_ptr, + config_value->param_str_value, + LOC_MAX_PARAM_STRING + 1); + } + /* Log INI values */ + LOC_LOGD("%s: PARAM %s = %s", __FUNCTION__, + config_entry->param_name, (char*)config_entry->param_ptr); - if(NULL != config_entry->param_set) - { - *(config_entry->param_set) = 1; - } - break; - case 'n': - *((int *)config_entry->param_ptr) = config_value->param_int_value; - /* Log INI values */ - LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__, config_entry->param_name, config_value->param_int_value); + if(NULL != config_entry->param_set) + { + *(config_entry->param_set) = 1; + } + ret = 0; + break; + case 'n': + *((int *)config_entry->param_ptr) = config_value->param_int_value; + /* Log INI values */ + LOC_LOGD("%s: PARAM %s = %d", __FUNCTION__, + config_entry->param_name, config_value->param_int_value); - if(NULL != config_entry->param_set) - { - *(config_entry->param_set) = 1; - } - break; - case 'f': - *((double *)config_entry->param_ptr) = config_value->param_double_value; - /* Log INI values */ - LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__, config_entry->param_name, config_value->param_double_value); + if(NULL != config_entry->param_set) + { + *(config_entry->param_set) = 1; + } + ret = 0; + break; + case 'f': + *((double *)config_entry->param_ptr) = config_value->param_double_value; + /* Log INI values */ + LOC_LOGD("%s: PARAM %s = %f", __FUNCTION__, + config_entry->param_name, config_value->param_double_value); - if(NULL != config_entry->param_set) - { - *(config_entry->param_set) = 1; - } - break; - default: - LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s", __FUNCTION__, config_entry->param_name); - } - } + if(NULL != config_entry->param_set) + { + *(config_entry->param_set) = 1; + } + ret = 0; + break; + default: + LOC_LOGE("%s: PARAM %s parameter type must be n, f, or s", + __FUNCTION__, config_entry->param_name); + } + } + return ret; +} + +/*=========================================================================== +FUNCTION loc_fill_conf_item + +DESCRIPTION + Takes a line of configuration item and sets defined values based on + the passed in configuration table. This table maps strings to values to + set along with the type of each of these values. + +PARAMETERS: + input_buf : buffer contanis config item + config_table: table definition of strings to places to store information + table_length: length of the configuration table + +DEPENDENCIES + N/A + +RETURN VALUE + 0: Number of records in the config_table filled with input_buf + +SIDE EFFECTS + N/A +===========================================================================*/ +int loc_fill_conf_item(char* input_buf, + const loc_param_s_type* config_table, uint32_t table_length) +{ + int ret = 0; + + if (input_buf && config_table) { + char *lasts; + loc_param_v_type config_value; + memset(&config_value, 0, sizeof(config_value)); + + /* Separate variable and value */ + config_value.param_name = strtok_r(input_buf, "=", &lasts); + /* skip lines that do not contain "=" */ + if (config_value.param_name) { + config_value.param_str_value = strtok_r(NULL, "=", &lasts); + + /* skip lines that do not contain two operands */ + if (config_value.param_str_value) { + /* Trim leading and trailing spaces */ + loc_util_trim_space(config_value.param_name); + loc_util_trim_space(config_value.param_str_value); + + /* Parse numerical value */ + if ((strlen(config_value.param_str_value) >=3) && + (config_value.param_str_value[0] == '0') && + (tolower(config_value.param_str_value[1]) == 'x')) + { + /* hex */ + config_value.param_int_value = (int) strtol(&config_value.param_str_value[2], + (char**) NULL, 16); + } + else { + config_value.param_double_value = (double) atof(config_value.param_str_value); /* float */ + config_value.param_int_value = atoi(config_value.param_str_value); /* dec */ + } + + for(uint32_t i = 0; NULL != config_table && i < table_length; i++) + { + if(!loc_set_config_entry(&config_table[i], &config_value)) { + ret += 1; + } + } + } + } + } + + return ret; +} + +/*=========================================================================== +FUNCTION loc_read_conf_r (repetitive) + +DESCRIPTION + Reads the specified configuration file and sets defined values based on + the passed in configuration table. This table maps strings to values to + set along with the type of each of these values. + The difference between this and loc_read_conf is that this function returns + the file pointer position at the end of filling a config table. Also, it + reads a fixed number of parameters at a time which is equal to the length + of the configuration table. This functionality enables the caller to + repeatedly call the function to read data from the same file. + +PARAMETERS: + conf_fp : file pointer + config_table: table definition of strings to places to store information + table_length: length of the configuration table + +DEPENDENCIES + N/A + +RETURN VALUE + 0: Table filled successfully + 1: No more parameters to read + -1: Error filling table + +SIDE EFFECTS + N/A +===========================================================================*/ +int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, uint32_t table_length) +{ + int ret=0; + + unsigned int num_params=table_length; + if(conf_fp == NULL) { + LOC_LOGE("%s:%d]: ERROR: File pointer is NULL\n", __func__, __LINE__); + ret = -1; + goto err; + } + + /* Clear all validity bits */ + for(uint32_t i = 0; NULL != config_table && i < table_length; i++) + { + if(NULL != config_table[i].param_set) + { + *(config_table[i].param_set) = 0; + } + } + + char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */ + + LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params); + while(num_params) + { + if(!fgets(input_buf, LOC_MAX_PARAM_LINE, conf_fp)) { + LOC_LOGD("%s:%d]: fgets returned NULL\n", __func__, __LINE__); + break; + } + + num_params -= loc_fill_conf_item(input_buf, config_table, table_length); + } + +err: + return ret; +} + +/*=========================================================================== +FUNCTION loc_udpate_conf + +DESCRIPTION + Parses the passed in buffer for configuration items, and update the table + that is also passed in. + +Reads the specified configuration file and sets defined values based on + the passed in configuration table. This table maps strings to values to + set along with the type of each of these values. + +PARAMETERS: + conf_data: configuration items in bufferas a string + length: strlen(conf_data) + config_table: table definition of strings to places to store information + table_length: length of the configuration table + +DEPENDENCIES + N/A + +RETURN VALUE + number of the records in the table that is updated at time of return. + +SIDE EFFECTS + N/A +===========================================================================*/ +int loc_update_conf(const char* conf_data, int32_t length, + const loc_param_s_type* config_table, uint32_t table_length) +{ + int ret = -1; + + if (conf_data && length && config_table && table_length) { + // make a copy, so we do not tokenize the original data + char* conf_copy = (char*)malloc(length+1); + + if (conf_copy != NULL) + { + memcpy(conf_copy, conf_data, length); + // we hard NULL the end of string to be safe + conf_copy[length] = 0; + + // start with one record off + uint32_t num_params = table_length - 1; + char* saveptr = NULL; + char* input_buf = strtok_r(conf_copy, "\n", &saveptr); + ret = 0; + + LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params); + while(num_params && input_buf) { + ret++; + num_params -= loc_fill_conf_item(input_buf, config_table, table_length); + input_buf = strtok_r(NULL, "\n", &saveptr); + } + free(conf_copy); + } + } + + return ret; } /*=========================================================================== @@ -215,72 +377,24 @@ RETURN VALUE SIDE EFFECTS N/A ===========================================================================*/ -void loc_read_conf(const char* conf_file_name, loc_param_s_type* config_table, uint32_t table_length) +void loc_read_conf(const char* conf_file_name, const loc_param_s_type* config_table, + uint32_t table_length) { - FILE *gps_conf_fp = NULL; - char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */ - char *lasts; - loc_param_v_type config_value; - uint32_t i; + FILE *conf_fp = NULL; + char *lasts; + loc_param_v_type config_value; + uint32_t i; - if((gps_conf_fp = fopen(conf_file_name, "r")) != NULL) - { - LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name); - } - else - { - LOC_LOGW("%s: no %s file found", __FUNCTION__, conf_file_name); - loc_logger_init(DEBUG_LEVEL, TIMESTAMP); - return; /* no parameter file */ - } - - /* Clear all validity bits */ - for(i = 0; NULL != config_table && i < table_length; i++) - { - if(NULL != config_table[i].param_set) - { - *(config_table[i].param_set) = 0; - } - } - - while(fgets(input_buf, LOC_MAX_PARAM_LINE, gps_conf_fp) != NULL) - { - memset(&config_value, 0, sizeof(config_value)); - - /* Separate variable and value */ - config_value.param_name = strtok_r(input_buf, "=", &lasts); - if (config_value.param_name == NULL) continue; /* skip lines that do not contain "=" */ - config_value.param_str_value = strtok_r(NULL, "=", &lasts); - if (config_value.param_str_value == NULL) continue; /* skip lines that do not contain two operands */ - - /* Trim leading and trailing spaces */ - trim_space(config_value.param_name); - trim_space(config_value.param_str_value); - - /* Parse numerical value */ - if (config_value.param_str_value[0] == '0' && tolower(config_value.param_str_value[1]) == 'x') - { - /* hex */ - config_value.param_int_value = (int) strtol(&config_value.param_str_value[2], (char**) NULL, 16); - } - else { - config_value.param_double_value = (double) atof(config_value.param_str_value); /* float */ - config_value.param_int_value = atoi(config_value.param_str_value); /* dec */ - } - - for(i = 0; NULL != config_table && i < table_length; i++) - { - loc_set_config_entry(&config_table[i], &config_value); - } - - for(i = 0; i < loc_param_num; i++) - { - loc_set_config_entry(&loc_parameter_table[i], &config_value); - } - } - - fclose(gps_conf_fp); - - /* Initialize logging mechanism with parsed data */ - loc_logger_init(DEBUG_LEVEL, TIMESTAMP); + if((conf_fp = fopen(conf_file_name, "r")) != NULL) + { + LOC_LOGD("%s: using %s", __FUNCTION__, conf_file_name); + if(table_length && config_table) { + loc_read_conf_r(conf_fp, config_table, table_length); + rewind(conf_fp); + } + loc_read_conf_r(conf_fp, loc_param_table, loc_param_num); + fclose(conf_fp); + } + /* Initialize logging mechanism with parsed data */ + loc_logger_init(DEBUG_LEVEL, TIMESTAMP); } diff --git a/utils/loc_cfg.h b/utils/loc_cfg.h index df833389..9045e1d5 100644 --- a/utils/loc_cfg.h +++ b/utils/loc_cfg.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -30,17 +30,22 @@ #ifndef LOC_CFG_H #define LOC_CFG_H +#include #include -#define LOC_MAX_PARAM_NAME 48 +#define LOC_MAX_PARAM_NAME 80 #define LOC_MAX_PARAM_STRING 80 -#define LOC_MAX_PARAM_LINE 80 +#define LOC_MAX_PARAM_LINE (LOC_MAX_PARAM_NAME + LOC_MAX_PARAM_STRING) + +#define UTIL_UPDATE_CONF(conf_data, len, config_table) \ + loc_update_conf((conf_data), (len), (config_table), \ + sizeof(config_table) / sizeof(config_table[0])) #define UTIL_READ_CONF_DEFAULT(filename) \ loc_read_conf((filename), NULL, 0); #define UTIL_READ_CONF(filename, config_table) \ - loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0])) + loc_read_conf((filename), (config_table), sizeof(config_table) / sizeof(config_table[0])) /*============================================================================= * @@ -49,7 +54,7 @@ *============================================================================*/ typedef struct { - char param_name[LOC_MAX_PARAM_NAME]; + const char *param_name; void *param_ptr; uint8_t *param_set; /* was this value set by config file? */ char param_type; /* 'n' for number, @@ -72,10 +77,13 @@ extern "C" { * MODULE EXPORTED FUNCTIONS * *============================================================================*/ -extern void loc_read_conf(const char* conf_file_name, - loc_param_s_type* config_table, - uint32_t table_length); - +void loc_read_conf(const char* conf_file_name, + const loc_param_s_type* config_table, + uint32_t table_length); +int loc_read_conf_r(FILE *conf_fp, const loc_param_s_type* config_table, + uint32_t table_length); +int loc_update_conf(const char* conf_data, int32_t length, + const loc_param_s_type* config_table, uint32_t table_length); #ifdef __cplusplus } #endif diff --git a/utils/loc_log.cpp b/utils/loc_log.cpp index c64310eb..f6b54f91 100644 --- a/utils/loc_log.cpp +++ b/utils/loc_log.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012, 2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -47,14 +47,15 @@ const char FROM_MODEM[] = "<---"; const char TO_AFW[] = "<==="; const char EXIT_TAG[] = "Exiting"; const char ENTRY_TAG[] = "Entering"; +const char EXIT_ERROR_TAG[] = "Exiting with error"; /* Logging Mechanism */ loc_logger_s_type loc_logger; /* Get names from value */ -const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask) +const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask) { - int i; + size_t i; for (i = 0; i < table_size; i++) { if (table[i].val & (long) mask) @@ -66,9 +67,9 @@ const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, } /* Get names from value */ -const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value) +const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value) { - int i; + size_t i; for (i = 0; i < table_size; i++) { if (table[i].val == (long) value) @@ -79,7 +80,7 @@ const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, l return UNKNOWN_STR; } -static loc_name_val_s_type loc_msg_q_status[] = +static const loc_name_val_s_type loc_msg_q_status[] = { NAME_VAL( eMSG_Q_SUCCESS ), NAME_VAL( eMSG_Q_FAILURE_GENERAL ), @@ -88,7 +89,7 @@ static loc_name_val_s_type loc_msg_q_status[] = NAME_VAL( eMSG_Q_UNAVAILABLE_RESOURCE ), NAME_VAL( eMSG_Q_INSUFFICIENT_BUFFER ) }; -static int loc_msg_q_status_num = sizeof(loc_msg_q_status) / sizeof(loc_name_val_s_type); +static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status); /* Find msg_q status name */ const char* loc_get_msg_q_status(int status) @@ -102,17 +103,18 @@ const char* log_succ_fail_string(int is_succ) } //Target names -loc_name_val_s_type target_name[] = +static const loc_name_val_s_type target_name[] = { NAME_VAL(GNSS_NONE), NAME_VAL(GNSS_MSM), NAME_VAL(GNSS_GSS), NAME_VAL(GNSS_MDM), NAME_VAL(GNSS_QCA1530), + NAME_VAL(GNSS_AUTO), NAME_VAL(GNSS_UNKNOWN) }; -static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type); +static const size_t target_name_num = LOC_TABLE_SIZE(target_name); /*=========================================================================== @@ -133,7 +135,7 @@ const char *loc_get_target_name(unsigned int target) static char ret[BUFFER_SIZE]; index = getTargetGnssType(target); - if( index >= target_name_num || index < 0) + if( index < 0 || (unsigned)index >= target_name_num ) index = target_name_num - 1; if( (target & HAS_SSC) == HAS_SSC ) { @@ -162,7 +164,7 @@ RETURN VALUE The time string ===========================================================================*/ -char *loc_get_time(char *time_string, unsigned long buf_size) +char *loc_get_time(char *time_string, size_t buf_size) { struct timeval now; /* sec and usec */ struct tm now_tm; /* broken-down time */ @@ -176,3 +178,61 @@ char *loc_get_time(char *time_string, unsigned long buf_size) return time_string; } + + +/*=========================================================================== +FUNCTION loc_logger_init + +DESCRIPTION + Initializes the state of DEBUG_LEVEL and TIMESTAMP + +DEPENDENCIES + N/A + +RETURN VALUE + None + +SIDE EFFECTS + N/A +===========================================================================*/ +void loc_logger_init(unsigned long debug, unsigned long timestamp) +{ + loc_logger.DEBUG_LEVEL = debug; +#ifdef TARGET_BUILD_VARIANT_USER + // force user builds to 2 or less + if (loc_logger.DEBUG_LEVEL > 2) { + loc_logger.DEBUG_LEVEL = 2; + } +#endif + loc_logger.TIMESTAMP = timestamp; +} + + +/*=========================================================================== +FUNCTION get_timestamp + +DESCRIPTION + Generates a timestamp using the current system time + +DEPENDENCIES + N/A + +RETURN VALUE + Char pointer to the parameter str + +SIDE EFFECTS + N/A +===========================================================================*/ +char * get_timestamp(char *str, unsigned long buf_size) +{ + struct timeval tv; + struct timezone tz; + int hh, mm, ss; + gettimeofday(&tv, &tz); + hh = tv.tv_sec/3600%24; + mm = (tv.tv_sec%3600)/60; + ss = tv.tv_sec%60; + snprintf(str, buf_size, "%02d:%02d:%02d.%06ld", hh, mm, ss, tv.tv_usec); + return str; +} + diff --git a/utils/loc_log.h b/utils/loc_log.h index 82dc6368..be492b11 100644 --- a/utils/loc_log.h +++ b/utils/loc_log.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012, 2015 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,12 +36,13 @@ extern "C" #endif #include +#include #include "loc_target.h" typedef struct { - char name[128]; - long val; + const char *name; + long val; } loc_name_val_s_type; #define NAME_VAL(x) {"" #x "", x } @@ -49,17 +50,19 @@ typedef struct #define UNKNOWN_STR "UNKNOWN" #define CHECK_MASK(type, value, mask_var, mask) \ - ((mask_var & mask) ? (type) value : (type) (-1)) + (((mask_var) & (mask)) ? (type) (value) : (type) (-1)) + +#define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0])) /* Get names from value */ -const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask); -const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value); +const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask); +const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value); const char* loc_get_msg_q_status(int status); const char* loc_get_target_name(unsigned int target); extern const char* log_succ_fail_string(int is_succ); -extern char *loc_get_time(char *time_string, unsigned long buf_size); +extern char *loc_get_time(char *time_string, size_t buf_size); #ifdef __cplusplus } diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp new file mode 100644 index 00000000..7e96313f --- /dev/null +++ b/utils/loc_misc_utils.cpp @@ -0,0 +1,114 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include +#include +#include +#include +#include + +#define LOG_NDDEBUG 0 +#define LOG_TAG "LocSvc_misc_utils" + +int loc_util_split_string(char *raw_string, char **split_strings_ptr, + int max_num_substrings, char delimiter) +{ + int raw_string_index=0; + int num_split_strings=0; + unsigned char end_string=0; + int raw_string_length=0; + + if(!raw_string || !split_strings_ptr) { + LOC_LOGE("%s:%d]: NULL parameters", __func__, __LINE__); + num_split_strings = -1; + goto err; + } + LOC_LOGD("%s:%d]: raw string: %s\n", __func__, __LINE__, raw_string); + raw_string_length = strlen(raw_string) + 1; + split_strings_ptr[num_split_strings] = &raw_string[raw_string_index]; + for(raw_string_index=0; raw_string_index < raw_string_length; raw_string_index++) { + if(raw_string[raw_string_index] == '\0') + end_string=1; + if((raw_string[raw_string_index] == delimiter) || end_string) { + raw_string[raw_string_index] = '\0'; + LOC_LOGD("%s:%d]: split string: %s\n", + __func__, __LINE__, split_strings_ptr[num_split_strings]); + num_split_strings++; + if(((raw_string_index + 1) < raw_string_length) && + (num_split_strings < max_num_substrings)) { + split_strings_ptr[num_split_strings] = &raw_string[raw_string_index+1]; + } + else { + break; + } + } + if(end_string) + break; + } +err: + LOC_LOGD("%s:%d]: num_split_strings: %d\n", __func__, __LINE__, num_split_strings); + return num_split_strings; +} + +void loc_util_trim_space(char *org_string) +{ + char *scan_ptr, *write_ptr; + char *first_nonspace = NULL, *last_nonspace = NULL; + + if(org_string == NULL) { + LOC_LOGE("%s:%d]: NULL parameter", __func__, __LINE__); + goto err; + } + + scan_ptr = write_ptr = org_string; + + while (*scan_ptr) { + //Find the first non-space character + if ( !isspace(*scan_ptr) && first_nonspace == NULL) { + first_nonspace = scan_ptr; + } + //Once the first non-space character is found in the + //above check, keep shifting the characters to the left + //to replace the spaces + if (first_nonspace != NULL) { + *(write_ptr++) = *scan_ptr; + //Keep track of which was the last non-space character + //encountered + //last_nonspace will not be updated in the case where + //the string ends with spaces + if ( !isspace(*scan_ptr)) { + last_nonspace = write_ptr; + } + } + scan_ptr++; + } + //Add NULL terminator after the last non-space character + if (last_nonspace) { *last_nonspace = '\0'; } +err: + return; +} diff --git a/utils/loc_misc_utils.h b/utils/loc_misc_utils.h new file mode 100644 index 00000000..7d66d842 --- /dev/null +++ b/utils/loc_misc_utils.h @@ -0,0 +1,99 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _LOC_MISC_UTILS_H_ +#define _LOC_MISC_UTILS_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/*=========================================================================== +FUNCTION loc_split_string + +DESCRIPTION: + This function is used to split a delimiter separated string into + sub-strings. This function does not allocate new memory to store the split + strings. Instead, it places '\0' in places of delimiters and assings the + starting address of the substring within the raw string as the string address + The input raw_string no longer remains to be a collection of sub-strings + after this function is executed. + Please make a copy of the input string before calling this function if + necessary + +PARAMETERS: + char *raw_string: is the original string with delimiter separated substrings + char **split_strings_ptr: is the arraw of pointers which will hold the addresses + of individual substrings + int max_num_substrings: is the maximum number of substrings that are expected + by the caller. The array of pointers in the above parameter + is usually this long + char delimiter: is the delimiter that separates the substrings. Examples: ' ', ';' + +DEPENDENCIES + N/A + +RETURN VALUE + int Number of split strings + +SIDE EFFECTS + The input raw_string no longer remains a delimiter separated single string. + +EXAMPLE + delimiter = ' ' //space + raw_string = "hello new user" //delimiter is space ' ' + addresses = 0123456789abcd + split_strings_ptr[0] = &raw_string[0]; //split_strings_ptr[0] contains "hello" + split_strings_ptr[1] = &raw_string[6]; //split_strings_ptr[1] contains "new" + split_strings_ptr[2] = &raw_string[a]; //split_strings_ptr[2] contains "user" + +===========================================================================*/ +int loc_util_split_string(char *raw_string, char **split_strings_ptr, int max_num_substrings, + char delimiter); + +/*=========================================================================== +FUNCTION trim_space + +DESCRIPTION + Removes leading and trailing spaces of the string + +DEPENDENCIES + N/A + +RETURN VALUE + None + +SIDE EFFECTS + N/A +===========================================================================*/ +void loc_util_trim_space(char *org_string); +#ifdef __cplusplus +} +#endif + +#endif //_LOC_MISC_UTILS_H_ diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index b5a62972..30c040c7 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2012,2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -53,11 +53,15 @@ #define STR_SURF "Surf" #define STR_MTP "MTP" #define STR_APQ "apq" +#define STR_AUTO "auto" #define IS_STR_END(c) ((c) == '\0' || (c) == '\n' || (c) == '\r') #define LENGTH(s) (sizeof(s) - 1) #define GPS_CHECK_NO_ERROR 0 #define GPS_CHECK_NO_GPS_HW 1 -#define QCA1530_DETECT_TIMEOUT 30 +/* When system server is started, it uses 20 seconds as ActivityManager + * timeout. After that it sends SIGSTOP signal to process. + */ +#define QCA1530_DETECT_TIMEOUT 15 #define QCA1530_DETECT_PRESENT "yes" #define QCA1530_DETECT_PROGRESS "detect" @@ -99,7 +103,7 @@ static int read_a_line(const char * file_path, char * line, int line_size) */ static bool is_qca1530(void) { - static const char qca1530_property_name[] = "persist.qca1530"; + static const char qca1530_property_name[] = "sys.qca1530"; bool res = false; int ret, i; char buf[PROPERTY_VALUE_MAX]; @@ -142,6 +146,34 @@ static bool is_qca1530(void) return res; } +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_target_baseband(char *baseband, int array_length) +{ + if(baseband && (array_length >= PROPERTY_VALUE_MAX)) { + property_get("ro.baseband", baseband, ""); + LOC_LOGD("%s:%d]: Baseband: %s\n", __func__, __LINE__, baseband); + } + else { + LOC_LOGE("%s:%d]: NULL parameter or array length less than PROPERTY_VALUE_MAX\n", + __func__, __LINE__); + } +} + +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_platform_name(char *platform_name, int array_length) +{ + if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) { + property_get("ro.board.platform", platform_name, ""); + LOC_LOGD("%s:%d]: Target name: %s\n", __func__, __LINE__, platform_name); + } + else { + LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n", + __func__, __LINE__); + } +} + unsigned int loc_get_target(void) { if (gTarget != (unsigned int)-1) @@ -164,7 +196,8 @@ unsigned int loc_get_target(void) goto detected; } - platform_lib_abstraction_property_get("ro.baseband", baseband, ""); + loc_get_target_baseband(baseband, sizeof(baseband)); + if (!access(hw_platform, F_OK)) { read_a_line(hw_platform, rd_hw_platform, LINE_LEN); } else { @@ -175,8 +208,13 @@ unsigned int loc_get_target(void) } else { read_a_line(id_dep, rd_id, LINE_LEN); } - + if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) ) + { + gTarget = TARGET_AUTO; + goto detected; + } if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){ + if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) ) gTarget = TARGET_MPQ; @@ -207,3 +245,17 @@ detected: LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget); return gTarget; } + +/*Reads the property ro.lean to identify if this is a lean target + Returns: + 0 if not a lean and mean target + 1 if this is a lean and mean target +*/ +int loc_identify_lean_target() +{ + int ret = 0; + char lean_target[PROPERTY_VALUE_MAX]; + property_get("ro.lean", lean_target, ""); + LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target); + return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX)); +} diff --git a/utils/loc_target.h b/utils/loc_target.h index 4aebb851..3bb3b5e2 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -35,6 +35,7 @@ #define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC) #define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC) #define TARGET_QCA1530 TARGET_SET(GNSS_QCA1530, NO_SSC) +#define TARGET_AUTO TARGET_SET(GNSS_AUTO, NO_SSC) #define TARGET_UNKNOWN TARGET_SET(GNSS_UNKNOWN, NO_SSC) #define getTargetGnssType(target) (target>>1) @@ -45,6 +46,18 @@ extern "C" unsigned int loc_get_target(void); +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_target_baseband(char *baseband, int array_length); +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_platform_name(char *platform_name, int array_length); +/*Reads the property ro.lean to identify if this is a lean target + Returns: + 0 if not a lean and mean target + 1 if this is a lean and mean target*/ +int loc_identify_lean_target(); + /* Please remember to update 'target_name' in loc_log.cpp, if do any changes to this enum. */ typedef enum { @@ -53,6 +66,7 @@ typedef enum { GNSS_GSS, GNSS_MDM, GNSS_QCA1530, + GNSS_AUTO, GNSS_UNKNOWN }GNSS_TARGET; diff --git a/utils/loc_timer.c b/utils/loc_timer.c deleted file mode 100644 index 0e9f6bde..00000000 --- a/utils/loc_timer.c +++ /dev/null @@ -1,187 +0,0 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation, nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include -#include "loc_timer.h" -#include -#include -#include"platform_lib_includes.h" - -enum timer_state { - READY = 100, - WAITING, - DONE, - ABORT -}; - -typedef struct { - loc_timer_callback callback_func; - void *user_data; - unsigned int time_msec; - pthread_cond_t timer_cond; - pthread_mutex_t timer_mutex; - enum timer_state state; -}timer_data; - -static void *timer_thread(void *thread_data) -{ - int ret = -ETIMEDOUT; - struct timespec ts; - struct timeval tv; - timer_data* t = (timer_data*)thread_data; - - LOC_LOGD("%s:%d]: Enter. Delay = %d\n", __func__, __LINE__, t->time_msec); - - gettimeofday(&tv, NULL); - clock_gettime(CLOCK_REALTIME, &ts); - if(t->time_msec >= 1000) { - ts.tv_sec += t->time_msec/1000; - t->time_msec = t->time_msec % 1000; - } - if(t->time_msec) - ts.tv_nsec += t->time_msec * 1000000; - if(ts.tv_nsec > 999999999) { - LOC_LOGD("%s:%d]: Large nanosecs\n", __func__, __LINE__); - ts.tv_sec += 1; - ts.tv_nsec -= 1000000000; - } - LOC_LOGD("%s:%d]: ts.tv_sec:%d; ts.tv_nsec:%d\n" - "\t Current time: %d sec; %d nsec", - __func__, __LINE__, (int)ts.tv_sec, (int)ts.tv_nsec, - (int)tv.tv_sec, (int)tv.tv_usec*1000); - - pthread_mutex_lock(&(t->timer_mutex)); - if (READY == t->state) { - t->state = WAITING; - ret = pthread_cond_timedwait(&t->timer_cond, &t->timer_mutex, &ts); - t->state = DONE; - } - pthread_mutex_unlock(&(t->timer_mutex)); - - switch (ret) { - case ETIMEDOUT: - LOC_LOGV("%s:%d]: loc_timer timed out", __func__, __LINE__); - break; - case 0: - LOC_LOGV("%s:%d]: loc_timer stopped", __func__, __LINE__); - break; - case -ETIMEDOUT: - LOC_LOGV("%s:%d]: loc_timer cancelled", __func__, __LINE__); - break; - default: - LOC_LOGE("%s:%d]: Call to pthread timedwait failed; ret=%d\n", - __func__, __LINE__, ret); - break; - } - - pthread_mutex_destroy(&t->timer_mutex); - pthread_cond_destroy(&t->timer_cond); - - if(ETIMEDOUT == ret) - t->callback_func(t->user_data, ret); - - free(t); - LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__); - return NULL; -} - -void* loc_timer_start(unsigned int msec, loc_timer_callback cb_func, - void* caller_data) -{ - timer_data *t=NULL; - pthread_attr_t tattr; - pthread_t id; - LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__); - if(cb_func == NULL || msec == 0) { - LOC_LOGE("%s:%d]: Error: Wrong parameters\n", __func__, __LINE__); - goto _err; - } - t = (timer_data *)calloc(1, sizeof(timer_data)); - if(t == NULL) { - LOC_LOGE("%s:%d]: Could not allocate memory. Failing.\n", - __func__, __LINE__); - goto _err; - } - - if(pthread_cond_init(&(t->timer_cond), NULL)) { - LOC_LOGE("%s:%d]: Pthread cond init failed\n", __func__, __LINE__); - goto t_err; - } - if(pthread_mutex_init(&(t->timer_mutex), NULL)) { - LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__); - goto cond_err; - } - - t->callback_func = cb_func; - t->user_data = caller_data; - t->time_msec = msec; - t->state = READY; - - if (pthread_attr_init(&tattr)) { - LOC_LOGE("%s:%d]: Pthread mutex init failed\n", __func__, __LINE__); - goto mutex_err; - } - pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED); - - if(pthread_create(&(id), &tattr, timer_thread, (void *)t)) { - LOC_LOGE("%s:%d]: Could not create thread\n", __func__, __LINE__); - goto attr_err; - } - - LOC_LOGD("%s:%d]: Created thread with id: %d\n", - __func__, __LINE__, (int)id); - goto _err; - -attr_err: - pthread_attr_destroy(&tattr); -mutex_err: - pthread_mutex_destroy(&t->timer_mutex); -cond_err: - pthread_cond_destroy(&t->timer_cond); -t_err: - free(t); -_err: - LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__); - return t; -} - -void loc_timer_stop(void* handle) { - timer_data* t = (timer_data*)handle; - - if (NULL != t && (READY == t->state || WAITING == t->state)) { - pthread_mutex_lock(&(t->timer_mutex)); - if (READY == t->state || WAITING == t->state) { - pthread_cond_signal(&t->timer_cond); - t->state = ABORT; - } - pthread_mutex_unlock(&(t->timer_mutex)); - } -} diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 5ca15862..2967858e 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* 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 @@ -33,28 +33,38 @@ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include -#include +#include /* - Return values: - Success = 0 - Failure = Non zero + user_data: client context pointer, passthrough. Originally received + from calling client when loc_timer_start() is called. + result: 0 if timer successfully timed out; else timer failed. */ -typedef void(*loc_timer_callback)(void *user_data, int result); +typedef void (*loc_timer_callback)(void *user_data, int32_t result); /* - Returns the handle, which can be used to stop the timer + delay_msec: timeout value for the timer. + cb_func: callback function pointer, implemented by client. + Can not be NULL. + user_data: client context pointer, passthrough. Will be + returned when loc_timer_callback() is called. + wakeOnExpire: true if to wake up CPU (if sleeping) upon timer + expiration and notify the client. + false if to wait until next time CPU wakes up (if + sleeping) and then notify the client. + Returns the handle, which can be used to stop the timer + NULL, if timer start fails (e.g. if cb_func is NULL). */ -void* loc_timer_start(unsigned int delay_msec, - loc_timer_callback, - void* user_data); +void* loc_timer_start(uint64_t delay_msec, + loc_timer_callback cb_func, + void *user_data, + bool wake_on_expire=false); /* - handle becomes invalid upon the return of the callback + handle becomes invalid upon the return of the callback */ -void loc_timer_stop(void* handle); +void loc_timer_stop(void*& handle); #ifdef __cplusplus } diff --git a/utils/msg_q.c b/utils/msg_q.c index 1555668c..e412e781 100644 --- a/utils/msg_q.c +++ b/utils/msg_q.c @@ -198,7 +198,7 @@ msq_q_err_type msg_q_snd(void* msg_q_data, void* msg_obj, void (*dealloc)(void*) msg_q* p_msg_q = (msg_q*)msg_q_data; pthread_mutex_lock(&p_msg_q->list_mutex); - LOC_LOGD("%s: Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); + LOC_LOGV("%s: Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); if( p_msg_q->unblocked ) { @@ -214,7 +214,7 @@ msq_q_err_type msg_q_snd(void* msg_q_data, void* msg_obj, void (*dealloc)(void*) pthread_mutex_unlock(&p_msg_q->list_mutex); - LOC_LOGD("%s: Finished Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); + LOC_LOGV("%s: Finished Sending message with handle = 0x%08X\n", __FUNCTION__, msg_obj); return rv; } @@ -241,7 +241,7 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj) msg_q* p_msg_q = (msg_q*)msg_q_data; - LOC_LOGD("%s: Waiting on message\n", __FUNCTION__); + LOC_LOGV("%s: Waiting on message\n", __FUNCTION__); pthread_mutex_lock(&p_msg_q->list_mutex); @@ -262,7 +262,7 @@ msq_q_err_type msg_q_rcv(void* msg_q_data, void** msg_obj) pthread_mutex_unlock(&p_msg_q->list_mutex); - LOC_LOGD("%s: Received message 0x%08X rv = %d\n", __FUNCTION__, *msg_obj, rv); + LOC_LOGV("%s: Received message 0x%08X rv = %d\n", __FUNCTION__, *msg_obj, rv); return rv; } diff --git a/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp b/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp new file mode 100644 index 00000000..e8cb93a9 --- /dev/null +++ b/utils/platform_lib_abstractions/elapsed_millis_since_boot.cpp @@ -0,0 +1,46 @@ +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "platform_lib_time.h" + +int64_t systemTime(int clock) +{ + struct timeval t; + t.tv_sec = t.tv_usec = 0; + gettimeofday(&t, NULL); + return t.tv_sec*1000000LL + t.tv_usec; +} + + +int64_t elapsedMillisSinceBoot() +{ + int64_t t_us = systemTime(0); + return (int64_t) t_us / 1000LL; +} diff --git a/utils/platform_lib_abstractions/platform_lib_includes.h b/utils/platform_lib_abstractions/platform_lib_includes.h new file mode 100644 index 00000000..5858674f --- /dev/null +++ b/utils/platform_lib_abstractions/platform_lib_includes.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PLATFORM_LIB_INCLUDES_H_ +#define _PLATFORM_LIB_INCLUDES_H_ + +#include "platform_lib_time.h" +#include "platform_lib_macros.h" + +#endif diff --git a/utils/platform_lib_abstractions/platform_lib_macros.h b/utils/platform_lib_abstractions/platform_lib_macros.h new file mode 100644 index 00000000..bc48dd99 --- /dev/null +++ b/utils/platform_lib_abstractions/platform_lib_macros.h @@ -0,0 +1,81 @@ +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PLATFORM_LIB_MACROS_H__ +#define __PLATFORM_LIB_MACROS_H__ + +#include + +#define TS_PRINTF(format, x...) \ +{ \ + struct timeval tv; \ + struct timezone tz; \ + int hh, mm, ss; \ + gettimeofday(&tv, &tz); \ + hh = tv.tv_sec/3600%24; \ + mm = (tv.tv_sec%3600)/60; \ + ss = tv.tv_sec%60; \ + fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \ +} + + +#ifdef USE_GLIB + +#define strlcat g_strlcat +#define strlcpy g_strlcpy + +#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) +#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) +#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) +#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) +#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) + +#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid)) + +#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread +#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot()) + + +#else + +#ifdef __cplusplus +extern "C" { +#endif +pid_t gettid(void); + +#ifdef __cplusplus +} +#endif + +#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid()) +#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread +#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime()) + +#endif + +#endif diff --git a/utils/platform_lib_abstractions/platform_lib_time.h b/utils/platform_lib_abstractions/platform_lib_time.h new file mode 100644 index 00000000..ce013afc --- /dev/null +++ b/utils/platform_lib_abstractions/platform_lib_time.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2013, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PLATFORM_LIB_TIME_H_ +#define _PLATFORM_LIB_TIME_H_ + +int64_t systemTime(int clock); +int64_t elapsedMillisSinceBoot(); + +#endif From 285d395703e44e57931613e8dfbeb3b7617a0656 Mon Sep 17 00:00:00 2001 From: Deven Patel Date: Tue, 15 Mar 2016 12:20:25 -0700 Subject: [PATCH 41/41] Revert "Revert "Fix compilation issues for m_master merge into oe_master"." This reverts commit fa7a874eb0586c7844fe3a4cb8d0063ce53464f0 Change-Id: Id2415d80fa3cbdc124e0a3bdd2722db7f233ad53 --- core/LocAdapterBase.cpp | 2 +- core/LocApiBase.cpp | 2 +- core/LocDualContext.cpp | 5 ++ core/Makefile.am | 7 +- core/UlpProxyBase.h | 1 - loc_api/Makefile.am | 4 +- loc_api/libloc_api_50001/LocEngAdapter.cpp | 3 +- loc_api/libloc_api_50001/Makefile.am | 78 +++++++++++++++++++ loc_api/libloc_api_50001/loc_eng.cpp | 7 +- loc_api/libloc_api_50001/loc_eng_ni.cpp | 2 - .../loc_pla/include/platform_lib_macros.h | 2 + .../loc_pla/include/platform_lib_time.h | 4 +- .../loc_pla/src/Makefile.am | 1 + .../loc_stub/src/Makefile.am | 1 + utils/LocTimer.h | 2 +- utils/Makefile.am | 15 +++- utils/MsgTask.cpp | 3 +- utils/loc_cfg.cpp | 2 +- utils/loc_misc_utils.cpp | 2 +- utils/loc_timer.h | 2 +- 20 files changed, 120 insertions(+), 25 deletions(-) create mode 100644 loc_api/libloc_api_50001/Makefile.am diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 8fdb8cbb..e9bec95c 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index dcd35fec..45d16e90 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include namespace loc_core { diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp index b5f33ac3..74b2903a 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include namespace loc_core { @@ -58,7 +59,11 @@ 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; diff --git a/core/Makefile.am b/core/Makefile.am index e2d05be4..341153ad 100644 --- a/core/Makefile.am +++ b/core/Makefile.am @@ -1,10 +1,11 @@ AM_CFLAGS = -I./ \ -I../utils \ $(LOCPLA_CFLAGS) \ + -I$(WORKSPACE)/gps-noship/flp \ + -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums libloc_core_la_h_sources = \ - MsgTask.h \ LocApiBase.h \ LocAdapterBase.h \ ContextBase.h \ @@ -13,10 +14,10 @@ libloc_core_la_h_sources = \ UlpProxyBase.h \ gps_extended_c.h \ gps_extended.h \ - loc_core_log.h + loc_core_log.h \ + LocAdapterProxyBase.h libloc_core_la_c_sources = \ - MsgTask.cpp \ LocApiBase.cpp \ LocAdapterBase.cpp \ ContextBase.cpp \ diff --git a/core/UlpProxyBase.h b/core/UlpProxyBase.h index 59e265e8..2bafb0ab 100644 --- a/core/UlpProxyBase.h +++ b/core/UlpProxyBase.h @@ -31,7 +31,6 @@ #include #include "fused_location_extended.h" - namespace loc_core { class LocAdapterBase; diff --git a/loc_api/Makefile.am b/loc_api/Makefile.am index d42d4d99..a5f529bd 100644 --- a/loc_api/Makefile.am +++ b/loc_api/Makefile.am @@ -5,6 +5,7 @@ AM_CFLAGS = \ -I../utils \ $(LOCPLA_CFLAGS) \ -fno-short-enums \ + -D__func__=__PRETTY_FUNCTION__ \ -DTARGET_USES_QCOM_BSP libloc_eng_so_la_h_sources = \ @@ -81,7 +82,8 @@ libloc_ds_api_la_LDFLAGS += -Wl,--export-dynamic libloc_ds_api_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) $(libloc_ds_api_CFLAGS) endif -libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la +libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices -ldsi_netctrl $(LOCPLA_LIBS) ../utils/libgps_utils_so.la +#libloc_ds_api_la_LIBADD = -lstdc++ $(QMIF_LIBS) -lqmiservices $(LOCPLA_LIBS) ../utils/libgps_utils_so.la libloc_api_v02_CFLAGS = \ $(QMIF_CFLAGS) \ diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 1d1a59ed..f3290dbd 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -339,9 +339,10 @@ void LocEngAdapter::requestPowerVote() LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp); setGpsLock(powerUp ? 103 : 101); } - +#ifndef USE_GLIB delete mUlp; mUlp = ulp; +#endif } void LocInternalAdapter::reportPosition(UlpLocation &location, diff --git a/loc_api/libloc_api_50001/Makefile.am b/loc_api/libloc_api_50001/Makefile.am new file mode 100644 index 00000000..c7624272 --- /dev/null +++ b/loc_api/libloc_api_50001/Makefile.am @@ -0,0 +1,78 @@ +AM_CFLAGS = \ + -I../../utils \ + -I../../platform_lib_abstractions \ + -I$(WORKSPACE)/gps-noship/flp \ + -fno-short-enums \ + -D__func__=__PRETTY_FUNCTION__ \ + -DFEATURE_GNSS_BIT_API + +libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp + +if USE_GLIB +libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) +libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif +libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la + + +libloc_eng_so_la_SOURCES = \ + loc_eng.cpp \ + loc_eng_agps.cpp \ + loc_eng_xtra.cpp \ + loc_eng_ni.cpp \ + loc_eng_log.cpp \ + loc_eng_dmn_conn.cpp \ + loc_eng_dmn_conn_handler.cpp \ + loc_eng_dmn_conn_thread_helper.c \ + loc_eng_dmn_conn_glue_msg.c \ + loc_eng_dmn_conn_glue_pipe.c + + +if USE_GLIB +libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) +libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la + + +libgps_default_so_la_SOURCES = \ + loc.cpp \ + gps.c + +if USE_GLIB +libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libgps_default_so_la_CFLAGS = $(AM_CFLAGS) +libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la + +library_include_HEADERS = \ + LocEngAdapter.h \ + loc.h \ + loc_eng.h \ + loc_eng_xtra.h \ + loc_eng_ni.h \ + loc_eng_agps.h \ + loc_eng_msg.h \ + loc_eng_log.h + +library_includedir = $(pkgincludedir)/libloc_api_50001 + +#Create and Install libraries +lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index de72aa8d..6aac28ba 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -46,12 +46,7 @@ #include #include #include -#if defined(USE_GLIB) && !defined(OFF_TARGET) -#include -#endif -#ifdef USE_GLIB -#include -#endif /* USE_GLIB */ + #include #include diff --git a/loc_api/libloc_api_50001/loc_eng_ni.cpp b/loc_api/libloc_api_50001/loc_eng_ni.cpp index 3b20bbbc..a29784fc 100644 --- a/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -235,8 +235,6 @@ static void* ni_thread_proc(void *args) LOC_LOGD("pSession->resp is %d\n",pSession->resp); - LOC_LOGD("loc_eng_ni_data_p->resp is %d\n",loc_eng_ni_data_p->resp); - // adding this check to support modem restart, in which case, we need the thread // to exit without calling sending data. We made sure that rawRequest is NULL in // loc_eng_ni_reset_on_engine_restart() diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h index 32035d28..c712122e 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h @@ -35,6 +35,8 @@ extern "C" { #ifdef USE_GLIB #include +#include +#include #ifndef OFF_TARGET #include #define strlcat g_strlcat diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h index c05b15ce..7033a7a1 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h +++ b/platform_lib_abstractions/loc_pla/include/platform_lib_time.h @@ -30,7 +30,9 @@ #define __PLATFORM_LIB_TIME_H__ #include - +#ifndef USE_GLIB +#include +#endif int64_t platform_lib_abstraction_elapsed_millis_since_boot(); #endif /* __PLATFORM_LIB_TIME_H__ */ diff --git a/platform_lib_abstractions/loc_pla/src/Makefile.am b/platform_lib_abstractions/loc_pla/src/Makefile.am index 3936837d..6ee0be70 100644 --- a/platform_lib_abstractions/loc_pla/src/Makefile.am +++ b/platform_lib_abstractions/loc_pla/src/Makefile.am @@ -1,6 +1,7 @@ AM_CFLAGS = \ $(LOCSTUB_CFLAGS) \ -I../include \ + -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums h_sources = \ diff --git a/platform_lib_abstractions/loc_stub/src/Makefile.am b/platform_lib_abstractions/loc_stub/src/Makefile.am index c8ab5fcb..8bda7113 100644 --- a/platform_lib_abstractions/loc_stub/src/Makefile.am +++ b/platform_lib_abstractions/loc_stub/src/Makefile.am @@ -1,5 +1,6 @@ AM_CFLAGS = \ -I../include \ + -D__func__=__PRETTY_FUNCTION__ \ -fno-short-enums libloc_stub_la_extra_h = \ diff --git a/utils/LocTimer.h b/utils/LocTimer.h index c1468524..c6a63620 100644 --- a/utils/LocTimer.h +++ b/utils/LocTimer.h @@ -31,7 +31,7 @@ #define __LOC_TIMER_CPP_H__ #include -#include +#include // opaque class to provide service implementation. class LocTimerDelegate; diff --git a/utils/Makefile.am b/utils/Makefile.am index 5e718439..50f10078 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -14,15 +14,24 @@ libgps_utils_so_la_h_sources = \ loc_cfg.h \ loc_log.h \ loc_target.h \ - loc_timer.h + loc_timer.h \ + MsgTask.h \ + LocHeap.h \ + LocThread.h \ + LocTimer.h \ + loc_misc_utils.h libgps_utils_so_la_c_sources = \ linked_list.c \ msg_q.c \ loc_cfg.cpp \ loc_log.cpp \ - loc_timer.c \ - loc_target.cpp + loc_target.cpp \ + LocHeap.cpp \ + LocTimer.cpp \ + LocThread.cpp \ + MsgTask.cpp \ + loc_misc_utils.cpp library_includedir = $(pkgincludedir)/utils diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp index f33d6024..78a3fe00 100644 --- a/utils/MsgTask.cpp +++ b/utils/MsgTask.cpp @@ -33,6 +33,7 @@ #include #include #include +#include static void LocMsgDestroy(void* msg) { delete (LocMsg*)msg; @@ -77,7 +78,7 @@ void MsgTask::sendMsg(const LocMsg* msg) const { void MsgTask::prerun() { // make sure we do not run in background scheduling group - set_sched_policy(gettid(), SP_FOREGROUND); + platform_lib_abstraction_set_sched_policy(platform_lib_abstraction_gettid(), PLA_SP_FOREGROUND); } bool MsgTask::run() { diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 967d2f30..926781a6 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #ifdef USE_GLIB #include diff --git a/utils/loc_misc_utils.cpp b/utils/loc_misc_utils.cpp index 7e96313f..dfe19a2d 100644 --- a/utils/loc_misc_utils.cpp +++ b/utils/loc_misc_utils.cpp @@ -28,7 +28,7 @@ */ #include #include -#include +#include #include #include diff --git a/utils/loc_timer.h b/utils/loc_timer.h index 2967858e..25fd1790 100644 --- a/utils/loc_timer.h +++ b/utils/loc_timer.h @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ #include - +#include /* user_data: client context pointer, passthrough. Originally received from calling client when loc_timer_start() is called.