diff options
Diffstat (limited to 'gps/loc_api')
52 files changed, 10669 insertions, 405 deletions
diff --git a/gps/loc_api/Android.mk b/gps/loc_api/Android.mk index ca5347d..8bfdd1b 100644 --- a/gps/loc_api/Android.mk +++ b/gps/loc_api/Android.mk @@ -1,19 +1,13 @@ -# -# Copyright (C) 2016 The CyanogenMod Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - LOCAL_PATH := $(call my-dir) -include $(call all-subdir-makefiles,$(LOCAL_PATH)) +# add RPC dirs if RPC is available +ifneq ($(TARGET_NO_RPC),true) + +GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api-rpc-50001/ + +endif #TARGET_NO_RPC + +GPS_DIR_LIST += $(LOCAL_PATH)/libloc_api_50001/ + +#call the subfolders +include $(addsuffix Android.mk, $(GPS_DIR_LIST)) diff --git a/gps/loc_api/Makefile.am b/gps/loc_api/Makefile.am new file mode 100644 index 0000000..a5f529b --- /dev/null +++ b/gps/loc_api/Makefile.am @@ -0,0 +1,133 @@ +AM_CFLAGS = \ + -I./ \ + -I../core \ + -I./libloc_api_50001 \ + -I../utils \ + $(LOCPLA_CFLAGS) \ + -fno-short-enums \ + -D__func__=__PRETTY_FUNCTION__ \ + -DTARGET_USES_QCOM_BSP + +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 \ + 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_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 \ + libloc_api_50001/loc_eng_dmn_conn_glue_msg.c \ + libloc_api_50001/loc_eng_dmn_conn_glue_pipe.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@ +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 -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 + +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++ -llog $(LOCPLA_LIBS) ../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 $(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) \ + -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 $(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 \ + 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_log.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_eng_so.la libgps_default_so.la libloc_ds_api.la libloc_api_v02.la diff --git a/gps/loc_api/libloc_api-rpc-50001/Android.mk b/gps/loc_api/libloc_api-rpc-50001/Android.mk new file mode 100644 index 0000000..6c5d533 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/Android.mk @@ -0,0 +1,3 @@ +ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50001) +include $(call all-subdir-makefiles) +endif diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk new file mode 100644 index 0000000..bb3d924 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Android.mk @@ -0,0 +1,60 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +RPC_INC:=rpc_inc + +source_files:= \ + src/loc_api_rpc_glue.c \ + src/loc_api_sync_call.c \ + src/loc_apicb_appinit.c \ + src/loc_api_fixup.c \ + src/loc_api_log.c \ + src/LocApiRpc.cpp + +LOCAL_SRC_FILES:= $(source_files) + +LOCAL_CFLAGS:=-fno-short-enums +LOCAL_CFLAGS+=-DDEBUG -DUSE_QCOM_AUTO_RPC -DUSE_QCOM_AUTO_RPC +LOCAL_CFLAGS+=$(GPS_FEATURES) + +# for loc_api_fixup.c +LOCAL_CFLAGS+=-DADD_XDR_FLOAT -DADD_XDR_BOOL + +LOCAL_SHARED_LIBRARIES:= \ + librpc \ + libutils \ + libcutils \ + libcommondefs \ + libgps.utils \ + libloc_core + +LOCAL_STATIC_LIBRARIES := \ + libloc_api_rpcgen + +LOCAL_PRELINK_MODULE:= false + +LOCAL_C_INCLUDES:= \ + $(LOCAL_PATH) \ + $(LOCAL_PATH)/rpc_inc \ + $(TARGET_OUT_HEADERS)/gps.utils \ + $(TARGET_OUT_HEADERS)/libloc_core \ + $(TARGET_OUT_HEADERS)/loc_api/rpcgen/inc \ + $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc \ + $(TARGET_OUT_HEADERS)/librpc \ + $(TARGET_OUT_HEADERS)/libloc-rpc/rpc_inc \ + $(TOP)/hardware/msm7k/librpc + +LOCAL_COPY_HEADERS_TO:= libloc_api-rpc-qc/$(RPC_INC) +LOCAL_COPY_HEADERS:= \ + $(RPC_INC)/loc_api_rpc_glue.h \ + $(RPC_INC)/loc_api_fixup.h \ + $(RPC_INC)/loc_api_sync_call.h \ + $(RPC_INC)/loc_apicb_appinit.h \ + $(RPC_INC)/LocApiRpc.h + +LOCAL_MODULE:= libloc_api-rpc-qc +LOCAL_MODULE_OWNER := qcom + +LOCAL_MODULE_TAGS := optional + +include $(BUILD_SHARED_LIBRARY) diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am new file mode 100644 index 0000000..f5c5136 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/Makefile.am @@ -0,0 +1,46 @@ +AM_CFLAGS = \ + -I../../../utils \ + -I../../../platform_lib_abstractions \ + -I./rpc_inc \ + -I../libloc_api-rpc-stub/inc \ + -I../../libloc_api_50001 \ + $(MSM7K_CFLAGS) \ + -DUSE_QCOM_AUTO_RPC + +requiredlibs = \ + ../../../utils/libgps_utils_so.la \ + $(MSM7K_LIBS) + +h_sources = \ + rpc_inc/loc_api_rpc_glue.h \ + rpc_inc/loc_api_fixup.h \ + rpc_inc/loc_api_sync_call.h \ + rpc_inc/loc_apicb_appinit.h \ + +c_sources = \ + src/loc_api_rpc_glue.c \ + src/loc_api_sync_call.c \ + src/loc_apicb_appinit.c \ + src/loc_api_fixup.c \ + src/loc_api_log.c \ + src/LocApiRpcAdapter.cpp \ + + +library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc +library_include_HEADERS = $(h_sources) +libloc_api_rpc_qc_la_SOURCES = $(c_sources) $(h_sources) + +if USE_GLIB +libloc_api_rpc_qc_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_api_rpc_qc_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_api_rpc_qc_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_api_rpc_qc_la_CFLAGS = $(AM_CFLAGS) +libloc_api_rpc_qc_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_api_rpc_qc_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_api_rpc_qc_la_LIBADD = $(requiredlibs) -lstdc++ + +#Create and Install Libraries +lib_LTLIBRARIES = libloc_api_rpc_qc.la diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h new file mode 100644 index 0000000..13557c9 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/LocApiRpc.h @@ -0,0 +1,142 @@ +/* Copyright (c) 2011,2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef LOC_API_RPC_H +#define LOC_API_RPC_H + +#include <rpc/rpc.h> +#include <loc_api_rpcgen_common_rpc.h> +#include <loc_api_rpc_glue.h> +#include <LocApiBase.h> +#include <loc_log.h> + +using namespace loc_core; + +class LocApiRpc : public LocApiBase { +protected: + // RPC communication establishment + rpc_loc_client_handle_type client_handle; + +private: + int dataEnableLastSet; + char apnLastSet[MAX_APN_LEN]; + + static const LOC_API_ADAPTER_EVENT_MASK_T maskAll; + static const rpc_loc_event_mask_type locBits[]; + static rpc_loc_event_mask_type convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask); + static rpc_loc_lock_e_type convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask); + static enum loc_api_adapter_err convertErr(int rpcErr); + static GpsNiEncodingType convertNiEncodingType(int loc_encoding); + static int NIEventFillVerfiyType(GpsNiNotification ¬if, + rpc_loc_ni_notify_verify_e_type notif_priv); + + void reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr); + void reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr); + void reportStatus(const rpc_loc_status_event_s_type *status_report_ptr); + void reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr); + void ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr); + void NIEvent(const rpc_loc_ni_event_s_type *ni_req_ptr); + +protected: + virtual enum loc_api_adapter_err + open(LOC_API_ADAPTER_EVENT_MASK_T mask); + virtual enum loc_api_adapter_err + close(); + LocApiRpc(const MsgTask* msgTask, + LOC_API_ADAPTER_EVENT_MASK_T exMask); + +public: + static LocApiRpc* createLocApiRpc(const MsgTask* msgTask, + LOC_API_ADAPTER_EVENT_MASK_T exMask); + ~LocApiRpc(); + + virtual int locEventCB(rpc_loc_client_handle_type client_handle, + rpc_loc_event_mask_type loc_event, + const rpc_loc_event_payload_u_type* loc_event_payload); + + void locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event); + + // RPC adapter interface implementations + virtual enum loc_api_adapter_err + startFix(const LocPosMode& posMode); + virtual enum loc_api_adapter_err + stopFix(); + virtual enum loc_api_adapter_err + setPositionMode(const LocPosMode& mode); + inline virtual enum loc_api_adapter_err + enableData(int enable) { return enableData(enable, false); } + virtual enum loc_api_adapter_err + enableData(int enable, boolean force); + virtual enum loc_api_adapter_err + setTime(GpsUtcTime time, int64_t timeReference, int uncertainty); + virtual enum loc_api_adapter_err + injectPosition(double latitude, double longitude, float accuracy); + virtual enum loc_api_adapter_err + deleteAidingData(GpsAidingData f); + virtual enum loc_api_adapter_err + informNiResponse(GpsUserResponseType userResponse, const void* passThroughData); + inline virtual enum loc_api_adapter_err + setAPN(char* apn, int len) { return setAPN(apn, len, false); } + virtual enum loc_api_adapter_err + setAPN(char* apn, int len, boolean force); + virtual enum loc_api_adapter_err + setServer(const char* url, int len); + virtual enum loc_api_adapter_err + setServer(unsigned int ip, int port, LocServerType type); + virtual enum loc_api_adapter_err + setXtraData(char* data, int length); + virtual enum loc_api_adapter_err + requestXtraServer(); + virtual enum loc_api_adapter_err + atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bear, AGpsType agpsType); + virtual enum loc_api_adapter_err + atlCloseStatus(int handle, int is_succ); + virtual enum loc_api_adapter_err + setSUPLVersion(uint32_t version); + virtual void setInSession(bool inSession); + + /*Values for lock + 1 = Do not lock any position sessions + 2 = Lock MI position sessions + 3 = Lock MT position sessions + 4 = Lock all position sessions + */ + virtual int setGpsLock(LOC_GPS_LOCK_MASK lock); + /* + Returns + Current value of GPS Lock on success + -1 on failure + */ + virtual int getGpsLock(void); +}; + +extern "C" LocApiBase* getLocApi(const MsgTask* msgTask, + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase *context); + +#endif //LOC_API_RPC_H diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h new file mode 100644 index 0000000..49a6d0b --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/debug.h @@ -0,0 +1,69 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DEBUG_H +#define DEBUG_H + +#include <stdio.h> + +#define LOG_TAG "LocSvc_rpc" +#include <utils/Log.h> + +#define PRINT(x...) do { \ + fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \ + fprintf(stdout, ##x); \ + ALOGD(x); \ + } while(0) + +#ifdef DEBUG +#define D PRINT +#else +#define D(x...) do { } while(0) +#endif + +#ifdef VERBOSE +#define V PRINT +#else +#define V(x...) do { } while(0) +#endif + +#define E(x...) do { \ + fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \ + fprintf(stderr, ##x); \ + ALOGE(x); \ + } while(0) + +#define FAILIF(cond, msg...) do { \ + if (__builtin_expect (cond, 0)) { \ + fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \ + fprintf(stderr, ##msg); \ + ALOGE(##msg); \ + } \ + } while(0) + +#endif/*DEBUG_H*/ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h new file mode 100644 index 0000000..c483b4a --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_fixup.h @@ -0,0 +1,226 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LOC_API_FIXUP_H +#define LOC_API_FIXUP_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef NULLPROC +#define NULLPROC 0 +#endif /* NULLPROC */ + +#ifdef ADD_XDR_FLOAT + +extern bool_t xdr_float (XDR *__xdrs, float *__fp); +extern bool_t xdr_double (XDR *__xdrs, double *__dp); + +#endif /* ADD_XDR_FLOAT */ + +#ifdef ADD_XDR_BOOL +extern bool_t xdr_bool(XDR *__xdrs, int *__bp); +#endif /* ADD_XDR_BOOL */ + +#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1 +#define RPC_LOC_API_MINOR_VERSION_NUMBER 0 + +// Return value for loc_open in case of failure. +#define RPC_LOC_CLIENT_HANDLE_INVALID -1 + +// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl +// These are also the status for the ioctl callback +#define RPC_LOC_API_SUCCESS 0 +#define RPC_LOC_API_GENERAL_FAILURE 1 +#define RPC_LOC_API_UNSUPPORTED 2 +#define RPC_LOC_API_INVALID_HANDLE 4 +#define RPC_LOC_API_INVALID_PARAMETER 5 +#define RPC_LOC_API_ENGINE_BUSY 6 +#define RPC_LOC_API_PHONE_OFFLINE 7 +#define RPC_LOC_API_TIMEOUT 8 + +// Special return value for loc api calls in case of RPC failure +#define RPC_LOC_API_RPC_FAILURE (-1234) +// Special return value for modem restart incurred RPC failure +#define RPC_LOC_API_RPC_MODEM_RESTART (-1235) + +#define RPC_LOC_API_MAX_SV_COUNT 80 +#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200 + +// Maximum server address that will be used in location API +#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256 +#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3 +#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3 + +#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type +#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report +#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate +#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate +#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request +#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request +#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server +#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl +#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state + +#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001 +#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002 +#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004 +#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008 +#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010 +#define RPC_LOC_POS_VALID_LATITUDE 0x00000020 +#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040 +#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080 +#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100 +#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200 +#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400 +#define RPC_LOC_POS_VALID_HEADING 0x00000800 +#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000 +#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000 +#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000 +#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000 +#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000 +#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000 +#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000 +#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000 +#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000 + +#define RPC_LOC_POS_TECH_SATELLITE 0x00000001 +#define RPC_LOC_POS_TECH_CELLID 0x00000002 +#define RPC_LOC_POS_TECH_WIFI 0x00000004 + +#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001 +#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002 +#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004 +#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008 +#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010 +#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020 +#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040 +#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080 +#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100 + +#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001 +#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002 +#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004 +#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008 +#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010 +#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020 + +#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200 +#define RPC_LOC_NI_SUPL_HASH_LENGTH 8 +#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4 +#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64 +#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20 +#define RPC_LOC_NI_CODEWORD_LENGTH 20 + +#define RPC_LOC_NI_SUPL_QOP_VALID 0x01 +#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02 +#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04 +#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08 + +#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004 +#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008 +#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010 +#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020 +#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040 +#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080 +#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100 + +#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001 +#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002 +#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004 +#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008 +#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010 +#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020 +#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040 +#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080 +#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100 +#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_AGE 0x00000200 + +#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF + +#define RPC_LOC_NMEA_MASK_ALL 0xffff +#define RPC_LOC_NMEA_MASK_GGA 0x0001 +#define RPC_LOC_NMEA_MASK_RMC 0x0002 +#define RPC_LOC_NMEA_MASK_GSV 0x0004 +#define RPC_LOC_NMEA_MASK_GSA 0x0008 +#define RPC_LOC_NMEA_MASK_VTG 0x0010 + +/* EFS data access */ +#define RPC_LOC_EFS_MAX_PATH_LEN_BYTES 64 /* Max file name length in bytes that can be written*/ +#define RPC_LOC_EFS_MAX_FILE_LEN_BYTES 2000 /* Max file size in bytes that can be written */ + +/* WIPER valid information flag in log report */ +#define RPC_LOC_WIPER_LOG_TIME_VALID 0x01 +#define RPC_LOC_WIPER_LOG_POS_VALID 0x02 +#define RPC_LOC_WIPER_LOG_AP_SET_VALID 0x04 + +/* General WIPER defines */ +#define RPC_LOC_WIPER_MAC_ADDR_LENGTH 6 // Do not change this number since it affects RPC and log packet sizes +#define RPC_LOC_WIPER_MAX_REPORTED_APS_PER_LOG_MSG 50 // Do not change this number since it affects RPC and log packet sizes + +/* WIPER AP Qualifier */ +#define RPC_LOC_WIPER_AP_QUALIFIER_BEING_USED 0x1 /* AP is being used by WPS */ +#define RPC_LOC_WIPER_AP_QUALIFIER_HIDDEN_SSID 0x2 /* AP does not broadcast SSID */ +#define RPC_LOC_WIPER_AP_QUALIFIER_PRIVATE 0x4 /* AP has encryption turned on */ +#define RPC_LOC_WIPER_AP_QUALIFIER_INFRASTRUCTURE_MODE 0x8 /* AP is in infrastructure mode and not in ad-hoc/unknown mode */ + +/* flags for notification */ +#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001 +#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002 +#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010 +#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020 +#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040 +#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080 +#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100 + +/* below are for RPC_LOC_IOCTL_SET_LBS_APN_PROFILE data */ +/* values for apn_profiles[0].srv_system_type */ +#define LOC_APN_PROFILE_SRV_SYS_CDMA 0x01 +#define LOC_APN_PROFILE_SRV_SYS_HDR 0x02 +#define LOC_APN_PROFILE_SRV_SYS_GSM 0x04 +#define LOC_APN_PROFILE_SRV_SYS_WCDMA 0x08 +#define LOC_APN_PROFILE_SRV_SYS_LTE 0x10 +#define LOC_APN_PROFILE_SRV_SYS_MAX 0x1F +/* values for apn_profiles[0].pdp_type */ +#define LOC_APN_PROFILE_PDN_TYPE_IPV4 0x01 +#define LOC_APN_PROFILE_PDN_TYPE_IPV6 0x02 +#define LOC_APN_PROFILE_PDN_TYPE_IPV4V6 0x03 +#define LOC_APN_PROFILE_PDN_TYPE_PPP 0x04 +#define LOC_APN_PROFILE_PDN_TYPE_MAX 0x04 + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_FIXUP_H */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h new file mode 100644 index 0000000..f037428 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_log.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2011 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef LOC_API_LOG_H +#define LOC_API_LOG_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#include <ctype.h> +#include "loc_api_rpcgen_common_rpc.h" + +extern int loc_callback_log( + rpc_loc_event_mask_type loc_event, /* event mask */ + const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ +); + +extern const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open); +extern const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask); +extern const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type); +extern const char* loc_get_ioctl_status_name(uint32 status); +extern const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status); +extern const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state); +extern const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state); +extern const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_LOG_H */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h new file mode 100644 index 0000000..6df33ae --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_rpc_glue.h @@ -0,0 +1,123 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LOC_API_RPC_GLUE_H +#define LOC_API_RPC_GLUE_H + +/* Include RPC headers */ +#ifdef USE_LOCAL_RPC +#include "rpc_inc/loc_api_common.h" +#include "rpc_inc/loc_api.h" +#include "rpc_inc/loc_api_cb.h" +#endif + +#ifdef USE_QCOM_AUTO_RPC +#include "loc_api_rpcgen_rpc.h" +#include "loc_api_rpcgen_common_rpc.h" +#include "loc_api_rpcgen_cb_rpc.h" +#endif + +/* Boolean */ +/* Other data types in comdef.h are defined in rpc stubs, so fix it here */ +typedef unsigned char boolean; +#define TRUE 1 +#define FALSE 0 + +#include "loc_api_fixup.h" +#include "loc_api_sync_call.h" +#include <rpc/clnt.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern int loc_api_glue_init(void); +extern int loc_api_null(void); + +typedef int32 (loc_event_cb_f_type)( + void* userData, + rpc_loc_client_handle_type loc_handle, /* handle of the client */ + rpc_loc_event_mask_type loc_event, /* event mask */ + const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ +); + +typedef void (loc_reset_notif_cb_f_type)( + void* userData, + CLIENT* clnt, + enum rpc_reset_event event +); + +extern rpc_loc_client_handle_type loc_open( + rpc_loc_event_mask_type event_reg_mask, + loc_event_cb_f_type *event_callback, + loc_reset_notif_cb_f_type *rpc_global_cb, + void* userData +); + +extern int32 loc_close +( + rpc_loc_client_handle_type handle +); + +extern void loc_clear +( + rpc_loc_client_handle_type handle +); + +extern int32 loc_start_fix +( + rpc_loc_client_handle_type handle +); + +extern int32 loc_stop_fix +( + rpc_loc_client_handle_type handle +); + +extern int32 loc_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data +); + +extern int loc_eng_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data_ptr, + uint32 timeout_msec, + rpc_loc_ioctl_callback_s_type *cb_data_ptr +); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_RPC_GLUE_H */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h new file mode 100644 index 0000000..43208bd --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_api_sync_call.h @@ -0,0 +1,90 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LOC_API_CB_SYNC_H +#define LOC_API_CB_SYNC_H + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "loc_api_rpc_glue.h" +#define LOC_SYNC_CALL_SLOTS_MAX 8 + +typedef struct { + pthread_mutex_t lock; + + /* Client ID */ + rpc_loc_client_handle_type loc_handle; + + /* Callback waiting conditional variable */ + pthread_cond_t loc_cb_arrived_cond; + + /* Callback waiting data block, protected by loc_cb_data_mutex */ + boolean in_use; + boolean signal_sent; + boolean not_available; + rpc_loc_event_mask_type loc_cb_wait_event_mask; /* event to wait for */ + rpc_loc_ioctl_e_type ioctl_type; /* ioctl to wait for */ + rpc_loc_event_payload_u_type loc_cb_received_payload; /* received payload */ + rpc_loc_event_mask_type loc_cb_received_event_mask; /* received event */ +} loc_sync_call_slot_s_type; + +typedef struct { + int num_of_slots; + loc_sync_call_slot_s_type slots[LOC_SYNC_CALL_SLOTS_MAX]; +} loc_sync_call_slot_array_s_type; + +/* Init function */ +void loc_api_sync_call_init(); + +/* Destroy function */ +void loc_api_sync_call_destroy(); + +/* Process Loc API callbacks to wake up blocked user threads */ +void loc_api_callback_process_sync_call( + rpc_loc_client_handle_type loc_handle, /* handle of the client */ + rpc_loc_event_mask_type loc_event, /* event mask */ + const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ +); + +/* Reentrant synchronous IOCTL call, using Loc API return code */ +int loc_api_sync_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data_ptr, + uint32 timeout_msec, + rpc_loc_ioctl_callback_s_type *cb_data_ptr +); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_API_CB_SYNC_H */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h new file mode 100644 index 0000000..ba41d08 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/rpc_inc/loc_apicb_appinit.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LOC_APICB_APPINIT_H +#define LOC_APICB_APPINIT_H + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Initialization function for callbacks */ +extern int loc_apicb_app_init(); +extern void loc_apicb_app_deinit(); + +#ifdef __cplusplus +} +#endif + +#endif /* LOC_APICB_APPINIT_H */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp new file mode 100644 index 0000000..f4b0ebf --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/LocApiRpc.cpp @@ -0,0 +1,1475 @@ +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#define LOG_NDDEBUG 0 +#define LOG_TAG "LocSvc_api_rpc" + +#include <unistd.h> +#include <math.h> +#ifndef USE_GLIB +#include <utils/SystemClock.h> +#endif /* USE_GLIB */ +#include <LocApiRpc.h> +#include <LocAdapterBase.h> +#include <loc_api_fixup.h> +#include <loc_api_rpc_glue.h> +#include <loc_log.h> +#include <loc_api_log.h> +#ifdef USE_GLIB +#include <glib.h> +#endif +#include <librpc.h> +#include <platform_lib_includes.h> + +using namespace loc_core; + +#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100) +#define XTRA_BLOCK_SIZE (3072) +#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds +#define LOC_NI_NOTIF_KEY_ADDRESS "Address" + +/*=========================================================================== +FUNCTION loc_event_cb + +DESCRIPTION + This is the callback function registered by loc_open. + +DEPENDENCIES + N/A + +RETURN VALUE + RPC_LOC_API_SUCCESS + +SIDE EFFECTS + N/A + +===========================================================================*/ +static int32 loc_event_cb +( + void* user, + rpc_loc_client_handle_type client_handle, + rpc_loc_event_mask_type loc_event, + const rpc_loc_event_payload_u_type* loc_event_payload +) +{ + MODEM_LOG_CALLFLOW(%s, loc_get_event_name(loc_event)); + loc_callback_log(loc_event, loc_event_payload); + int32 ret_val = ((LocApiRpc*)user)->locEventCB(client_handle, loc_event, loc_event_payload); + EXIT_LOG(%d, ret_val); + return ret_val; +} + +/*=========================================================================== +FUNCTION loc_eng_rpc_global_cb + +DESCRIPTION + This is the callback function registered by loc_open for RPC global events + +DEPENDENCIES + N/A + +RETURN VALUE + RPC_LOC_API_SUCCESS + +SIDE EFFECTS + N/A + +===========================================================================*/ +static void loc_rpc_global_cb(void* user, CLIENT* clnt, enum rpc_reset_event event) +{ + MODEM_LOG_CALLFLOW(%s, loc_get_rpc_reset_event_name(event)); + ((LocApiRpc*)user)->locRpcGlobalCB(clnt, event); + EXIT_LOG(%p, VOID_RET); +} + +const LOC_API_ADAPTER_EVENT_MASK_T LocApiRpc::maskAll = + LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT | + LOC_API_ADAPTER_BIT_SATELLITE_REPORT | + LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | + LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | + LOC_API_ADAPTER_BIT_IOCTL_REPORT | + LOC_API_ADAPTER_BIT_STATUS_REPORT | + LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT | + LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; + +const rpc_loc_event_mask_type LocApiRpc::locBits[] = +{ + RPC_LOC_EVENT_PARSED_POSITION_REPORT, + RPC_LOC_EVENT_SATELLITE_REPORT, + RPC_LOC_EVENT_NMEA_1HZ_REPORT, + RPC_LOC_EVENT_NMEA_POSITION_REPORT, + RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST, + RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST, + RPC_LOC_EVENT_LOCATION_SERVER_REQUEST, + RPC_LOC_EVENT_IOCTL_REPORT, + RPC_LOC_EVENT_STATUS_REPORT, + RPC_LOC_EVENT_WPS_NEEDED_REQUEST +}; + +LocApiRpc* +LocApiRpc::createLocApiRpc(const MsgTask* msgTask, + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase* context) +{ + if (NULL == msgTask) { + return NULL; + } + return new LocApiRpc(msgTask, exMask, context); +} + +// constructor +LocApiRpc::LocApiRpc(const MsgTask* msgTask, + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase* context) : + LocApiBase(msgTask, exMask, context), + client_handle(RPC_LOC_CLIENT_HANDLE_INVALID), + dataEnableLastSet(-1) +{ + memset(apnLastSet, 0, sizeof(apnLastSet)); + loc_api_glue_init(); +} + +LocApiRpc::~LocApiRpc() +{ + close(); +} + +rpc_loc_event_mask_type +LocApiRpc::convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask) +{ + rpc_loc_event_mask_type newMask = 0; + + for (unsigned int i = 0, bit=1; 0 != mask; i++, bit<<=1) { + if (mask & bit) { + newMask |= locBits[i]; + mask ^= bit; + } + } + + return newMask; +} + +rpc_loc_lock_e_type +LocApiRpc::convertGpsLockMask(LOC_GPS_LOCK_MASK lockMask) +{ + if (isGpsLockAll(lockMask)) + return RPC_LOC_LOCK_ALL; + if (isGpsLockMO(lockMask)) + return RPC_LOC_LOCK_MI; + if (isGpsLockMT(lockMask)) + return RPC_LOC_LOCK_MT; + if (isGpsLockNone(lockMask)) + return RPC_LOC_LOCK_NONE; + return (rpc_loc_lock_e_type)lockMask; +} + +enum loc_api_adapter_err +LocApiRpc::convertErr(int rpcErr) +{ + switch(rpcErr) + { + case RPC_LOC_API_SUCCESS: + return LOC_API_ADAPTER_ERR_SUCCESS; + case RPC_LOC_API_GENERAL_FAILURE: + return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; + case RPC_LOC_API_UNSUPPORTED: + return LOC_API_ADAPTER_ERR_UNSUPPORTED; + case RPC_LOC_API_INVALID_HANDLE: + return LOC_API_ADAPTER_ERR_INVALID_HANDLE; + case RPC_LOC_API_INVALID_PARAMETER: + return LOC_API_ADAPTER_ERR_INVALID_PARAMETER; + case RPC_LOC_API_ENGINE_BUSY: + return LOC_API_ADAPTER_ERR_ENGINE_BUSY; + case RPC_LOC_API_PHONE_OFFLINE: + return LOC_API_ADAPTER_ERR_PHONE_OFFLINE; + case RPC_LOC_API_TIMEOUT: + return LOC_API_ADAPTER_ERR_TIMEOUT; + case RPC_LOC_API_RPC_MODEM_RESTART: + return LOC_API_ADAPTER_ERR_ENGINE_DOWN; + case RPC_LOC_API_RPC_FAILURE: + return LOC_API_ADAPTER_ERR_FAILURE; + default: + return LOC_API_ADAPTER_ERR_UNKNOWN; + } +} + +void LocApiRpc::locRpcGlobalCB(CLIENT* clnt, enum rpc_reset_event event) +{ + static rpc_loc_engine_state_e_type last_state = RPC_LOC_ENGINE_STATE_MAX; + + switch (event) { + case RPC_SUBSYSTEM_RESTART_BEGIN: + if (RPC_LOC_ENGINE_STATE_OFF != last_state) { + last_state = RPC_LOC_ENGINE_STATE_OFF; + handleEngineDownEvent(); + } + break; + case RPC_SUBSYSTEM_RESTART_END: + if (RPC_LOC_ENGINE_STATE_ON != last_state) { + last_state = RPC_LOC_ENGINE_STATE_ON; + handleEngineUpEvent(); + } + break; + } +} + +int32 LocApiRpc::locEventCB(rpc_loc_client_handle_type client_handle, + rpc_loc_event_mask_type loc_event, + const rpc_loc_event_payload_u_type* loc_event_payload) +{ + // Parsed report + if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT) + { + reportPosition(&loc_event_payload->rpc_loc_event_payload_u_type_u. + parsed_location_report); + } + + // Satellite report + if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT) + { + reportSv(&loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report); + } + + // Status report + if (loc_event & RPC_LOC_EVENT_STATUS_REPORT) + { + reportStatus(&loc_event_payload->rpc_loc_event_payload_u_type_u.status_report); + } + + // NMEA + if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT) + { + reportNmea(&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report)); + } + // XTRA support: supports only XTRA download + if (loc_event & RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST) + { + if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event == + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ) + { + requestXtraData(); + } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event == + RPC_LOC_ASSIST_DATA_TIME_REQ) + { + requestTime(); + } else if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event == + RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ) + { + requestLocation(); + } + } + + // AGPS data request + if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST) + { + ATLEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u. + loc_server_request); + } + + // NI notify request + if (loc_event & RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST) + { + NIEvent(&loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request); + } + + return RPC_LOC_API_SUCCESS;//We simply want to return sucess here as we do not want to + // cause any issues in RPC thread context +} + +enum loc_api_adapter_err +LocApiRpc::open(LOC_API_ADAPTER_EVENT_MASK_T mask) +{ + enum loc_api_adapter_err ret_val = LOC_API_ADAPTER_ERR_SUCCESS; + + // RPC does not dynamically update the event mask. And in the + // case of RPC, all we support are positioning (gps + agps) + // masks anyways, so we simply mask all of them on always. + // After doing so the first time in a power cycle, we know there + // will the following if condition will never be true any more. + mask = maskAll; + + if (mask != mMask) { + if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) { + close(); + } + + mMask = mask; + // it is important to cap the mask here, because not all LocApi's + // can enable the same bits, e.g. foreground and bckground. + client_handle = loc_open(convertMask(mask), + loc_event_cb, + loc_rpc_global_cb, this); + + if (client_handle < 0) { + mMask = 0; + client_handle = RPC_LOC_CLIENT_HANDLE_INVALID; + ret_val = LOC_API_ADAPTER_ERR_INVALID_HANDLE; + } + } + + return ret_val; +} + +enum loc_api_adapter_err +LocApiRpc::close() +{ + if (RPC_LOC_CLIENT_HANDLE_INVALID != client_handle) { + loc_clear(client_handle); + } + + loc_close(client_handle); + mMask = 0; + client_handle = RPC_LOC_CLIENT_HANDLE_INVALID; + + return LOC_API_ADAPTER_ERR_SUCCESS; +} + +enum loc_api_adapter_err +LocApiRpc::startFix(const LocPosMode& posMode) { + LOC_LOGD("LocApiRpc::startFix() called"); + return convertErr( + loc_start_fix(client_handle) + ); +} + +enum loc_api_adapter_err +LocApiRpc::stopFix() { + LOC_LOGD("LocApiRpc::stopFix() called"); + return convertErr( + loc_stop_fix(client_handle) + ); +} + +enum loc_api_adapter_err +LocApiRpc::setPositionMode(const LocPosMode& posMode) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_fix_criteria_s_type *fix_criteria_ptr = + &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria; + rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA; + rpc_loc_operation_mode_e_type op_mode; + int ret_val; + const LocPosMode* fixCriteria = &posMode; + + ALOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n", + (int32) client_handle, fixCriteria->min_interval, fixCriteria->mode); + + switch (fixCriteria->mode) + { + case LOC_POSITION_MODE_MS_BASED: + op_mode = RPC_LOC_OPER_MODE_MSB; + break; + case LOC_POSITION_MODE_MS_ASSISTED: + op_mode = RPC_LOC_OPER_MODE_MSA; + break; + case LOC_POSITION_MODE_RESERVED_1: + op_mode = RPC_LOC_OPER_MODE_SPEED_OPTIMAL; + break; + case LOC_POSITION_MODE_RESERVED_2: + op_mode = RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL; + break; + case LOC_POSITION_MODE_RESERVED_3: + op_mode = RPC_LOC_OPER_MODE_DATA_OPTIMAL; + break; + case LOC_POSITION_MODE_RESERVED_4: + case LOC_POSITION_MODE_RESERVED_5: + op_mode = RPC_LOC_OPER_MODE_MSA; + fix_criteria_ptr->preferred_response_time = 0; + break; + default: + op_mode = RPC_LOC_OPER_MODE_STANDALONE; + } + + fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE | + RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE; + fix_criteria_ptr->min_interval = fixCriteria->min_interval; + fix_criteria_ptr->preferred_operation_mode = op_mode; + + fix_criteria_ptr->min_interval = fixCriteria->min_interval; + fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL; + + if (fixCriteria->preferred_accuracy > 0) { + fix_criteria_ptr->preferred_accuracy = fixCriteria->preferred_accuracy; + fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY; + } + if (fixCriteria->preferred_time > 0) { + fix_criteria_ptr->preferred_response_time = fixCriteria->preferred_time; + fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME; + } + + switch (fixCriteria->recurrence) { + case GPS_POSITION_RECURRENCE_SINGLE: + fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX; + break; + case GPS_POSITION_RECURRENCE_PERIODIC: + default: + fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX; + break; + } + ioctl_data.disc = ioctl_type; + + ret_val = loc_eng_ioctl (client_handle, + ioctl_type, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/); + + return convertErr(ret_val); +} + +enum loc_api_adapter_err +LocApiRpc::setTime(GpsUtcTime time, int64_t timeReference, int uncertainty) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_assist_data_time_s_type *time_info_ptr; + rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_UTC_TIME; + int ret_val; + + LOC_LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty); + + time_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_time; + time_info_ptr->time_utc = time; + time_info_ptr->time_utc += (int64_t)(ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION - timeReference); + time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms + + ioctl_data.disc = ioctl_type; + + ret_val = loc_eng_ioctl (client_handle, + ioctl_type, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/); + + return convertErr(ret_val); +} + +enum loc_api_adapter_err +LocApiRpc::injectPosition(double latitude, double longitude, float accuracy) +{ + /* IOCTL data */ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_assist_data_pos_s_type *assistance_data_position = + &ioctl_data.rpc_loc_ioctl_data_u_type_u.assistance_data_position; + int ret_val; + + /************************************************ + * Fill in latitude, longitude & accuracy + ************************************************/ + + /* This combo is required */ + assistance_data_position->valid_mask = + RPC_LOC_ASSIST_POS_VALID_LATITUDE | + RPC_LOC_ASSIST_POS_VALID_LONGITUDE | + RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR | + RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL; + + assistance_data_position->latitude = latitude; + assistance_data_position->longitude = longitude; + assistance_data_position->hor_unc_circular = accuracy; /* Meters assumed */ + assistance_data_position->confidence_horizontal = 63; /* 63% (1 std dev) assumed */ + + /* Log */ + LOC_LOGD("Inject coarse position Lat=%lf, Lon=%lf, Acc=%.2lf\n", + (double) assistance_data_position->latitude, + (double) assistance_data_position->longitude, + (double) assistance_data_position->hor_unc_circular); + + ret_val = loc_eng_ioctl( client_handle, + RPC_LOC_IOCTL_INJECT_POSITION, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/); + return convertErr(ret_val); +} + +enum loc_api_adapter_err +LocApiRpc::informNiResponse(GpsUserResponseType userResponse, + const void* passThroughData) +{ + rpc_loc_ioctl_data_u_type data; + rpc_loc_ioctl_callback_s_type callback_payload; + + memcpy(&data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.ni_event_pass_back, + passThroughData, sizeof (rpc_loc_ni_event_s_type)); + + rpc_loc_ni_user_resp_e_type resp; + switch (userResponse) + { + case GPS_NI_RESPONSE_ACCEPT: + data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp = + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT; + break; + case GPS_NI_RESPONSE_DENY: + data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp = + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY; + break; + case GPS_NI_RESPONSE_NORESP: + default: + data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp = + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP; + break; + } + + return convertErr( + loc_eng_ioctl(client_handle, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE, + &data, + LOC_IOCTL_DEFAULT_TIMEOUT, + &callback_payload) + ); +} + +enum loc_api_adapter_err +LocApiRpc::setAPN(char* apn, int len, boolean force) +{ + enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS; + int size = sizeof(apnLastSet); + if (force || memcmp(apnLastSet, apn, size)) { + if (len < size) { + // size will be not larger than its original value + size = len + 1; + } + memcpy(apnLastSet, apn, size); + + if (!isInSession()) { + rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, {0}}; + ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].srv_system_type = LOC_APN_PROFILE_SRV_SYS_MAX; + ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].pdp_type = LOC_APN_PROFILE_PDN_TYPE_IPV4; + memcpy(&(ioctl_data.rpc_loc_ioctl_data_u_type_u.apn_profiles[0].apn_name), apn, size); + + rtv = convertErr( + loc_eng_ioctl (client_handle, + RPC_LOC_IOCTL_SET_LBS_APN_PROFILE, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL) + ); + } + } + return rtv; +} + +void LocApiRpc::setInSession(bool inSession) +{ + if (!inSession) { + enableData(dataEnableLastSet, true); + setAPN(apnLastSet, sizeof(apnLastSet)-1, true); + } +} + +enum loc_api_adapter_err +LocApiRpc::setServer(const char* url, int len) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_server_info_s_type *server_info_ptr; + rpc_loc_ioctl_e_type ioctl_cmd; + + ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR; + ioctl_data.disc = ioctl_cmd; + server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr; + server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL; + server_info_ptr->addr_info.disc = server_info_ptr->addr_type; + server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = len; +#if (AMSS_VERSION==3200) + server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = (char*) url; + server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len= len; +#else + strlcpy(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr, url, + sizeof server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr); +#endif /* #if (AMSS_VERSION==3200) */ + LOC_LOGD ("loc_eng_set_server, addr = %s\n", url); + + return convertErr( + loc_eng_ioctl (client_handle, + ioctl_cmd, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/) + ); +} + +enum loc_api_adapter_err +LocApiRpc::setServer(unsigned int ip, int port, LocServerType type) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_server_info_s_type *server_info_ptr; + rpc_loc_ioctl_e_type ioctl_cmd; + + switch (type) { + case LOC_AGPS_MPC_SERVER: + ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR; + break; + case LOC_AGPS_CUSTOM_PDE_SERVER: + ioctl_cmd = RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR; + break; + default: + ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR; + break; + } + ioctl_data.disc = ioctl_cmd; + server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr; + server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_IPV4; + server_info_ptr->addr_info.disc = server_info_ptr->addr_type; + server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr = ip; + server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port; + LOC_LOGD ("setServer, addr = %X:%d\n", (unsigned int) ip, (unsigned int) port); + + return convertErr( + loc_eng_ioctl (client_handle, + ioctl_cmd, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/) + ); +} + +enum loc_api_adapter_err +LocApiRpc::enableData(int enable, boolean force) +{ + enum loc_api_adapter_err rtv = LOC_API_ADAPTER_ERR_SUCCESS; + if (force || dataEnableLastSet != enable) { + dataEnableLastSet = enable; + + if (!isInSession()) { + rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_DATA_ENABLE, {0}}; + + ioctl_data.rpc_loc_ioctl_data_u_type_u.data_enable = enable; + rtv = convertErr( + loc_eng_ioctl (client_handle, + RPC_LOC_IOCTL_SET_DATA_ENABLE, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL) + ); + } + } + return rtv; +} + +enum loc_api_adapter_err +LocApiRpc::deleteAidingData(GpsAidingData bits) +{ + rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_DELETE_ASSIST_DATA, {0}}; + ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete.type = bits; + + return convertErr( + loc_eng_ioctl (client_handle, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL) + ); +} + +void LocApiRpc::reportPosition(const rpc_loc_parsed_position_s_type *location_report_ptr) +{ + LocPosTechMask tech_Mask = LOC_POS_TECH_MASK_DEFAULT; + + UlpLocation location = {0}; + GpsLocationExtended locationExtended = {0}; + + location.size = sizeof(location); + locationExtended.size = sizeof(locationExtended); + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS) + { + // Process the position from final and intermediate reports + if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS || + location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS) + { + // Latitude & Longitude + if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) && + (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) && + (location_report_ptr->latitude != 0 || + location_report_ptr->longitude != 0)) + { + location.gpsLocation.flags |= GPS_LOCATION_HAS_LAT_LONG; + location.gpsLocation.latitude = location_report_ptr->latitude; + location.gpsLocation.longitude = location_report_ptr->longitude; + + // Time stamp (UTC) + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC) + { + location.gpsLocation.timestamp = location_report_ptr->timestamp_utc; + } + + // Altitude + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID ) + { + location.gpsLocation.flags |= GPS_LOCATION_HAS_ALTITUDE; + location.gpsLocation.altitude = location_report_ptr->altitude_wrt_ellipsoid; + } + + // Speed + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) + { + location.gpsLocation.flags |= GPS_LOCATION_HAS_SPEED; + location.gpsLocation.speed = location_report_ptr->speed_horizontal; + } + + // Heading + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING) + { + location.gpsLocation.flags |= GPS_LOCATION_HAS_BEARING; + location.gpsLocation.bearing = location_report_ptr->heading; + } + + // Uncertainty (circular) + if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) ) + { + location.gpsLocation.flags |= GPS_LOCATION_HAS_ACCURACY; + location.gpsLocation.accuracy = location_report_ptr->hor_unc_circular; + } + + // Technology Mask + + tech_Mask |= location_report_ptr->technology_mask; + //Mark the location source as from GNSS + location.gpsLocation.flags |= LOCATION_HAS_SOURCE_INFO; + location.position_source = ULP_LOCATION_IS_FROM_GNSS; + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL; + locationExtended.altitudeMeanSeaLevel = location_report_ptr->altitude_wrt_mean_sea_level; + } + + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_MAGNETIC_VARIATION ) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_MAG_DEV; + locationExtended.magneticDeviation = location_report_ptr->magnetic_deviation; + } + + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_VERTICAL_UNC) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_VERT_UNC; + locationExtended.vert_unc = location_report_ptr->vert_unc; + } + + if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_UNC) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_SPEED_UNC; + locationExtended.speed_unc = location_report_ptr->speed_unc; + } + + LOC_LOGV("reportPosition: fire callback\n"); + enum loc_sess_status fixStatus = + (location_report_ptr->session_status + == RPC_LOC_SESS_STATUS_IN_PROGESS ? + LOC_SESS_INTERMEDIATE : LOC_SESS_SUCCESS); + LocApiBase::reportPosition(location, + locationExtended, + (void*)location_report_ptr, + fixStatus, + tech_Mask); + } + } + else + { + LocApiBase::reportPosition(location, + locationExtended, + NULL, + LOC_SESS_FAILURE); + LOC_LOGV("loc_eng_report_position: ignore position report " + "when session status = %d\n", + location_report_ptr->session_status); + } + } + else + { + LOC_LOGV("loc_eng_report_position: ignore position report " + "when session status is not set\n"); + } +} + +void LocApiRpc::reportSv(const rpc_loc_gnss_info_s_type *gnss_report_ptr) +{ + QtiGnssSvStatus SvStatus = {0}; + GpsLocationExtended locationExtended = {0}; + locationExtended.size = sizeof(locationExtended); + int num_svs_max = 0; + const rpc_loc_sv_info_s_type *sv_info_ptr; + + if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT) + { + num_svs_max = gnss_report_ptr->sv_count; + if (num_svs_max > GPS_MAX_SVS) + { + num_svs_max = GPS_MAX_SVS; + } + } + + if (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST) + { + SvStatus.num_svs = 0; + + for (int i = 0; i < num_svs_max; i++) + { + sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]); + if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM) + { + if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS) + { + SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvInfo); + SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn; + + // We only have the data field to report gps eph and alm mask + if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) && + (sv_info_ptr->has_eph == 1)) + { + SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1)); + } + + if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) && + (sv_info_ptr->has_alm == 1)) + { + SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1)); + } + + if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && + (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) + { + SvStatus.gps_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + } + } + // SBAS: GPS RPN: 120-151, + // In exteneded measurement report, we follow nmea standard, which is from 33-64. + else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS) + { + SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120; + } + // Gloness: Slot id: 1-32 + // In extended measurement report, we follow nmea standard, which is 65-96 + else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS) + { + if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) && + (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK)) + { + SvStatus.glo_used_in_fix_mask |= (1 << (sv_info_ptr->prn-1)); + } + + SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1); + } + // Unsupported SV system + else + { + continue; + } + } + + if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR) + { + SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr; + } + + if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION) + { + SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation; + } + + if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH) + { + SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth; + } + + SvStatus.num_svs++; + } + } + + if ((gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) && + (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) && + (gnss_report_ptr->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP)) + { + locationExtended.flags |= GPS_LOCATION_EXTENDED_HAS_DOP; + locationExtended.pdop = gnss_report_ptr->position_dop; + locationExtended.hdop = gnss_report_ptr->horizontal_dop; + locationExtended.vdop = gnss_report_ptr->vertical_dop; + } + + if (SvStatus.num_svs >= 0) + { + LocApiBase::reportSv(SvStatus, + locationExtended, + (void*)gnss_report_ptr); + } +} + +void LocApiRpc::reportStatus(const rpc_loc_status_event_s_type *status_report_ptr) +{ + + if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE) { + if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_ON) + { + LocApiBase::reportStatus(GPS_STATUS_ENGINE_ON); + LocApiBase::reportStatus(GPS_STATUS_SESSION_BEGIN); + } + else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF) + { + LocApiBase::reportStatus(GPS_STATUS_SESSION_END); + LocApiBase::reportStatus(GPS_STATUS_ENGINE_OFF); + } + else + { + LocApiBase::reportStatus(GPS_STATUS_NONE); + } + } + +} + +void LocApiRpc::reportNmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr) +{ + +#if (AMSS_VERSION==3200) + LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences.nmea_sentences_val, + nmea_report_ptr->nmea_sentences.nmea_sentences_len); +#else + LocApiBase::reportNmea(nmea_report_ptr->nmea_sentences, + nmea_report_ptr->length); + LOC_LOGD("loc_eng_report_nmea: $%c%c%c\n", + nmea_report_ptr->nmea_sentences[3], + nmea_report_ptr->nmea_sentences[4], + nmea_report_ptr->nmea_sentences[5]); +#endif /* #if (AMSS_VERSION==3200) */ +} + +enum loc_api_adapter_err +LocApiRpc::setXtraData(char* data, int length) +{ + int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE; + int total_parts; + uint8 part; + uint16 part_len; + uint16 len_injected; + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA; + rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr; + + LOC_LOGD("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%lx\n", length, (long) data); + + predicted_orbits_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.predicted_orbits_data; + predicted_orbits_data_ptr->format_type = RPC_LOC_PREDICTED_ORBITS_XTRA; + predicted_orbits_data_ptr->total_size = length; + total_parts = (length - 1) / XTRA_BLOCK_SIZE + 1; + predicted_orbits_data_ptr->total_parts = total_parts; + + len_injected = 0; // O bytes injected + ioctl_data.disc = ioctl_type; + + // XTRA injection starts with part 1 + for (part = 1; part <= total_parts; part++) + { + predicted_orbits_data_ptr->part = part; + predicted_orbits_data_ptr->part_len = XTRA_BLOCK_SIZE; + if (XTRA_BLOCK_SIZE > (length - len_injected)) + { + predicted_orbits_data_ptr->part_len = length - len_injected; + } + predicted_orbits_data_ptr->data_ptr.data_ptr_len = predicted_orbits_data_ptr->part_len; + predicted_orbits_data_ptr->data_ptr.data_ptr_val = data + len_injected; + + LOC_LOGD("qct_loc_eng_inject_xtra_data, part %d/%d, len = %d, total = %d\n", + predicted_orbits_data_ptr->part, + total_parts, + predicted_orbits_data_ptr->part_len, + len_injected); + + if (part < total_parts) + { + // No callback in this case + rpc_ret_val = loc_ioctl (client_handle, + ioctl_type, + &ioctl_data); + + if (rpc_ret_val != RPC_LOC_API_SUCCESS) + { + LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val)); + break; + } + //Add a delay of 10 ms so that repeated RPC calls dont starve the modem processor + usleep(10 * 1000); + } + else // part == total_parts + { + // Last part injection, will need to wait for callback + if (!loc_eng_ioctl(client_handle, + ioctl_type, + &ioctl_data, + LOC_XTRA_INJECT_DEFAULT_TIMEOUT, + NULL)) + { + rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE; + } + break; // done with injection + } + + len_injected += predicted_orbits_data_ptr->part_len; + LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected); + } + + return convertErr(rpc_ret_val); +} + +/* Request the Xtra Server Url from the modem */ +enum loc_api_adapter_err +LocApiRpc::requestXtraServer() +{ + loc_api_adapter_err err; + rpc_loc_ioctl_data_u_type data; + rpc_loc_ioctl_callback_s_type callback_data; + + err = convertErr(loc_eng_ioctl(client_handle, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE, + &data, + LOC_IOCTL_DEFAULT_TIMEOUT, + &callback_data)); + + if (LOC_API_ADAPTER_ERR_SUCCESS != err) + { + LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: err=%d\n", err); + return err; + } + else if (RPC_LOC_SESS_STATUS_SUCCESS != callback_data.status) + { + LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE failed!: status=%ld\n", callback_data.status); + return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; + } + else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.type) + { + LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the type expected! type=%d\n", callback_data.type); + return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; + } + else if (RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE != callback_data.data.disc) + { + LOC_LOGE("RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE is not the disc expected! disc=%d\n", callback_data.data.disc); + return LOC_API_ADAPTER_ERR_GENERAL_FAILURE; + } + + reportXtraServer(callback_data.data.rpc_loc_ioctl_callback_data_u_type_u. + predicted_orbits_data_source.servers[0], + callback_data.data.rpc_loc_ioctl_callback_data_u_type_u. + predicted_orbits_data_source.servers[1], + callback_data.data.rpc_loc_ioctl_callback_data_u_type_u. + predicted_orbits_data_source.servers[2], + 255); + + return LOC_API_ADAPTER_ERR_SUCCESS; +} + +enum loc_api_adapter_err +LocApiRpc::atlOpenStatus(int handle, int is_succ, char* apn, AGpsBearerType bearer, AGpsType agpsType) +{ + rpc_loc_server_open_status_e_type open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL; + rpc_loc_ioctl_data_u_type ioctl_data; + + if (AGPS_TYPE_INVALID == agpsType) { + rpc_loc_server_open_status_s_type *conn_open_status_ptr = + &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status; + + // Fill in data + ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS; + conn_open_status_ptr->conn_handle = handle; + conn_open_status_ptr->open_status = open_status; +#if (AMSS_VERSION==3200) + conn_open_status_ptr->apn_name = apn; /* requires APN */ +#else + if (is_succ) { + strlcpy(conn_open_status_ptr->apn_name, apn, + sizeof conn_open_status_ptr->apn_name); + } else { + conn_open_status_ptr->apn_name[0] = 0; + } +#endif /* #if (AMSS_VERSION==3200) */ + + LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS open %s, APN name = [%s]\n", + log_succ_fail_string(is_succ), + apn); + } else { + rpc_loc_server_multi_open_status_s_type *conn_multi_open_status_ptr = + &ioctl_data.rpc_loc_ioctl_data_u_type_u.multi_conn_open_status; + + // Fill in data + ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS; + conn_multi_open_status_ptr->conn_handle = handle; + conn_multi_open_status_ptr->open_status = open_status; + if (is_succ) { + strlcpy(conn_multi_open_status_ptr->apn_name, apn, + sizeof conn_multi_open_status_ptr->apn_name); + } else { + conn_multi_open_status_ptr->apn_name[0] = 0; + } + + switch(bearer) + { + case AGPS_APN_BEARER_IPV4: + conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IP; + break; + case AGPS_APN_BEARER_IPV6: + conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV6; + break; + case AGPS_APN_BEARER_IPV4V6: + conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_IPV4V6; + break; + default: + conn_multi_open_status_ptr->pdp_type = RPC_LOC_SERVER_PDP_PPP; + } + + LOC_LOGD("ATL RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS open %s, APN name = [%s], pdp_type = %d\n", + log_succ_fail_string(is_succ), + apn, + conn_multi_open_status_ptr->pdp_type); + } + + // Make the IOCTL call + return convertErr( + loc_eng_ioctl(client_handle, + ioctl_data.disc, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL) + ); +} + +enum loc_api_adapter_err +LocApiRpc::atlCloseStatus(int handle, int is_succ) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS; + + rpc_loc_server_close_status_s_type *conn_close_status_ptr = + &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status; + conn_close_status_ptr->conn_handle = handle; + conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL; + + // Make the IOCTL call + return convertErr( + loc_eng_ioctl(client_handle, + ioctl_data.disc, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL) + ); +} + +void LocApiRpc::ATLEvent(const rpc_loc_server_request_s_type *server_request_ptr) +{ + int connHandle; + AGpsType agps_type; + + LOC_LOGV("RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST event %s)", + loc_get_event_atl_open_name(server_request_ptr->event)); + switch (server_request_ptr->event) + { + case RPC_LOC_SERVER_REQUEST_MULTI_OPEN: + connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.conn_handle; + if (server_request_ptr->payload.rpc_loc_server_request_u_type_u.multi_open_req.connection_type + == RPC_LOC_SERVER_CONNECTION_LBS) { + agps_type = AGPS_TYPE_SUPL; + LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_SUPL\n handle - %d", connHandle); + } else { + agps_type = AGPS_TYPE_WWAN_ANY; + LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_MULTI_OPEN\n type - AGPS_TYPE_WWAN_ANY\n handle - %d", connHandle); + } + requestATL(connHandle, agps_type); + break; + case RPC_LOC_SERVER_REQUEST_OPEN: + connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle; + LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_OPEN\n handle - %d", connHandle); + requestATL(connHandle, AGPS_TYPE_INVALID); + break; + case RPC_LOC_SERVER_REQUEST_CLOSE: + connHandle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle; + LOC_LOGV("ATLEvent: event - RPC_LOC_SERVER_REQUEST_CLOSE\n handle - %d", connHandle); + releaseATL(connHandle); + break; + default: + LOC_LOGE("ATLEvent: event type %d invalid", server_request_ptr->event); + } +} + +void LocApiRpc::NIEvent(const rpc_loc_ni_event_s_type *ni_req) +{ + GpsNiNotification notif = {0}; + + switch (ni_req->event) + { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + { + const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req = + &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req; + LOC_LOGI("VX Notification"); + notif.ni_type = GPS_NI_TYPE_VOICE; + // Requestor ID + hexcode(notif.requestor_id, sizeof notif.requestor_id, + vx_req->requester_id.requester_id, + vx_req->requester_id.requester_id_length); + notif.text_encoding = 0; // No text and no encoding + notif.requestor_id_encoding = convertNiEncodingType(vx_req->encoding_scheme); + NIEventFillVerfiyType(notif, vx_req->notification_priv_type); + } + break; + + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + { + const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req = + &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req; + LOC_LOGI("UMTS CP Notification\n"); + notif.ni_type= GPS_NI_TYPE_UMTS_CTRL_PLANE; // Stores notification text +#if (AMSS_VERSION==3200) + hexcode(notif.text, sizeof notif.text, + umts_cp_req->notification_text.notification_text_val, + umts_cp_req->notification_length); + hexcode(notif.requestor_id, sizeof notif.requestor_id, + umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val, + umts_cp_req->requestor_id.string_len); +#else + hexcode(notif.text, sizeof notif.text, + umts_cp_req->notification_text, + umts_cp_req->notification_length); + hexcode(notif.requestor_id, sizeof notif.requestor_id, + umts_cp_req->requestor_id.requestor_id_string, + umts_cp_req->requestor_id.string_len); +#endif + notif.text_encoding = convertNiEncodingType(umts_cp_req->datacoding_scheme); + notif.requestor_id_encoding = notif.text_encoding; + NIEventFillVerfiyType(notif, umts_cp_req->notification_priv_type); + + // LCS address (using extras field) + if (umts_cp_req->ext_client_address_data.ext_client_address_len != 0) + { + // Copy LCS Address into notif.extras in the format: Address = 012345 + strlcat(notif.extras, LOC_NI_NOTIF_KEY_ADDRESS, sizeof notif.extras); + strlcat(notif.extras, " = ", sizeof notif.extras); + int addr_len = 0; + const char *address_source = NULL; + +#if (AMSS_VERSION==3200) + address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val; +#else + address_source = umts_cp_req->ext_client_address_data.ext_client_address; +#endif /* #if (AMSS_VERSION==3200) */ + + char lcs_addr[32]; // Decoded LCS address for UMTS CP NI + addr_len = decodeAddress(lcs_addr, sizeof lcs_addr, address_source, + umts_cp_req->ext_client_address_data.ext_client_address_len); + + // The address is ASCII string + if (addr_len) + { + strlcat(notif.extras, lcs_addr, sizeof notif.extras); + } + } + } + break; + + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + { + const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req = + &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req; + LOC_LOGI("SUPL Notification\n"); + notif.ni_type = GPS_NI_TYPE_UMTS_SUPL; + + if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT) + { +#if (AMSS_VERSION==3200) + hexcode(notif.text, sizeof notif.text, + supl_req->client_name.client_name_string.client_name_string_val, /* buffer */ + supl_req->client_name.string_len /* length */ + ); +#else + hexcode(notif.text, sizeof notif.text, + supl_req->client_name.client_name_string, /* buffer */ + supl_req->client_name.string_len /* length */ + ); +#endif /* #if (AMSS_VERSION==3200) */ + LOC_LOGV("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len); + } + else { + LOC_LOGV("SUPL NI: client_name not present."); + } + + // Requestor ID + if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT) + { +#if (AMSS_VERSION==3200) + hexcode(notif.requestor_id, sizeof notif.requestor_id, + supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */ + supl_req->requestor_id.string_len /* length */ + ); +#else + hexcode(notif.requestor_id, sizeof notif.requestor_id, + supl_req->requestor_id.requestor_id_string, /* buffer */ + supl_req->requestor_id.string_len /* length */ + ); +#endif /* #if (AMSS_VERSION==3200) */ + LOC_LOGV("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len); + } + else { + LOC_LOGV("SUPL NI: requestor_id not present."); + } + + // Encoding type + if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT) + { + notif.text_encoding = convertNiEncodingType(supl_req->datacoding_scheme); + notif.requestor_id_encoding = notif.text_encoding; + } + else { + notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN; + } + + NIEventFillVerfiyType(notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type); + } + break; + + default: + LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event); + return; + } + + // this copy will get freed in loc_eng_ni when loc_ni_respond() is called + rpc_loc_ni_event_s_type *copy = (rpc_loc_ni_event_s_type *)malloc(sizeof(*copy)); + memcpy(copy, ni_req, sizeof(*copy)); + requestNiNotify(notif, (const void*)copy); +} + +int LocApiRpc::NIEventFillVerfiyType(GpsNiNotification ¬if, + rpc_loc_ni_notify_verify_e_type notif_priv) +{ + switch (notif_priv) + { + case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY: + notif.notify_flags = 0; + notif.default_response = GPS_NI_RESPONSE_NORESP; + return 1; + case RPC_LOC_NI_USER_NOTIFY_ONLY: + notif.notify_flags = GPS_NI_NEED_NOTIFY; + notif.default_response = GPS_NI_RESPONSE_NORESP; + return 1; + case RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP: + notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY; + notif.default_response = GPS_NI_RESPONSE_ACCEPT; + return 1; + case RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP: + notif.notify_flags = GPS_NI_NEED_NOTIFY | GPS_NI_NEED_VERIFY; + notif.default_response = GPS_NI_RESPONSE_DENY; + return 1; + case RPC_LOC_NI_USER_PRIVACY_OVERRIDE: + notif.notify_flags = GPS_NI_PRIVACY_OVERRIDE; + notif.default_response = GPS_NI_RESPONSE_NORESP; + return 1; + default: + return 0; + } +} + +enum loc_api_adapter_err +LocApiRpc::setSUPLVersion(uint32_t version) +{ + rpc_loc_ioctl_data_u_type ioctl_data = {RPC_LOC_IOCTL_SET_SUPL_VERSION, {0}}; + ioctl_data.rpc_loc_ioctl_data_u_type_u.supl_version = (int)version; + return convertErr( + loc_eng_ioctl (client_handle, + RPC_LOC_IOCTL_SET_SUPL_VERSION, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL) + ); +} + +GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding) +{ + switch (loc_encoding) + { + case RPC_LOC_NI_SUPL_UTF8: + return GPS_ENC_SUPL_UTF8; + case RPC_LOC_NI_SUPL_UCS2: + return GPS_ENC_SUPL_UCS2; + case RPC_LOC_NI_SUPL_GSM_DEFAULT: + return GPS_ENC_SUPL_GSM_DEFAULT; + case RPC_LOC_NI_SS_LANGUAGE_UNSPEC: + return GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM + default: + return GPS_ENC_UNKNOWN; + } +} + +LocApiBase* getLocApi(const MsgTask* msgTask, + LOC_API_ADAPTER_EVENT_MASK_T exMask, + ContextBase *context) { + return new LocApiRpc(msgTask, exMask, context); +} + +/*Values for lock + 1 = Do not lock any position sessions + 2 = Lock MI position sessions + 3 = Lock MT position sessions + 4 = Lock all position sessions +*/ +int LocApiRpc::setGpsLock(LOC_GPS_LOCK_MASK lockMask) +{ + rpc_loc_ioctl_data_u_type ioctl_data; + boolean ret_val; + LOC_LOGD("%s:%d]: lock: %x\n", __func__, __LINE__, lockMask); + ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = convertGpsLockMask(lockMask); + ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK; + ret_val = loc_eng_ioctl (loc_eng_data.client_handle, + RPC_LOC_IOCTL_SET_ENGINE_LOCK, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + NULL /* No output information is expected*/); + + LOC_LOGD("%s:%d]: ret_val: %d\n", __func__, __LINE__, (int)ret_val); + return (ret_val == TRUE ? 0 : -1); +} + +/* + Returns + Current value of GPS lock on success + -1 on failure +*/ +int LocApiRpc :: getGpsLock() +{ + rpc_loc_ioctl_data_u_type ioctl_data; + rpc_loc_ioctl_callback_s_type callback_payload; + boolean ret_val; + int ret=0; + LOC_LOGD("%s:%d]: Enter\n", __func__, __LINE__); + ret_val = loc_eng_ioctl (loc_eng_data.client_handle, + RPC_LOC_IOCTL_GET_ENGINE_LOCK, + &ioctl_data, + LOC_IOCTL_DEFAULT_TIMEOUT, + &callback_payload); + if(ret_val == TRUE) { + ret = (int)callback_payload.data.engine_lock; + LOC_LOGD("%s:%d]: Lock type: %d\n", __func__, __LINE__, ret); + } + else { + LOC_LOGE("%s:%d]: Ioctl failed", __func__, __LINE__); + ret = -1; + } + LOC_LOGD("%s:%d]: Exit\n", __func__, __LINE__); + return ret; +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c new file mode 100644 index 0000000..837ef11 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_fixup.c @@ -0,0 +1,52 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <rpc/rpc.h> + +#include "loc_api_fixup.h" + +#ifdef ADD_XDR_FLOAT + +int +xdr_float(xdrp, fp) + XDR *xdrp; + float *fp; +{ + return xdr_long(xdrp, (long*)fp); +} + +int +xdr_double(xdrp, dp) + XDR *xdrp; + double *dp; +{ + return xdr_long(xdrp, (long*)dp + 1) + && xdr_long(xdrp, (long*)dp); +} + +#endif /* ADD_XDR_FLOAT */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c new file mode 100644 index 0000000..eb685fd --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_log.c @@ -0,0 +1,344 @@ +/* Copyright (c) 2011, 2014 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#define LOG_NDDEBUG 0 +#define LOG_TAG "LocSvc_api_rpc_glue" + +#include "loc_api_log.h" +#include "loc_log.h" +#include "platform_lib_includes.h" +#include "rpc/rpc.h" +#include "loc_api_fixup.h" + +/* Event names */ +loc_name_val_s_type loc_event_name[] = + { + NAME_VAL( RPC_LOC_EVENT_PARSED_POSITION_REPORT ), + NAME_VAL( RPC_LOC_EVENT_SATELLITE_REPORT ), + NAME_VAL( RPC_LOC_EVENT_NMEA_1HZ_REPORT ), + NAME_VAL( RPC_LOC_EVENT_NMEA_POSITION_REPORT ), + NAME_VAL( RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST ), + NAME_VAL( RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST ), + NAME_VAL( RPC_LOC_EVENT_LOCATION_SERVER_REQUEST ), + NAME_VAL( RPC_LOC_EVENT_IOCTL_REPORT ), + NAME_VAL( RPC_LOC_EVENT_STATUS_REPORT ), + NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ), + }; +int loc_event_num = sizeof loc_event_name / sizeof(loc_name_val_s_type); + +/* Event names */ +loc_name_val_s_type loc_event_atl_open_name[] = + { + NAME_VAL( RPC_LOC_SERVER_REQUEST_OPEN ), + NAME_VAL( RPC_LOC_SERVER_REQUEST_CLOSE ), + NAME_VAL( RPC_LOC_SERVER_REQUEST_MULTI_OPEN ) + }; +int loc_event_atl_open_num = sizeof loc_event_atl_open_name / sizeof(loc_name_val_s_type); + +/* Finds the first event found in the mask */ +const char* loc_get_event_atl_open_name(rpc_loc_server_request_e_type loc_event_atl_open) +{ + return loc_get_name_from_val(loc_event_atl_open_name, loc_event_atl_open_num, + (long) loc_event_atl_open); +} + +/* IOCTL Type names */ +loc_name_val_s_type loc_ioctl_type_name[] = + { + NAME_VAL( RPC_LOC_IOCTL_GET_API_VERSION ), + NAME_VAL( RPC_LOC_IOCTL_SET_FIX_CRITERIA ), + NAME_VAL( RPC_LOC_IOCTL_GET_FIX_CRITERIA ), + NAME_VAL( RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE ), + NAME_VAL( RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA ), + NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY ), + NAME_VAL( RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE ), + NAME_VAL( RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD ), + NAME_VAL( RPC_LOC_IOCTL_INJECT_UTC_TIME ), + NAME_VAL( RPC_LOC_IOCTL_INJECT_RTC_VALUE ), + NAME_VAL( RPC_LOC_IOCTL_INJECT_POSITION ), + NAME_VAL( RPC_LOC_IOCTL_QUERY_ENGINE_STATE ), + NAME_VAL( RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG), + NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS ), + NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS ), + NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ), + NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ), + NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ), + NAME_VAL( RPC_LOC_IOCTL_SET_ENGINE_LOCK ), + NAME_VAL( RPC_LOC_IOCTL_GET_ENGINE_LOCK ), + NAME_VAL( RPC_LOC_IOCTL_SET_SBAS_CONFIG ), + NAME_VAL( RPC_LOC_IOCTL_GET_SBAS_CONFIG ), + NAME_VAL( RPC_LOC_IOCTL_SET_NMEA_TYPES ), + NAME_VAL( RPC_LOC_IOCTL_GET_NMEA_TYPES ), + NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_SET_ON_DEMAND_LPM ), + NAME_VAL( RPC_LOC_IOCTL_GET_ON_DEMAND_LPM ), + NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL ), + NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL ), + NAME_VAL( RPC_LOC_IOCTL_SET_LBS_APN_PROFILE ), + NAME_VAL( RPC_LOC_IOCTL_GET_LBS_APN_PROFILE ), + NAME_VAL( RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE ), + NAME_VAL( RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE ), + NAME_VAL( RPC_LOC_IOCTL_SET_DATA_ENABLE ), + NAME_VAL( RPC_LOC_IOCTL_SET_SUPL_VERSION ), + NAME_VAL( RPC_LOC_IOCTL_GET_SUPL_VERSION ), + NAME_VAL( RPC_LOC_IOCTL_DELETE_ASSIST_DATA ), + NAME_VAL( RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR ), + NAME_VAL( RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR ), + }; +int loc_ioctl_type_num = sizeof loc_ioctl_type_name / sizeof(loc_name_val_s_type); + +/* IOCTL Status names */ +loc_name_val_s_type loc_ioctl_status_name[] = + { + NAME_VAL( RPC_LOC_API_SUCCESS ), + NAME_VAL( RPC_LOC_API_GENERAL_FAILURE ), + NAME_VAL( RPC_LOC_API_UNSUPPORTED ), + NAME_VAL( RPC_LOC_API_INVALID_HANDLE ), + NAME_VAL( RPC_LOC_API_INVALID_PARAMETER ), + NAME_VAL( RPC_LOC_API_ENGINE_BUSY ), + NAME_VAL( RPC_LOC_API_PHONE_OFFLINE ), + NAME_VAL( RPC_LOC_API_TIMEOUT ), + NAME_VAL( RPC_LOC_API_RPC_FAILURE ), + NAME_VAL( RPC_LOC_API_RPC_MODEM_RESTART ) + }; +int loc_ioctl_status_num = sizeof loc_ioctl_status_name / sizeof(loc_name_val_s_type); + +/* Fix session status names */ +loc_name_val_s_type loc_sess_status_name[] = + { + NAME_VAL( RPC_LOC_SESS_STATUS_SUCCESS ), + NAME_VAL( RPC_LOC_SESS_STATUS_IN_PROGESS ), + NAME_VAL( RPC_LOC_SESS_STATUS_GENERAL_FAILURE ), + NAME_VAL( RPC_LOC_SESS_STATUS_TIMEOUT ), + NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ), + NAME_VAL( RPC_LOC_SESS_STATUS_BAD_PARAMETER ), + NAME_VAL( RPC_LOC_SESS_STATUS_PHONE_OFFLINE ), + NAME_VAL( RPC_LOC_SESS_STATUS_USER_END ), + NAME_VAL( RPC_LOC_SESS_STATUS_ENGINE_LOCKED ) + }; +int loc_sess_status_num = sizeof loc_sess_status_name / sizeof(loc_name_val_s_type); + +/* Engine state names */ +loc_name_val_s_type loc_engine_state_name[] = + { + NAME_VAL( RPC_LOC_ENGINE_STATE_ON ), + NAME_VAL( RPC_LOC_ENGINE_STATE_OFF ) + }; +int loc_engine_state_num = sizeof loc_engine_state_name / sizeof(loc_name_val_s_type); + +/* Fix session state names */ +loc_name_val_s_type loc_fix_session_state_name[] = + { + NAME_VAL( RPC_LOC_FIX_SESSION_STATE_BEGIN ), + NAME_VAL( RPC_LOC_FIX_SESSION_STATE_END ) + }; +int loc_fix_session_state_num = sizeof loc_fix_session_state_name / sizeof(loc_name_val_s_type); + + +static const char* log_final_interm_string(int is_final) +{ + return is_final ? "final" : "intermediate"; +} + +/* Logs parsed report */ +static void log_parsed_report(const rpc_loc_parsed_position_s_type *parsed_report) +{ + rpc_loc_session_status_e_type status = parsed_report->session_status; + LOC_LOGD("Session status: %s Valid mask: 0x%X\n", + loc_get_sess_status_name(status), + (uint) parsed_report->valid_mask); + LOC_LOGD("Latitude: %.7f (%s)\n", parsed_report->latitude, + log_final_interm_string( + (parsed_report->valid_mask & RPC_LOC_POS_VALID_LATITUDE) && + parsed_report->session_status == RPC_LOC_SESS_STATUS_SUCCESS)); + LOC_LOGD("Longitude: %.7f\n", parsed_report->longitude); + LOC_LOGD("Accuracy: %.7f\n", parsed_report->hor_unc_circular); +} + +/* Logs status report */ +static void log_status_report(const rpc_loc_status_event_s_type *status_event) +{ + rpc_loc_status_event_e_type event = status_event->event; + switch (event) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + LOC_LOGD("Engine state: %s\n", + loc_get_engine_state_name( + status_event->payload.rpc_loc_status_event_payload_u_type_u.engine_state)); + break; + case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: + LOC_LOGD("Fix session state: %s\n", + loc_get_fix_session_state_name( + status_event->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state)); + break; + default: + break; + } +} + +/* Logs valid fields in the GNSS SV constellation report */ +static void log_satellite_report(const rpc_loc_gnss_info_s_type *gnss) +{ + if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_POS_DOP) + { + LOC_LOGV("position dop: %.3f\n", (float) gnss->position_dop); + } + if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_HOR_DOP) + { + LOC_LOGV("horizontal dop: %.3f\n", (float) gnss->horizontal_dop); + } + if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_VERT_DOP) + { + LOC_LOGV("vertical dop: %.3f\n", (float) gnss->vertical_dop); + } + if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED) + { + LOC_LOGV("altitude assumed: %d\n", (int) gnss->altitude_assumed); + } + if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_COUNT) + { + LOC_LOGD("sv count: %d\n", (int) gnss->sv_count); + } + if (gnss->valid_mask & RPC_LOC_GNSS_INFO_VALID_SV_LIST) + { + LOC_LOGV("sv list: "); + + if (gnss->sv_count) + { + LOC_LOGV("\n\tsys\tprn\thlth\tproc\teph\talm\telev\tazi\tsnr\n"); + } + else { + LOC_LOGV("empty\n"); + } + + int i; + for (i = 0; i < gnss->sv_count; i++) + { + const rpc_loc_sv_info_s_type *sv = &gnss->sv_list.sv_list_val[i]; + rpc_loc_sv_info_valid_mask_type mask = sv->valid_mask; + LOC_LOGV(" %d: \t%d\t%d\t%d\t%d\t%d\t%d\t%.3f\t%.3f\t%.3f\n", i, + CHECK_MASK(int, sv->system, mask, RPC_LOC_SV_INFO_VALID_SYSTEM), + CHECK_MASK(int, sv->prn, mask, RPC_LOC_SV_INFO_VALID_PRN), + CHECK_MASK(int, sv->health_status, mask, RPC_LOC_SV_INFO_VALID_HEALTH_STATUS), + CHECK_MASK(int, sv->process_status, mask, RPC_LOC_SV_INFO_VALID_PROCESS_STATUS), + CHECK_MASK(int, sv->has_eph, mask, RPC_LOC_SV_INFO_VALID_HAS_EPH), + CHECK_MASK(int, sv->has_alm, mask, RPC_LOC_SV_INFO_VALID_HAS_ALM), + CHECK_MASK(float, sv->elevation, mask, RPC_LOC_SV_INFO_VALID_ELEVATION), + CHECK_MASK(float, sv->azimuth, mask, RPC_LOC_SV_INFO_VALID_AZIMUTH), + CHECK_MASK(float, sv->snr, mask, RPC_LOC_SV_INFO_VALID_SNR) + ); + } + } +} + +/* Logs a callback event */ +int loc_callback_log( + rpc_loc_event_mask_type loc_event, /* event mask */ + const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ +) +{ + switch (loc_event) + { + case RPC_LOC_EVENT_SATELLITE_REPORT: + log_satellite_report(&loc_event_payload-> + rpc_loc_event_payload_u_type_u.gnss_report); + break; + case RPC_LOC_EVENT_STATUS_REPORT: + log_status_report(&loc_event_payload-> + rpc_loc_event_payload_u_type_u.status_report); + break; + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + log_parsed_report(&loc_event_payload-> + rpc_loc_event_payload_u_type_u.parsed_location_report); + break; + default: + break; + } + + return 0; +} + +/* Finds the first event found in the mask */ +const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask) +{ + return loc_get_name_from_mask(loc_event_name, loc_event_num, + (long) loc_event_mask); +} + +/* Finds IOCTL type name */ +const char* loc_get_ioctl_type_name(rpc_loc_ioctl_e_type ioctl_type) +{ + return loc_get_name_from_val(loc_ioctl_type_name, loc_ioctl_type_num, + (long) ioctl_type); +} + +/* Finds IOCTL status name */ +const char* loc_get_ioctl_status_name(uint32 status) +{ + return loc_get_name_from_val(loc_ioctl_status_name, loc_ioctl_status_num, + (long) status); +} + +/* Finds session status name */ +const char* loc_get_sess_status_name(rpc_loc_session_status_e_type status) +{ + return loc_get_name_from_val(loc_sess_status_name, loc_sess_status_num, + (long) status); +} + +/* Find engine state name */ +const char* loc_get_engine_state_name(rpc_loc_engine_state_e_type state) +{ + return loc_get_name_from_val(loc_engine_state_name, loc_engine_state_num, + (long) state); +} + +/* Find engine state name */ +const char* loc_get_fix_session_state_name(rpc_loc_fix_session_state_e_type state) +{ + return loc_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num, + (long) state); +} + +/* Event names */ +loc_name_val_s_type rpc_reset_event_name[] = +{ + NAME_VAL( RPC_SUBSYSTEM_RESTART_BEGIN ), + NAME_VAL( RPC_SUBSYSTEM_RESTART_END ) +}; +int rpc_reset_event_num = sizeof rpc_reset_event_name / sizeof(loc_name_val_s_type); + +const char* loc_get_rpc_reset_event_name(enum rpc_reset_event event) +{ + return loc_get_name_from_val(rpc_reset_event_name, rpc_reset_event_num, event); +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c new file mode 100644 index 0000000..8c12426 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_rpc_glue.c @@ -0,0 +1,635 @@ +/* Copyright (c) 2011-2012,2014 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*===================================================================== + + INCLUDE FILES FOR MODULE + +======================================================================*/ +#include <stdio.h> +#include <pthread.h> +#include <errno.h> +#include <string.h> +#include <sys/select.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <unistd.h> +#include <stdlib.h> +#include <assert.h> +#include <loc_api_log.h> + +#include <rpc/rpc.h> + +/* Include RPC headers */ +#include "rpc_inc/loc_api_rpc_glue.h" + +/* Callback init */ +#include "rpc_inc/loc_apicb_appinit.h" + +/* Logging */ +#define LOG_TAG "LocSvc_api_rpc_glue" +#define LOG_NDDEBUG 0 +#ifndef USE_GLIB +#include <utils/Log.h> +#endif /* USE_GLIB */ + +/* Logging Improvement */ +#include "platform_lib_includes.h" +/*Maximum number of Modem init*/ +#define RPC_TRY_NUM 10 + +/*Maximum number of Modem init*/ +#define RPC_TRY_NUM 10 + +/* Uncomment to force ALOGD messages */ +// #define ALOGD ALOGI + +/*===================================================================== + External declarations +======================================================================*/ + +CLIENT* loc_api_clnt = NULL; + +/* Callback ID and pointer */ +#define LOC_API_CB_MAX_CLIENTS 16 +typedef struct +{ + uint32 cb_id; /* same as rpc/types.h */ + loc_event_cb_f_type *cb_func; /* callback func */ + loc_reset_notif_cb_f_type *rpc_cb; /* callback from RPC */ + rpc_loc_client_handle_type handle; /* stores handle for client closing */ + void* user; /* user's own data handle */ +} loc_glue_cb_entry_s_type; + +loc_glue_cb_entry_s_type loc_glue_callback_table[LOC_API_CB_MAX_CLIENTS]; + +#define RPC_FUNC_VERSION_BASE(a,b) a ## b +#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b) + +#define RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) a ## v ## b +#define RPC_CALLBACK_FUNC_VERSION(a,v,b) RPC_CALLBACK_FUNC_VERSION_BASE(a,v,b) + +#define LOC_GLUE_CHECK_INIT(ret_type) \ + if (loc_api_clnt == NULL) { EXIT_LOG_CALLFLOW(%d, RPC_LOC_API_RPC_FAILURE); return (ret_type) RPC_LOC_API_RPC_FAILURE; } + +#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \ + if (stat != RPC_SUCCESS) { \ + LOC_LOGE("%s:%d] failure code %d", __func__, __LINE__, stat); \ + return (ret_type)((stat == RPC_SUBSYSTEM_RESTART) ? \ + RPC_LOC_API_RPC_MODEM_RESTART : RPC_LOC_API_RPC_FAILURE); \ + } + +/* Callback functions */ +/* Returns 1 if successful */ +bool_t rpc_loc_event_cb_f_type_svc( + rpc_loc_event_cb_f_type_args *argp, + rpc_loc_event_cb_f_type_rets *ret, + struct svc_req *req) +{ + // The lower word of cd_id is the index + int index = argp->cb_id & 0xFFFF; + + /* Callback not registered, or unexpected ID (shouldn't happen) */ + if (index >= LOC_API_CB_MAX_CLIENTS || loc_glue_callback_table[index].cb_func == NULL) + { + LOC_LOGE("Warning: No callback handler %d.\n", index); + ret->loc_event_cb_f_type_result = 0; + return 1; /* simply return */ + } + + LOC_LOGV("proc: %x prog: %x vers: %x\n", + (int) req->rq_proc, + (int) req->rq_prog, + (int) req->rq_vers); + + LOC_LOGV("Callback received: %x (cb_id=%p handle=%d ret_ptr=%d)\n", + (int) argp->loc_event, + argp->cb_id, + (int) argp->loc_handle, + (int) ret); + + /* Forward callback to real callback procedure */ + rpc_loc_client_handle_type loc_handle = argp->loc_handle; + rpc_loc_event_mask_type loc_event = argp->loc_event; + const rpc_loc_event_payload_u_type* loc_event_payload = + (const rpc_loc_event_payload_u_type*) argp->loc_event_payload; + + /* Gives control to synchronous call handler */ + loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload); + + int32 rc = (loc_glue_callback_table[index].cb_func)(loc_glue_callback_table[index].user, + loc_handle, loc_event, loc_event_payload); + + LOC_LOGV("cb_func=%p", loc_glue_callback_table[index].cb_func); + + ret->loc_event_cb_f_type_result = rc; + + return 1; /* ok */ +} + +int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) +{ + xdr_free (xdr_result, result); + + /* + * Insert additional freeing code here, if needed + */ + // LOC_LOGD("***** loc_apicbprog_freeresult\n"); + + return 1; +} + +/*=========================================================================== + +FUNCTION rpc_loc_event_cb_f_type_<version>_svc (MACRO) + +DESCRIPTION + Callback function for Loc API + +RETURN VALUE + 1 for success + 0 for failure + +===========================================================================*/ +bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_event_cb_f_type_, RPC_LOC_EVENT_CB_F_TYPE_VERSION, _svc) ( + rpc_loc_event_cb_f_type_args *argp, + rpc_loc_event_cb_f_type_rets *ret, + struct svc_req *req) +{ + return rpc_loc_event_cb_f_type_svc(argp, ret, req); +} + +/*=========================================================================== + +FUNCTION loc_apicbprog_<version>_freeresult (MACRO) + +DESCRIPTION + Free up RPC data structure + +RETURN VALUE + 1 for success + 0 for failure + +===========================================================================*/ +#define VERSION_CONCAT(MAJOR,MINOR) MAJOR##MINOR +#define loc_apicb_prog_VER_freeresult(M,N) \ +int RPC_CALLBACK_FUNC_VERSION(loc_apicbprog_, VERSION_CONCAT(M,N), _freeresult) \ +(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result) \ +{ \ + return loc_apicbprog_freeresult(transp, xdr_result, result); \ +} + +/* Define all of the possible minors */ +loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0001); +loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0002); +loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0003); +loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0004); +loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0005); +loc_apicb_prog_VER_freeresult(RPC_LOC_API_API_MAJOR_NUM, 0006); + +/*=========================================================================== + +FUNCTION rpc_loc_api_cb_null_<version>_svc (MACRO) [Patch for wrong RPCGEN stubs] + +DESCRIPTION + Null callback function for Loc API + +RETURN VALUE + 1 for success + +===========================================================================*/ +#define rpc_loc_api_cb_null_VER_svc(M,N) \ +bool_t RPC_CALLBACK_FUNC_VERSION(rpc_loc_api_cb_null_, VERSION_CONCAT(M,N), _svc) ( \ + void *a, int *b, struct svc_req *req) \ +{ \ + return 1; \ +} + +/* Define all of the possible minors */ +rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0001); +rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0002); +rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0003); +rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0004); +rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0005); +rpc_loc_api_cb_null_VER_svc(RPC_LOC_API_API_MAJOR_NUM, 0006); + +static void loc_api_glue_rpc_cb(CLIENT* client, enum rpc_reset_event event) +{ + int i; + for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) { + if (NULL != loc_glue_callback_table[i].rpc_cb) { + loc_glue_callback_table[i].rpc_cb(loc_glue_callback_table[i].user, client, event); + } + } +} + +/*=========================================================================== + +FUNCTION loc_api_glue_init + +DESCRIPTION + Initiates the RPC client + +RETURN VALUE + 1 for success + 0 for failure + +===========================================================================*/ +int loc_api_glue_init(void) +{ + if (loc_api_clnt == NULL) + { + /* Initialize data */ + int i; + int pid = getpid(); + for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) + { + loc_glue_callback_table[i].cb_id = i | (pid << 16); + loc_glue_callback_table[i].cb_func = NULL; + loc_glue_callback_table[i].handle = -1; + loc_glue_callback_table[i].rpc_cb = NULL; + loc_glue_callback_table[i].user = NULL; + } + + /* Print msg */ + LOC_LOGV("Trying to create RPC client...\n"); + loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL); + LOC_LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt); + + if (loc_api_clnt == NULL) + { + LOC_LOGE("Error: cannot create RPC client.\n"); + return 0; + } + + /* Init RPC callbacks */ + loc_api_sync_call_init(); + + int rc = loc_apicb_app_init(); + if (rc >= 0) + { + LOC_LOGD("Loc API RPC client initialized.\n"); + clnt_register_reset_notification_cb(loc_api_clnt, loc_api_glue_rpc_cb); + } + else { + LOC_LOGE("Loc API callback initialization failed.\n"); + return 0; + } + } + + return 1; +} + +rpc_loc_client_handle_type loc_open ( + rpc_loc_event_mask_type event_reg_mask, + loc_event_cb_f_type *event_callback, + loc_reset_notif_cb_f_type *rpc_cb, + void* userData +) +{ + int try_num = RPC_TRY_NUM; + ENTRY_LOG(); + LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type); + + rpc_loc_client_handle_type ret_val; + + rpc_loc_open_args args; + args.event_reg_mask = event_reg_mask; + + int i, j = LOC_API_CB_MAX_CLIENTS; + for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) + { + if (loc_glue_callback_table[i].user == userData) + { + LOC_LOGW("Client already opened service (callback=%p)...\n", + event_callback); + break; + } else if (j == LOC_API_CB_MAX_CLIENTS && + loc_glue_callback_table[i].user == NULL) { + j = i; + } + } + + if (i == LOC_API_CB_MAX_CLIENTS) + { + i = j; + } + + if (i == LOC_API_CB_MAX_CLIENTS) + { + LOC_LOGE("Too many clients opened at once...\n"); + return RPC_LOC_CLIENT_HANDLE_INVALID; + } + + loc_glue_callback_table[i].cb_func = event_callback; + loc_glue_callback_table[i].rpc_cb = rpc_cb; + loc_glue_callback_table[i].user = userData; + + args.event_callback = loc_glue_callback_table[i].cb_id; + LOC_LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback); + + rpc_loc_open_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + EXIT_LOG_CALLFLOW(%s, "loc client open"); + + /*try more for rpc_loc_open_xx()*/ + + do + { + stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt); + ret_val = (rpc_loc_client_handle_type) rets.loc_open_result; + try_num--; + + }while( (RPC_SUCCESS != stat||0 > ret_val) && 0 != try_num ); + + LOC_GLUE_CHECK_RESULT(stat, int32); + + /* save the handle in the table */ + loc_glue_callback_table[i].handle = (rpc_loc_client_handle_type) rets.loc_open_result; + + return ret_val; + +} + +int32 loc_close +( + rpc_loc_client_handle_type handle +) +{ + ENTRY_LOG(); + LOC_GLUE_CHECK_INIT(int32); + + int32 ret_val; + + rpc_loc_close_args args; + args.handle = handle; + + rpc_loc_close_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + EXIT_LOG_CALLFLOW(%s, "loc client close"); + stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt); + + loc_clear(handle); + + LOC_GLUE_CHECK_RESULT(stat, int32); + ret_val = (int32) rets.loc_close_result; + + return ret_val; +} + +void loc_clear(rpc_loc_client_handle_type handle) { + /* Clean the client's callback function in callback table */ + int i; + for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++) + { + if (loc_glue_callback_table[i].handle == handle) + { + /* Found the client */ + loc_glue_callback_table[i].cb_func = NULL; + loc_glue_callback_table[i].rpc_cb = NULL; + loc_glue_callback_table[i].handle = -1; + loc_glue_callback_table[i].user = NULL; + break; + } + } + + if (i == LOC_API_CB_MAX_CLIENTS) + { + LOC_LOGW("Handle not found (handle=%d)...\n", (int) handle); + } +} + +int32 loc_start_fix +( + rpc_loc_client_handle_type handle +) +{ + ENTRY_LOG(); + LOC_GLUE_CHECK_INIT(int32); + + int32 ret_val; + + rpc_loc_start_fix_args args; + args.handle = handle; + + rpc_loc_start_fix_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + EXIT_LOG_CALLFLOW(%s, "loc start fix"); + stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + ret_val = (int32) rets.loc_start_fix_result; + + return ret_val; +} + +int32 loc_stop_fix +( + rpc_loc_client_handle_type handle +) +{ + ENTRY_LOG(); + LOC_GLUE_CHECK_INIT(int32); + + int32 ret_val; + + rpc_loc_stop_fix_args args; + args.handle = handle; + + rpc_loc_stop_fix_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + EXIT_LOG_CALLFLOW(%s, "loc stop fix"); + stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + ret_val = (int32) rets.loc_stop_fix_result; + + return ret_val; +} + +int32 loc_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data +) +{ + ENTRY_LOG(); + LOC_GLUE_CHECK_INIT(int32); + + int32 ret_val; + + rpc_loc_ioctl_args args; + args.handle = handle; + args.ioctl_data = ioctl_data; + args.ioctl_type = ioctl_type; + if (ioctl_data != NULL) + { + /* Assign ioctl union discriminator */ + ioctl_data->disc = ioctl_type; + + /* In case the user hasn't filled in other disc fields, + automatically fill them in here */ + switch (ioctl_type) + { + case RPC_LOC_IOCTL_GET_API_VERSION: + break; + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + break; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + break; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + break; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + break; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + break; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + break; + case RPC_LOC_IOCTL_INJECT_RTC_VALUE: + break; + case RPC_LOC_IOCTL_INJECT_POSITION: + break; + case RPC_LOC_IOCTL_QUERY_ENGINE_STATE: + break; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + break; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + break; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + break; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + break; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + break; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + break; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + break; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + break; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc = + args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type; + break; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + break; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + break; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + break; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + break; + default: + break; + } /* switch */ + } /* ioctl_data != NULL */ + + rpc_loc_ioctl_rets rets; + enum clnt_stat stat = RPC_SUCCESS; + + EXIT_LOG_CALLFLOW(%s, loc_get_ioctl_type_name(ioctl_type)); + stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + ret_val = (int32) rets.loc_ioctl_result; + + return ret_val; +} + +/* Returns 0 if error */ +int32 loc_api_null(void) +{ + LOC_GLUE_CHECK_INIT(int32); + + int32 rets; + enum clnt_stat stat = RPC_SUCCESS; + + clnt_unregister_reset_notification_cb(loc_api_clnt); + stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt); + LOC_GLUE_CHECK_RESULT(stat, int32); + + return (int32) rets; +} + +/*=========================================================================== + +FUNCTION loc_eng_ioctl + +DESCRIPTION + This function calls loc_ioctl and waits for the callback result before + returning back to the user. + +DEPENDENCIES + N/A + +RETURN VALUE + TRUE if successful + FALSE if failed + +SIDE EFFECTS + N/A + +===========================================================================*/ +int loc_eng_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data_ptr, + uint32 timeout_msec, + rpc_loc_ioctl_callback_s_type *cb_data_ptr +) +{ + int ret_val = RPC_LOC_API_SUCCESS; + + ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr); + + LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, returt %s\n", + (int32) handle, + loc_get_ioctl_type_name(ioctl_type), + loc_get_ioctl_status_name(ret_val) ); + + return ret_val; +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c new file mode 100644 index 0000000..ae629d7 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_api_sync_call.c @@ -0,0 +1,565 @@ +/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <stdio.h> +#include <assert.h> +#include <errno.h> +#include <sys/time.h> +#include <string.h> +#include <pthread.h> + +#include <rpc/rpc.h> +#include <loc_api_rpc_glue.h> +#include "loc_api_sync_call.h" + +/* Logging */ +#define LOG_TAG "LocSvc_api_rpc_glue" +// #define LOG_NDDEBUG 0 +#ifndef USE_GLIB +#include <utils/Log.h> +#endif /* USE_GLIB */ + +/*************************************************************************** + * DATA FOR ASYNCHRONOUS RPC PROCESSING + **************************************************************************/ +loc_sync_call_slot_array_s_type loc_sync_data; + +pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER; +boolean loc_sync_call_inited = 0; + +/*=========================================================================== + +FUNCTION loc_api_sync_call_init + +DESCRIPTION + Initialize this module + +DEPENDENCIES + N/A + +RETURN VALUE + none + +SIDE EFFECTS + N/A + +===========================================================================*/ +void loc_api_sync_call_init() +{ + pthread_mutex_lock(&loc_sync_call_mutex); + if (loc_sync_call_inited == 1) { + pthread_mutex_unlock(&loc_sync_call_mutex); + return; + } + loc_sync_call_inited = 1; + + loc_sync_data.num_of_slots = LOC_SYNC_CALL_SLOTS_MAX; + + int i; + for (i = 0; i < loc_sync_data.num_of_slots; i++) + { + loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i]; + + pthread_mutex_init(&slot->lock, NULL); + pthread_cond_init(&slot->loc_cb_arrived_cond, NULL); + + slot->not_available = 0; + slot->in_use = 0; + slot->loc_handle = -1; + slot->loc_cb_wait_event_mask = 0; /* event to wait */ + slot->loc_cb_received_event_mask = 0; /* received event */ + } + + pthread_mutex_unlock(&loc_sync_call_mutex); +} + +/*=========================================================================== + +FUNCTION loc_api_sync_call_destroy + +DESCRIPTION + Initialize this module + +DEPENDENCIES + N/A + +RETURN VALUE + none + +SIDE EFFECTS + N/A + +===========================================================================*/ +void loc_api_sync_call_destroy() +{ + int i; + + pthread_mutex_lock(&loc_sync_call_mutex); + if (loc_sync_call_inited == 0) { + pthread_mutex_unlock(&loc_sync_call_mutex); + return; + } + loc_sync_call_inited = 0; + + for (i = 0; i < loc_sync_data.num_of_slots; i++) + { + loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i]; + + pthread_mutex_lock(&slot->lock); + + slot->not_available = 1; + + pthread_mutex_unlock(&slot->lock); + + pthread_cond_destroy(&slot->loc_cb_arrived_cond); + pthread_mutex_destroy(&slot->lock); + } + + pthread_mutex_unlock(&loc_sync_call_mutex); +} + +/*=========================================================================== + +FUNCTION loc_match_callback + +DESCRIPTION + Checks if an awaited event has arrived + +RETURN VALUE + TRUE arrived + FALSE not matching + +===========================================================================*/ +static boolean loc_match_callback( + rpc_loc_event_mask_type wait_mask, + rpc_loc_ioctl_e_type wait_ioctl, + rpc_loc_event_mask_type event_mask, + const rpc_loc_event_payload_u_type *callback_payload +) +{ + if ((event_mask & wait_mask) == 0) return FALSE; + + if (event_mask != RPC_LOC_EVENT_IOCTL_REPORT || wait_ioctl == 0 || + ( (callback_payload != NULL) && + callback_payload->rpc_loc_event_payload_u_type_u.ioctl_report.type == wait_ioctl) ) + return TRUE; + + return FALSE; +} + +/*=========================================================================== + +FUNCTION loc_api_callback_process_sync_call + +DESCRIPTION + Wakes up blocked API calls to check if the needed callback has arrived + +DEPENDENCIES + N/A + +RETURN VALUE + none + +SIDE EFFECTS + N/A + +===========================================================================*/ +void loc_api_callback_process_sync_call( + rpc_loc_client_handle_type loc_handle, /* handle of the client */ + rpc_loc_event_mask_type loc_event, /* event mask */ + const rpc_loc_event_payload_u_type* loc_event_payload /* payload */ +) +{ + int i; + + ALOGV("loc_handle = 0x%lx, loc_event = 0x%lx", loc_handle, loc_event); + for (i = 0; i < loc_sync_data.num_of_slots; i++) + { + loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i]; + + pthread_mutex_lock(&slot->lock); + + if (slot->in_use && + slot->signal_sent == 0 && + slot->loc_handle == loc_handle && + loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload)) + { + memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type)); + + slot->loc_cb_received_event_mask = loc_event; + + ALOGV("signal slot %d in_use %d, loc_handle 0x%lx, event_mask 0x%1x, ioctl_type %d", i, slot->in_use, slot->loc_handle, (int) slot->loc_cb_wait_event_mask, (int) slot->ioctl_type); + pthread_cond_signal(&slot->loc_cb_arrived_cond); + slot->signal_sent = 1; + + pthread_mutex_unlock(&slot->lock); + break; + } else { + /* do nothing */ + } + + pthread_mutex_unlock(&slot->lock); + } +} + +/*=========================================================================== + +FUNCTION loc_lock_a_slot + +DESCRIPTION + Allocates a buffer slot for the synchronous API call + +DEPENDENCIES + N/A + +RETURN VALUE + Select ID (>=0) : successful + -1 : buffer full + +SIDE EFFECTS + N/A + +===========================================================================*/ +static int loc_lock_a_slot() +{ + int i, select_id = -1; /* no free buffer */ + + for (i = 0; i < loc_sync_data.num_of_slots; i++) + { + loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[i]; + if (pthread_mutex_trylock(&slot->lock) == EBUSY) + { + ALOGV("trylock EBUSY : %d", i); + continue; + } + + if (!slot->in_use && !slot->not_available) + { + select_id = i; + /* Return from here and leave the mutex locked. + * will unlock it in loc_unlock_slot() + */ + break; + } + /* ALOGV("slot %d in_use = %d, not_available = %d : %d", i, slot->in_use, slot->not_available, i); */ + pthread_mutex_unlock(&slot->lock); + } + + return select_id; +} + +/*=========================================================================== + +FUNCTION loc_unlock_slot + +DESCRIPTION + Unlocks a buffer slot + +DEPENDENCIES + N/A + +RETURN VALUE + None + +SIDE EFFECTS + N/A + +===========================================================================*/ +static void loc_unlock_slot(int select_id) +{ + pthread_mutex_unlock(&loc_sync_data.slots[select_id].lock); +} + +/*=========================================================================== + +FUNCTION loc_lock_slot + +DESCRIPTION + Locks a specific slot that was previously locked from loc_lock_a_slot + +DEPENDENCIES + N/A + +RETURN VALUE + None + +SIDE EFFECTS + N/A + +===========================================================================*/ +static void loc_lock_slot(int select_id) +{ + pthread_mutex_lock(&loc_sync_data.slots[select_id].lock); +} + +/*=========================================================================== + +FUNCTION loc_set_slot_in_use + +DESCRIPTION + Sets the in_use flag of slot to true or false. + Should be called only after the slot is locked + +DEPENDENCIES + N/A + +RETURN VALUE + None + +SIDE EFFECTS + N/A + +===========================================================================*/ +static void loc_set_slot_in_use(int select_id, boolean in_use) +{ + loc_sync_data.slots[select_id].in_use = in_use; + if (in_use == 1) + loc_sync_data.slots[select_id].signal_sent = 0; +} + +/*=========================================================================== + +FUNCTION loc_api_save_callback + +DESCRIPTION + Selects which callback or IOCTL event to wait for. + + The event_mask specifies the event(s). If it is RPC_LOC_EVENT_IOCTL_REPORT, + then ioctl_type specifies the IOCTL event. + + If ioctl_type is non-zero, RPC_LOC_EVENT_IOCTL_REPORT is automatically added. + +DEPENDENCIES + N/A + +RETURN VALUE + Select ID (>=0) : successful + -1 : out of buffer + +SIDE EFFECTS + N/A + +===========================================================================*/ +static void loc_api_save_callback( + int select_id, /* Selected slot */ + rpc_loc_client_handle_type loc_handle, /* Client handle */ + rpc_loc_event_mask_type event_mask, /* Event mask to wait for */ + rpc_loc_ioctl_e_type ioctl_type /* IOCTL type to wait for */ +) +{ + loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id]; + + slot->loc_handle = loc_handle; + + slot->loc_cb_wait_event_mask = event_mask; + slot->ioctl_type = ioctl_type; + if (ioctl_type) slot->loc_cb_wait_event_mask |= RPC_LOC_EVENT_IOCTL_REPORT; + + return; +} + +/*=========================================================================== + +FUNCTION loc_save_user_payload + +DESCRIPTION + Saves received payload into user data structures + +RETURN VALUE + None + +===========================================================================*/ +static void loc_save_user_payload( + rpc_loc_event_payload_u_type *user_cb_payload, + rpc_loc_ioctl_callback_s_type *user_ioctl_buffer, + const rpc_loc_event_payload_u_type *received_cb_payload +) +{ + if (user_cb_payload) + { + memcpy(user_cb_payload, received_cb_payload, + sizeof (rpc_loc_event_payload_u_type)); + } + if (user_ioctl_buffer) + { + memcpy(user_ioctl_buffer, + &received_cb_payload->rpc_loc_event_payload_u_type_u.ioctl_report, + sizeof *user_ioctl_buffer); + } +} + +/*=========================================================================== + +FUNCTION loc_api_wait_callback + +DESCRIPTION + Waits for a selected callback. The wait expires in timeout_seconds seconds. + + If the function is called before an existing wait has finished, it will + immediately return EBUSY. + +DEPENDENCIES + N/A + +RETURN VALUE + RPC_LOC_API_SUCCESS if successful (0) + RPC_LOC_API_TIMEOUT if timed out + RPC_LOC_API_ENGINE_BUSY if already in a wait + RPC_LOC_API_INVALID_PARAMETER if callback is not yet selected + +SIDE EFFECTS + N/A + +===========================================================================*/ +static int loc_api_wait_callback( + int select_id, /* ID from loc_select_callback() */ + int timeout_seconds, /* Timeout in this number of seconds */ + rpc_loc_event_payload_u_type *callback_payload, /* Pointer to callback payload buffer, can be NULL */ + rpc_loc_ioctl_callback_s_type *ioctl_payload /* Pointer to IOCTL payload, can be NULL */ +) +{ + int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */ + int rc = 0; /* return code from pthread calls */ + + struct timespec expire_time; + + loc_sync_call_slot_s_type *slot = &loc_sync_data.slots[select_id]; + + clock_gettime(CLOCK_REALTIME, &expire_time); + expire_time.tv_sec += timeout_seconds; + + /* Waiting */ + while (slot->signal_sent == 0 && rc != ETIMEDOUT) { + rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond, + &slot->lock, &expire_time); + } + + if (rc == ETIMEDOUT) + { + ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */ + ALOGE("TIMEOUT: %d", select_id); + } + else { + /* Obtained the first awaited callback */ + ret_val = RPC_LOC_API_SUCCESS; /* Successful */ + loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload); + } + + return ret_val; +} + +/*=========================================================================== + +FUNCTION loc_api_sync_ioctl + +DESCRIPTION + Synchronous IOCTL call (reentrant version) + +DEPENDENCIES + N/A + +RETURN VALUE + Loc API error code (0 = success) + +SIDE EFFECTS + N/A + +===========================================================================*/ +int loc_api_sync_ioctl +( + rpc_loc_client_handle_type handle, + rpc_loc_ioctl_e_type ioctl_type, + rpc_loc_ioctl_data_u_type* ioctl_data_ptr, + uint32 timeout_msec, + rpc_loc_ioctl_callback_s_type *cb_data_ptr +) +{ + int rc = -1; + int select_id; + rpc_loc_ioctl_callback_s_type callback_data; + + select_id = loc_lock_a_slot(); + + if (select_id < 0 || select_id >= loc_sync_data.num_of_slots) + { + ALOGE("slot not available ioctl_type = %s", + loc_get_ioctl_type_name(ioctl_type)); + return rc; + } + + loc_set_slot_in_use(select_id, 1); // set slot in use to true + + // Select the callback we are waiting for + loc_api_save_callback(select_id, handle, 0, ioctl_type); + + loc_unlock_slot(select_id); // slot is unlocked, but in_use is still true + + // we want to avoid keeping the slot locked during the loc_ioctl because the rpc + // framework will also lock a different mutex during this call, and typically + // locking two different mutexes at the same time can lead to deadlock. + rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr); + + loc_lock_slot(select_id); + + if (rc != RPC_LOC_API_SUCCESS) + { + ALOGE("loc_ioctl failed select_id = %d, ioctl_type %s, returned %s", + select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc)); + } + else { + ALOGV("select_id = %d, ioctl_type %d, returned RPC_LOC_API_SUCCESS", + select_id, ioctl_type); + // Wait for the callback of loc_ioctl + if ((rc = loc_api_wait_callback(select_id, timeout_msec / 1000, NULL, &callback_data)) != 0) + { + // Callback waiting failed + ALOGE("callback wait failed select_id = %d, ioctl_type %s, returned %s", + select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc)); + } + else + { + if (cb_data_ptr) memcpy(cb_data_ptr, &callback_data, sizeof *cb_data_ptr); + if (callback_data.status != RPC_LOC_API_SUCCESS) + { + rc = callback_data.status; + ALOGE("callback status failed select_id = %d, ioctl_type %s, returned %s", + select_id, loc_get_ioctl_type_name(ioctl_type), loc_get_ioctl_status_name(rc)); + } else { + ALOGV("callback status success select_id = %d, ioctl_type %d, returned %d", + select_id, ioctl_type, rc); + } + } /* wait callback */ + } /* loc_ioctl */ + + loc_set_slot_in_use(select_id, 0); // set slot in use to false + loc_unlock_slot(select_id); + + return rc; +} + + diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c new file mode 100644 index 0000000..db5b291 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-glue/src/loc_apicb_appinit.c @@ -0,0 +1,86 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "rpc/rpc.h" + +/* Include RPC headers */ +#ifdef USE_LOCAL_RPC +#include "rpc_inc/loc_api_common.h" +#include "rpc_inc/loc_api.h" +#include "rpc_inc/loc_api_cb.h" +#endif + +#ifdef USE_QCOM_AUTO_RPC +#include "loc_api_rpcgen_rpc.h" +#include "loc_api_rpcgen_common_rpc.h" +#include "loc_api_rpcgen_cb_rpc.h" +#endif + +#include "rpc_inc/loc_api_fixup.h" +#include "loc_apicb_appinit.h" + +#define RPC_FUNC_VERSION_BASE(a,b) a ## b +#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b) + +static SVCXPRT* svrPort = NULL; + +extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp); + +int loc_apicb_app_init(void) +{ + + /* Register a callback server to use the loc_apicbprog_* function */ + if (svrPort == NULL) { + svrPort = svcrtr_create(); + } + if (!svrPort) return -1; + + xprt_register(svrPort); + if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0)) + { + return 0; + } + else + { + return -1; + } +} + +void loc_apicb_app_deinit(void) +{ + if (svrPort == NULL) + { + return; + } + + svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001); + xprt_unregister(svrPort); + svc_destroy(svrPort); + svrPort = NULL; +} + diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk new file mode 100644 index 0000000..c0987e6 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Android.mk @@ -0,0 +1,36 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +# functions +LOC_RPCGEN_APIS_PATH := $(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates +LOC_RPCGEN_APIS_PATH_FL := ../../../../../$(TARGET_OUT_INTERMEDIATES)/loc_api/libloc_api_rpcgen_intermediates + +LOCAL_MODULE := libloc_api_rpcgen +LOCAL_MODULE_OWNER := qcom + +LOCAL_SHARED_LIBRARIES := \ + librpc \ + libcommondefs + +LOCAL_SRC_FILES += \ + src/loc_api_rpcgen_cb_xdr.c \ + src/loc_api_rpcgen_common_xdr.c \ + src/loc_api_rpcgen_cb_svc.c \ + src/loc_api_rpcgen_clnt.c \ + src/loc_api_rpcgen_xdr.c + +LOCAL_C_INCLUDES += hardware/msm7k/librpc +LOCAL_C_INCLUDES += $(LOC_RPCGEN_APIS_PATH)/../../SHARED_LIBRARIES/libcommondefs_intermediates/inc +LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc +LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libcommondefs/rpcgen/inc + +LOCAL_COPY_HEADERS_TO := loc_api/rpcgen/inc +LOCAL_COPY_HEADERS := inc/loc_api_rpcgen_rpc.h +LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_common_rpc.h +LOCAL_COPY_HEADERS += inc/loc_api_rpcgen_cb_rpc.h +LOCAL_COPY_HEADERS += inc/loc_apicb_appinit.h + +LOCAL_LDLIBS += -lpthread +LOCAL_PRELINK_MODULE := false +include $(BUILD_STATIC_LIBRARY) diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am new file mode 100644 index 0000000..4ac8c8a --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/Makefile.am @@ -0,0 +1,42 @@ +AM_CFLAGS = \ + -I../../../utils \ + -I./inc \ + $(MSM7K_CFLAGS) + +requiredlibs = \ + ../../../utils/libgps_utils_so.la \ + $(MSM7K_LIBS) + +h_sources = \ + inc/loc_api_rpcgen_rpc.h \ + inc/loc_api_rpcgen_common_rpc.h \ + inc/loc_api_rpcgen_cb_rpc.h \ + inc/loc_apicb_appinit.h + +c_sources = \ + src/loc_api_rpcgen_cb_xdr.c \ + src/loc_api_rpcgen_common_xdr.c \ + src/loc_api_rpcgen_cb_svc.c \ + src/loc_api_rpcgen_clnt.c \ + src/loc_api_rpcgen_xdr.c + + + +library_includedir = $(pkgincludedir)/libloc_api-rpc-50001/libloc_api-rpc-stub/inc +library_include_HEADERS = $(h_sources) +libloc_api_rpcgen_la_SOURCES = $(c_sources) $(h_sources) + +if USE_GLIB +libloc_api_rpcgen_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ +libloc_api_rpcgen_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 +libloc_api_rpcgen_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ +else +libloc_api_rpcgen_la_CFLAGS = $(AM_CFLAGS) +libloc_api_rpcgen_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 +libloc_api_rpcgen_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) +endif + +libloc_api_rpcgen_la_LIBADD = $(requiredlibs) -lstdc++ + +#Create and Install Libraries +lib_LTLIBRARIES = libloc_api_rpcgen.la diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h new file mode 100644 index 0000000..87f2c37 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_cb_rpc.h @@ -0,0 +1,156 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_CB_RPC_H_RPCGEN +#define _LOC_API_CB_RPC_H_RPCGEN + +#include "librpc.h" +#include "commondefs_rpcgen_rpc.h" +#include "loc_api_rpcgen_common_rpc.h" + +#include <pthread.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +struct rpc_loc_event_cb_f_type_args { + rpc_uint32 cb_id; + rpc_loc_client_handle_type loc_handle; + rpc_loc_event_mask_type loc_event; + rpc_loc_event_payload_u_type *loc_event_payload; +}; +typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args; + +struct rpc_loc_event_cb_f_type_rets { + rpc_int32 loc_event_cb_f_type_result; +}; +typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets; +#define LOC_APICBVERS 0x00050006 + +#define LOC_APICBPROG 0x3100008C +#define LOC_APICBVERS_0001 0x00050001 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_event_cb_f_type 1 +extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *); +extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *); +extern int loc_apicbprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_event_cb_f_type 1 +extern enum clnt_stat rpc_loc_event_cb_f_type_0x00050001(); +extern bool_t rpc_loc_event_cb_f_type_0x00050001_svc(); +extern int loc_apicbprog_0x00050001_freeresult (); +#endif /* K&R C */ +#define LOC_APICBVERS_0002 0x00050002 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_api_cb_null 0xffffff00 +extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(void *, int *, CLIENT *); +extern bool_t rpc_loc_api_cb_null_0x00050002_svc(void *, int *, struct svc_req *); +extern int loc_apicbprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_api_cb_null 0xffffff00 +extern enum clnt_stat rpc_loc_api_cb_null_0x00050002(); +extern bool_t rpc_loc_api_cb_null_0x00050002_svc(); +extern int loc_apicbprog_0x00050002_freeresult (); +#endif /* K&R C */ +#define LOC_APICBVERS_0003 0x00050003 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(void *, int *, CLIENT *); +extern bool_t rpc_loc_api_cb_null_0x00050003_svc(void *, int *, struct svc_req *); +extern int loc_apicbprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_cb_null_0x00050003(); +extern bool_t rpc_loc_api_cb_null_0x00050003_svc(); +extern int loc_apicbprog_0x00050003_freeresult (); +#endif /* K&R C */ +#define LOC_APICBVERS_0004 0x00050004 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(void *, int *, CLIENT *); +extern bool_t rpc_loc_api_cb_null_0x00050004_svc(void *, int *, struct svc_req *); +extern int loc_apicbprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_cb_null_0x00050004(); +extern bool_t rpc_loc_api_cb_null_0x00050004_svc(); +extern int loc_apicbprog_0x00050004_freeresult (); +#endif /* K&R C */ +#define LOC_APICBVERS_0005 0x00050005 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(void *, int *, CLIENT *); +extern bool_t rpc_loc_api_cb_null_0x00050005_svc(void *, int *, struct svc_req *); +extern int loc_apicbprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_cb_null_0x00050005(); +extern bool_t rpc_loc_api_cb_null_0x00050005_svc(); +extern int loc_apicbprog_0x00050005_freeresult (); +#endif /* K&R C */ +#define LOC_APICBVERS_0006 0x00050006 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(void *, int *, CLIENT *); +extern bool_t rpc_loc_api_cb_null_0x00050006_svc(void *, int *, struct svc_req *); +extern int loc_apicbprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_cb_null_0x00050006(); +extern bool_t rpc_loc_api_cb_null_0x00050006_svc(); +extern int loc_apicbprog_0x00050006_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*); +extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_event_cb_f_type_args (); +extern bool_t xdr_rpc_loc_event_cb_f_type_rets (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_CB_RPC_H_RPCGEN */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h new file mode 100644 index 0000000..8107de2 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_common_rpc.h @@ -0,0 +1,1261 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_COMMON_RPC_H_RPCGEN +#define _LOC_API_COMMON_RPC_H_RPCGEN + +#include "librpc.h" +#include "commondefs_rpcgen_rpc.h" + +#include <pthread.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define LOC_API_TOOLVERS 0x00040030 +#define LOC_API_FEATURES 0x00000001 +#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 +#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 +#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200 +#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 +#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 +#define RPC_LOC_EVENT_RESERVED 0x8000000000000000 +#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 +#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 +#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 +#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 +#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 +#define RPC_LOC_API_CB_NULL_VERSION 0x00050002 +#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001 +#define RPC_LOC_API_API_VERSIONS_VERSION 0x00050001 +#define RPC_LOC_STOP_FIX_VERSION 0x00050001 +#define RPC_LOC_START_FIX_VERSION 0x00050001 +#define RPC_LOC_IOCTL_VERSION 0x00050001 +#define RPC_LOC_CLOSE_VERSION 0x00050001 +#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001 +#define RPC_LOC_OPEN_VERSION 0x00050001 +#define RPC_LOC_API_NULL_VERSION 0x00050001 +#define RPC_LOC_API_API_MAJOR_NUM 0x0005 +#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0 + +typedef rpc_int32 rpc_loc_client_handle_type; + +typedef rpc_uint64 rpc_loc_event_mask_type; + +typedef rpc_uint64 rpc_loc_position_valid_mask_type; + +typedef rpc_uint32 rpc_loc_pos_technology_mask_type; + +enum rpc_loc_session_status_e_type { + RPC_LOC_SESS_STATUS_SUCCESS = 0, + RPC_LOC_SESS_STATUS_IN_PROGESS = 1, + RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, + RPC_LOC_SESS_STATUS_TIMEOUT = 3, + RPC_LOC_SESS_STATUS_USER_END = 4, + RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, + RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, + RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, + RPC_LOC_SESS_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type; + +struct rpc_loc_calendar_time_s_type { + rpc_uint16 year; + u_char month; + u_char day_of_week; + u_char day; + u_char hour; + u_char minute; + u_char second; + rpc_uint16 millisecond; +}; +typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type; + +struct rpc_loc_parsed_position_s_type { + rpc_loc_position_valid_mask_type valid_mask; + rpc_loc_session_status_e_type session_status; + rpc_loc_calendar_time_s_type timestamp_calendar; + rpc_uint64 timestamp_utc; + rpc_uint8 leap_seconds; + float time_unc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float speed_horizontal; + float speed_vertical; + float heading; + float hor_unc_circular; + float hor_unc_ellipse_semi_major; + float hor_unc_ellipse_semi_minor; + float hor_unc_ellipse_orient_azimuth; + float vert_unc; + float speed_unc; + float heading_unc; + u_char confidence_horizontal; + u_char confidence_vertical; + float magnetic_deviation; + rpc_loc_pos_technology_mask_type technology_mask; +}; +typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type; + +enum rpc_loc_sv_system_e_type { + RPC_LOC_SV_SYSTEM_GPS = 1, + RPC_LOC_SV_SYSTEM_GALILEO = 2, + RPC_LOC_SV_SYSTEM_SBAS = 3, + RPC_LOC_SV_SYSTEM_COMPASS = 4, + RPC_LOC_SV_SYSTEM_GLONASS = 5, + RPC_LOC_SV_SYSTEM_MAX = 268435456, +}; +typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type; + +enum rpc_loc_sv_status_e_type { + RPC_LOC_SV_STATUS_IDLE = 1, + RPC_LOC_SV_STATUS_SEARCH = 2, + RPC_LOC_SV_STATUS_TRACK = 3, + RPC_LOC_SV_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type; + +typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; + +struct rpc_loc_sv_info_s_type { + rpc_loc_sv_info_valid_mask_type valid_mask; + rpc_loc_sv_system_e_type system; + rpc_uint8 prn; + rpc_uint8 health_status; + rpc_loc_sv_status_e_type process_status; + rpc_boolean has_eph; + rpc_boolean has_alm; + float elevation; + float azimuth; + float snr; +}; +typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type; + +typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; + +struct rpc_loc_gnss_info_s_type { + rpc_loc_gnss_info_valid_mask_type valid_mask; + float position_dop; + float horizontal_dop; + float vertical_dop; + rpc_boolean altitude_assumed; + rpc_uint16 sv_count; + struct { + u_int sv_list_len; + rpc_loc_sv_info_s_type *sv_list_val; + } sv_list; +}; +typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type; + +struct rpc_loc_nmea_report_s_type { + rpc_uint16 length; + char nmea_sentences[200]; +}; +typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type; + +enum rpc_loc_status_event_e_type { + RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, + RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2, + RPC_LOC_STATUS_EVENT_MAX = 268435456, +}; +typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type; + +enum rpc_loc_engine_state_e_type { + RPC_LOC_ENGINE_STATE_ON = 1, + RPC_LOC_ENGINE_STATE_OFF = 2, + RPC_LOC_ENGINE_STATE_MAX = 268435456, +}; +typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type; + +enum rpc_loc_fix_session_state_e_type { + RPC_LOC_FIX_SESSION_STATE_BEGIN = 1, + RPC_LOC_FIX_SESSION_STATE_END = 2, + RPC_LOC_FIX_SESSION_STATE_MAX = 268435456, +}; +typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type; + +struct rpc_loc_status_event_payload_u_type { + rpc_loc_status_event_e_type disc; + union { + rpc_loc_engine_state_e_type engine_state; + rpc_loc_fix_session_state_e_type fix_session_state; + } rpc_loc_status_event_payload_u_type_u; +}; +typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type; + +struct rpc_loc_status_event_s_type { + rpc_loc_status_event_e_type event; + rpc_loc_status_event_payload_u_type payload; +}; +typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type; + +enum rpc_loc_server_addr_e_type { + RPC_LOC_SERVER_ADDR_IPV4 = 1, + RPC_LOC_SERVER_ADDR_URL = 2, + RPC_LOC_SERVER_ADDR_IPV6 = 3, + RPC_LOC_SERVER_ADDR_MAX = 268435456, +}; +typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type; + +struct rpc_loc_server_addr_ipv4_type { + rpc_uint32 addr; + rpc_uint16 port; +}; +typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type; + +struct rpc_loc_server_addr_url_type { + rpc_uint16 length; + char addr[256]; +}; +typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type; + +struct rpc_loc_server_addr_ipv6_type { + rpc_uint16 addr[8]; + rpc_uint32 port; +}; +typedef struct rpc_loc_server_addr_ipv6_type rpc_loc_server_addr_ipv6_type; + +struct rpc_loc_server_addr_u_type { + rpc_loc_server_addr_e_type disc; + union { + rpc_loc_server_addr_ipv4_type ipv4; + rpc_loc_server_addr_url_type url; + rpc_loc_server_addr_ipv6_type ipv6; + } rpc_loc_server_addr_u_type_u; +}; +typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type; + +struct rpc_loc_server_info_s_type { + rpc_loc_server_addr_e_type addr_type; + rpc_loc_server_addr_u_type addr_info; +}; +typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type; + +enum rpc_loc_ni_notify_verify_e_type { + RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, + RPC_LOC_NI_USER_NOTIFY_ONLY = 2, + RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, + RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, + RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, + RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type; + +enum rpc_loc_ni_event_e_type { + RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, + RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, + RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, + RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4, + RPC_LOC_NI_EVENT_MAX = 268435456, +}; +typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type; + +enum rpc_loc_ni_datacoding_scheme_e_type { + RPC_LOC_NI_PRESUPL_ISO646IRV = 0, + RPC_LOC_NI_PRESUPL_ISO8859 = 1, + RPC_LOC_NI_PRESUPL_UTF8 = 2, + RPC_LOC_NI_PRESUPL_UTF16 = 3, + RPC_LOC_NI_PRESUPL_UCS2 = 4, + RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, + RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, + RPC_LOC_NI_PRESUPL_JIS = 7, + RPC_LOC_NI_PRESUPL_EUC = 8, + RPC_LOC_NI_PRESUPL_GB2312 = 9, + RPC_LOC_NI_PRESUPL_CNS11643 = 10, + RPC_LOC_NI_PRESUPL_KSC1001 = 11, + RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, + RPC_LOC_NI_SS_GERMAN = 12, + RPC_LOC_NI_SS_ENGLISH = 13, + RPC_LOC_NI_SS_ITALIAN = 14, + RPC_LOC_NI_SS_FRENCH = 15, + RPC_LOC_NI_SS_SPANISH = 16, + RPC_LOC_NI_SS_DUTCH = 17, + RPC_LOC_NI_SS_SWEDISH = 18, + RPC_LOC_NI_SS_DANISH = 19, + RPC_LOC_NI_SS_PORTUGUESE = 20, + RPC_LOC_NI_SS_FINNISH = 21, + RPC_LOC_NI_SS_NORWEGIAN = 22, + RPC_LOC_NI_SS_GREEK = 23, + RPC_LOC_NI_SS_TURKISH = 24, + RPC_LOC_NI_SS_HUNGARIAN = 25, + RPC_LOC_NI_SS_POLISH = 26, + RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, + RPC_LOC_NI_SUPL_UTF8 = 28, + RPC_LOC_NI_SUPL_UCS2 = 29, + RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, + RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647, +}; +typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type; + +enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { + RPC_LOC_NI_VX_OCTET = 0, + RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, + RPC_LOC_NI_VX_ASCII = 2, + RPC_LOC_NI_VX_IA5 = 3, + RPC_LOC_NI_VX_UNICODE = 4, + RPC_LOC_NI_VX_SHIFT_JIS = 5, + RPC_LOC_NI_VX_KOREAN = 6, + RPC_LOC_NI_VX_LATIN_HEBREW = 7, + RPC_LOC_NI_VX_LATIN = 8, + RPC_LOC_NI_VX_GSM = 9, + RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type; + +enum rpc_loc_ni_vx_pos_mode_e_type { + RPC_LOC_VX_MS_ASSISTED_ONLY = 1, + RPC_LOC_VX_MS_BASED_ONLY = 2, + RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, + RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, + RPC_LOC_VX_POS_MODE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type; + +struct rpc_loc_ni_vx_requester_id_s_type { + u_char requester_id_length; + char requester_id[200]; +}; +typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type; + +struct rpc_loc_ni_vx_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + u_char pos_qos_incl; + u_char pos_qos; + rpc_uint32 num_fixes; + rpc_uint32 tbf; + rpc_loc_ni_vx_pos_mode_e_type pos_mode; + rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; + rpc_loc_ni_vx_requester_id_s_type requester_id; + rpc_uint16 user_resp_timer_val; +}; +typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type; + +enum rpc_loc_ni_supl_pos_method_e_type { + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, + RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, + RPC_LOC_NI_POSMETHOD_AFLT = 6, + RPC_LOC_NI_POSMETHOD_ECID = 7, + RPC_LOC_NI_POSMETHOD_EOTD = 8, + RPC_LOC_NI_POSMETHOD_OTDOA = 9, + RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, + RPC_LOC_NI_POSMETHOD_MAX = 268435456, +}; +typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type; + +struct rpc_loc_ni_supl_slp_session_id_s_type { + u_char presence; + char session_id[4]; + rpc_loc_server_info_s_type slp_address; +}; +typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type; + +struct rpc_loc_ni_requestor_id_s_type { + u_char data_coding_scheme; + char requestor_id_string[200]; + u_char string_len; +}; +typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type; + +struct rpc_loc_ni_supl_client_name_s_type { + u_char data_coding_scheme; + char client_name_string[64]; + u_char string_len; +}; +typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type; + +struct rpc_loc_ni_supl_qop_s_type { + u_char bit_mask; + u_char horacc; + u_char veracc; + rpc_uint16 maxLocAge; + u_char delay; +}; +typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type; + +struct rpc_loc_ni_supl_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + rpc_uint16 flags; + rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; + char supl_hash[8]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_supl_pos_method_e_type pos_method; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_supl_client_name_s_type client_name; + rpc_loc_ni_supl_qop_s_type supl_qop; + rpc_uint16 user_response_timer; +}; +typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type; + +struct rpc_loc_ni_ext_client_address_s_type { + u_char ext_client_address_len; + char ext_client_address[20]; +}; +typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type; + +enum rpc_loc_ni_location_type_e_type { + RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, + RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, + RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, + RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456, +}; +typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type; + +struct rpc_loc_ni_deferred_location_s_type { + u_char unused_bits; + u_char ms_available; +}; +typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type; + +struct rpc_loc_ni_codeword_string_s_type { + u_char data_coding_scheme; + char lcs_codeword_string[20]; + u_char string_len; +}; +typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type; + +struct rpc_loc_ni_service_type_id_s_type { + u_char lcs_service_type_id; +}; +typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type; + +struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + u_char invoke_id; + rpc_uint16 flags; + u_char notification_length; + char notification_text[64]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_ext_client_address_s_type ext_client_address_data; + rpc_loc_ni_location_type_e_type location_type; + rpc_loc_ni_deferred_location_s_type deferred_location; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_codeword_string_s_type codeword_string; + rpc_loc_ni_service_type_id_s_type service_type_id; + rpc_uint16 user_response_timer; +}; +typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type; + +enum rpc_loc_ni_service_interaction_e_type { + RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1, + RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456, +}; +typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type; + +struct rpc_loc_ni_vx_service_interaction_req_s_type { + rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req; + rpc_loc_ni_service_interaction_e_type service_interation_type; +}; +typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type; + +struct rpc_loc_ni_event_payload_u_type { + rpc_loc_ni_event_e_type disc; + union { + rpc_loc_ni_vx_notify_verify_req_s_type vx_req; + rpc_loc_ni_supl_notify_verify_req_s_type supl_req; + rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; + rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req; + } rpc_loc_ni_event_payload_u_type_u; +}; +typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type; + +struct rpc_loc_ni_event_s_type { + rpc_loc_ni_event_e_type event; + rpc_loc_ni_event_payload_u_type payload; +}; +typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type; + +enum rpc_loc_assist_data_request_e_type { + RPC_LOC_ASSIST_DATA_TIME_REQ = 1, + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, + RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3, + RPC_LOC_ASSIST_DATA_MAX = 268435456, +}; +typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type; + +typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr; + +typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; + +struct rpc_loc_time_download_source_s_type { + rpc_uint32 delay_threshold; + rpc_struct_loc_time_download_source_s_type_servers servers; +}; +typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type; + +typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr; + +typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; + +struct rpc_loc_predicted_orbits_data_source_s_type { + rpc_uint32 max_file_size; + rpc_uint32 max_part_size; + rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; +}; +typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type; + +struct rpc_loc_pos_inj_request_s_type { + rpc_uint32 flags; + double latitude; + double longitude; + rpc_uint32 position_uncertainty; + rpc_uint64 timestamp; +}; +typedef struct rpc_loc_pos_inj_request_s_type rpc_loc_pos_inj_request_s_type; + +struct rpc_loc_assist_data_request_payload_u_type { + rpc_loc_assist_data_request_e_type disc; + union { + rpc_loc_time_download_source_s_type time_download; + rpc_loc_predicted_orbits_data_source_s_type data_download; + rpc_loc_pos_inj_request_s_type pos_injection; + } rpc_loc_assist_data_request_payload_u_type_u; +}; +typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type; + +struct rpc_loc_assist_data_request_s_type { + rpc_loc_assist_data_request_e_type event; + rpc_loc_assist_data_request_payload_u_type payload; +}; +typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type; + +typedef rpc_uint32 rpc_loc_server_connection_handle; + +enum rpc_loc_server_protocol_e_type { + RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, + RPC_LOC_SERVER_PROTOCOL_SUPL = 1, + RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, + RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, + RPC_LOC_SERVER_PROTOCOL_MAX = 16777216, +}; +typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type; + +enum rpc_loc_server_connection_e_type { + RPC_LOC_SERVER_CONNECTION_LBS = 0, + RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET = 0 + 1, + RPC_LOC_SERVER_CONNECTION_MAX = 16777216, +}; +typedef enum rpc_loc_server_connection_e_type rpc_loc_server_connection_e_type; + +enum rpc_loc_server_request_e_type { + RPC_LOC_SERVER_REQUEST_OPEN = 1, + RPC_LOC_SERVER_REQUEST_CLOSE = 2, + RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3, + RPC_LOC_SERVER_REQUEST_MAX = 268435456, +}; +typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type; + +struct rpc_loc_server_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; +}; +typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type; + +struct rpc_loc_server_multi_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; + rpc_loc_server_connection_e_type connection_type; +}; +typedef struct rpc_loc_server_multi_open_req_s_type rpc_loc_server_multi_open_req_s_type; + +struct rpc_loc_server_close_req_s_type { + rpc_loc_server_connection_handle conn_handle; +}; +typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type; + +struct rpc_loc_server_request_u_type { + rpc_loc_server_request_e_type disc; + union { + rpc_loc_server_open_req_s_type open_req; + rpc_loc_server_close_req_s_type close_req; + rpc_loc_server_multi_open_req_s_type multi_open_req; + } rpc_loc_server_request_u_type_u; +}; +typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type; + +struct rpc_loc_server_request_s_type { + rpc_loc_server_request_e_type event; + rpc_loc_server_request_u_type payload; +}; +typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type; + +enum rpc_loc_qwip_request_e_type { + RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0, + RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1, + RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2, + RPC_LOC_QWIP_SUSPEND = 0 + 3, + RPC_LOC_QWIP_REQUEST_MAX = 268435456, +}; +typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type; + +struct rpc_loc_qwip_request_s_type { + rpc_loc_qwip_request_e_type request_type; + rpc_uint16 tbf_ms; +}; +typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type; + +struct rpc_loc_reserved_payload_s_type { + rpc_uint16 data_size; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type; + +enum rpc_loc_ioctl_e_type { + RPC_LOC_IOCTL_GET_API_VERSION = 1, + RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, + RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, + RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, + RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, + RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, + RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, + RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, + RPC_LOC_IOCTL_INJECT_POSITION = 407, + RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, + RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, + RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, + RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411, + RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412, + RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413, + RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414, + RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415, + RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, + RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, + RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, + RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, + RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, + RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, + RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, + RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, + RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, + RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, + RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, + RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, + RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, + RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, + RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, + RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814, + RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815, + RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816, + RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817, + RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818, + RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819, + RPC_LOC_IOCTL_SET_DATA_ENABLE = 820, + RPC_LOC_IOCTL_SET_SUPL_VERSION = 821, + RPC_LOC_IOCTL_GET_SUPL_VERSION = 822, + RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, + RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, + RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, + RPC_LOC_IOCTL_RESERVED_CMD = 8000, + RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824, +}; +typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type; + +struct rpc_loc_api_version_s_type { + u_char major; + u_char minor; +}; +typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type; + +enum rpc_loc_fix_recurrence_e_type { + RPC_LOC_PERIODIC_FIX = 1, + RPC_LOC_SINGLE_FIX = 2, + RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type; + +enum rpc_loc_operation_mode_e_type { + RPC_LOC_OPER_MODE_DEFAULT = 1, + RPC_LOC_OPER_MODE_MSB = 2, + RPC_LOC_OPER_MODE_MSA = 3, + RPC_LOC_OPER_MODE_STANDALONE = 4, + RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, + RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, + RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, + RPC_LOC_OPER_MODE_CELL_ID = 8, + RPC_LOC_OPER_MODE_MAX = 268435456, +}; +typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type; + +enum rpc_loc_notify_e_type { + RPC_LOC_NOTIFY_ON_INTERVAL = 1, + RPC_LOC_NOTIFY_ON_DISTANCE = 2, + RPC_LOC_NOTIFY_ON_ANY = 3, + RPC_LOC_NOTIFY_ON_ALL = 4, + RPC_LOC_NOTIFY_TYPE_MAX = 268435456, +}; +typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type; + +struct rpc_loc_fix_criteria_s_type { + rpc_uint32 valid_mask; + rpc_loc_fix_recurrence_e_type recurrence_type; + rpc_loc_operation_mode_e_type preferred_operation_mode; + rpc_uint32 preferred_accuracy; + rpc_uint32 preferred_response_time; + rpc_boolean intermediate_pos_report_enabled; + rpc_loc_notify_e_type notify_type; + rpc_uint32 min_interval; + float min_distance; + rpc_uint32 min_dist_sample_interval; +}; +typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type; + +enum rpc_loc_ni_user_resp_e_type { + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456, +}; +typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type; + +struct rpc_loc_user_verify_s_type { + rpc_loc_ni_user_resp_e_type user_resp; + rpc_loc_ni_event_s_type ni_event_pass_back; +}; +typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type; + +enum rpc_loc_predicted_orbits_data_format_e_type { + RPC_LOC_PREDICTED_ORBITS_XTRA = 0, + RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456, +}; +typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type; + +struct rpc_loc_predicted_orbits_data_s_type { + rpc_loc_predicted_orbits_data_format_e_type format_type; + rpc_uint32 total_size; + rpc_uint8 total_parts; + rpc_uint8 part; + rpc_uint16 part_len; + struct { + u_int data_ptr_len; + char *data_ptr_val; + } data_ptr; +}; +typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type; + +struct rpc_loc_predicted_orbits_data_validity_report_s_type { + rpc_uint64 start_time_utc; + rpc_uint16 valid_duration_hrs; +}; +typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type; + +struct rpc_loc_predicted_orbits_auto_download_config_s_type { + rpc_boolean enable; + u_char auto_check_every_hrs; +}; +typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type; + +struct rpc_loc_assist_data_time_s_type { + rpc_uint64 time_utc; + rpc_uint32 uncertainty; +}; +typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type; + +typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; + +struct rpc_loc_assist_data_pos_s_type { + rpc_loc_assist_pos_valid_mask_type valid_mask; + rpc_uint64 timestamp_utc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float hor_unc_circular; + float vert_unc; + u_char confidence_horizontal; + u_char confidence_vertical; + rpc_int32 timestamp_age; +}; +typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type; + +enum rpc_loc_server_open_status_e_type { + RPC_LOC_SERVER_OPEN_SUCCESS = 1, + RPC_LOC_SERVER_OPEN_FAIL = 2, + RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type; + +enum rpc_loc_server_pdp_type_e_type { + RPC_LOC_SERVER_PDP_IP = 0, + RPC_LOC_SERVER_PDP_PPP = 0 + 1, + RPC_LOC_SERVER_PDP_IPV6 = 0 + 2, + RPC_LOC_SERVER_PDP_IPV4V6 = 0 + 3, + RPC_LOC_SERVER_PDP_MAX = 268435456, +}; +typedef enum rpc_loc_server_pdp_type_e_type rpc_loc_server_pdp_type_e_type; + +struct rpc_loc_server_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + char apn_name[100]; +}; +typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type; + +struct rpc_loc_server_multi_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + rpc_loc_server_pdp_type_e_type pdp_type; + char apn_name[100]; +}; +typedef struct rpc_loc_server_multi_open_status_s_type rpc_loc_server_multi_open_status_s_type; + +enum rpc_loc_server_close_status_e_type { + RPC_LOC_SERVER_CLOSE_SUCCESS = 1, + RPC_LOC_SERVER_CLOSE_FAIL = 2, + RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456, +}; +typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type; + +struct rpc_loc_server_close_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_close_status_e_type close_status; +}; +typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type; + +struct rpc_loc_wiper_fix_time_s_type { + rpc_uint32 slow_clock_count; +}; +typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type; + +struct rpc_loc_wiper_fix_pos_s_type { + rpc_int32 lat; + rpc_int32 lon; + rpc_uint16 HEPE; + rpc_uint8 num_of_aps_used; + rpc_uint8 fix_error_code; +}; +typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type; + +struct rpc_loc_wiper_ap_info_s_type { + char mac_addr[6]; + rpc_int32 rssi; + rpc_uint16 channel; + rpc_uint8 ap_qualifier; +}; +typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type; + +struct rpc_loc_wiper_ap_set_s_type { + rpc_uint8 num_of_aps; + rpc_loc_wiper_ap_info_s_type ap_info[50]; +}; +typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type; + +struct rpc_loc_wiper_position_report_s_type { + rpc_uint8 wiper_valid_info_flag; + rpc_loc_wiper_fix_time_s_type wiper_fix_time; + rpc_loc_wiper_fix_pos_s_type wiper_fix_position; + rpc_loc_wiper_ap_set_s_type wiper_ap_set; +}; +typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type; + +enum rpc_loc_wiper_status_e_type { + RPC_LOC_WIPER_STATUS_AVAILABLE = 1, + RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2, + RPC_LOC_WIPER_STATUS_E_SIZE = 268435456, +}; +typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type; + +enum rpc_loc_fs_operation_e_type { + RPC_LOC_FS_CREATE_WRITE_FILE = 1, + RPC_LOC_FS_APPEND_FILE = 2, + RPC_LOC_FS_DELETE_FILE = 3, + RPC_LOC_FS_READ_FILE = 4, + RPC_LOC_FS_MAX = 268435456, +}; +typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type; + +struct rpc_loc_efs_data_s_type { + char filename[64]; + rpc_loc_fs_operation_e_type operation; + rpc_uint32 total_size; + struct { + u_int data_ptr_len; + char *data_ptr_val; + } data_ptr; + rpc_uint32 part_len; + rpc_uint8 part; + rpc_uint8 total_parts; + rpc_uint32 reserved; +}; +typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type; + +enum rpc_loc_error_estimate_config_e_type { + RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1, + RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2, + RPC_LOC_ERROR_ESTIMATE_MAX = 268435456, +}; +typedef enum rpc_loc_error_estimate_config_e_type rpc_loc_error_estimate_config_e_type; + +struct rpc_loc_apn_profiles_type { + rpc_uint32 srv_system_type; + rpc_uint32 pdp_type; + rpc_uint32 reserved; + char apn_name[100]; +}; +typedef struct rpc_loc_apn_profiles_type rpc_loc_apn_profiles_type; + +enum rpc_loc_lock_e_type { + RPC_LOC_LOCK_NONE = 1, + RPC_LOC_LOCK_MI = 2, + RPC_LOC_LOCK_MT = 3, + RPC_LOC_LOCK_ALL = 4, + RPC_LOC_LOCK_MAX = 268435456, +}; +typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type; + +typedef rpc_uint32 rpc_loc_nmea_sentence_type; + +typedef rpc_uint32 rpc_loc_assist_data_type; + +struct rpc_loc_assist_data_delete_s_type { + rpc_loc_assist_data_type type; + rpc_uint32 reserved[8]; +}; +typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type; + +struct rpc_loc_ioctl_data_u_type { + rpc_loc_ioctl_e_type disc; + union { + rpc_loc_fix_criteria_s_type fix_criteria; + rpc_loc_user_verify_s_type user_verify_resp; + rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; + rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; + rpc_loc_assist_data_time_s_type assistance_data_time; + rpc_loc_assist_data_pos_s_type assistance_data_position; + rpc_loc_server_open_status_s_type conn_open_status; + rpc_loc_server_close_status_s_type conn_close_status; + rpc_loc_wiper_position_report_s_type wiper_pos; + rpc_loc_wiper_status_e_type wiper_status; + rpc_loc_lock_e_type engine_lock; + rpc_boolean sbas_mode; + rpc_loc_nmea_sentence_type nmea_types; + rpc_boolean on_demand_lpm; + rpc_loc_server_info_s_type server_addr; + rpc_loc_assist_data_delete_s_type assist_data_delete; + rpc_loc_efs_data_s_type efs_data; + rpc_loc_error_estimate_config_e_type error_estimate_config; + rpc_uint8 xtra_t_session_control; + rpc_loc_apn_profiles_type apn_profiles[6]; + rpc_boolean data_enable; + rpc_uint32 supl_version; + rpc_loc_server_multi_open_status_s_type multi_conn_open_status; + rpc_loc_reserved_payload_s_type reserved; + } rpc_loc_ioctl_data_u_type_u; +}; +typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type; + +struct rpc_loc_ioctl_callback_data_u_type { + rpc_loc_ioctl_e_type disc; + union { + rpc_loc_api_version_s_type api_version; + rpc_loc_fix_criteria_s_type fix_criteria; + rpc_loc_lock_e_type engine_lock; + rpc_boolean sbas_mode; + rpc_loc_nmea_sentence_type nmea_types; + rpc_boolean on_demand_lpm; + rpc_loc_server_info_s_type server_addr; + rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; + rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; + rpc_uint8 xtra_t_session_control; + rpc_loc_apn_profiles_type apn_profiles[6]; + rpc_uint32 supl_version; + } rpc_loc_ioctl_callback_data_u_type_u; +}; +typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type; + +struct rpc_loc_ioctl_callback_s_type { + rpc_loc_ioctl_e_type type; + rpc_int32 status; + rpc_loc_ioctl_callback_data_u_type data; +}; +typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type; + +struct rpc_loc_event_payload_u_type { + u_quad_t disc; + union { + rpc_loc_parsed_position_s_type parsed_location_report; + rpc_loc_gnss_info_s_type gnss_report; + rpc_loc_nmea_report_s_type nmea_report; + rpc_loc_ni_event_s_type ni_request; + rpc_loc_assist_data_request_s_type assist_data_request; + rpc_loc_server_request_s_type loc_server_request; + rpc_loc_ioctl_callback_s_type ioctl_report; + rpc_loc_status_event_s_type status_report; + rpc_loc_qwip_request_s_type qwip_request; + rpc_loc_reserved_payload_s_type reserved; + } rpc_loc_event_payload_u_type_u; +}; +typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type; + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*); +extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*); +extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*); +extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*); +extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*); +extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*); +extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*); +extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*); +extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*); +extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*); +extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*); +extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*); +extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*); +extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*); +extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*); +extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*); +extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*); +extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*); +extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*); +extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*); +extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*); +extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*); +extern bool_t xdr_rpc_loc_server_addr_ipv6_type (XDR *, rpc_loc_server_addr_ipv6_type*); +extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*); +extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*); +extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*); +extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*); +extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*); +extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*); +extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*); +extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*); +extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*); +extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*); +extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*); +extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*); +extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*); +extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*); +extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*); +extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*); +extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*); +extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*); +extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers); +extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers); +extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*); +extern bool_t xdr_rpc_loc_pos_inj_request_s_type (XDR *, rpc_loc_pos_inj_request_s_type*); +extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*); +extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*); +extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*); +extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*); +extern bool_t xdr_rpc_loc_server_connection_e_type (XDR *, rpc_loc_server_connection_e_type*); +extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*); +extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*); +extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (XDR *, rpc_loc_server_multi_open_req_s_type*); +extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*); +extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*); +extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*); +extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*); +extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*); +extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*); +extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*); +extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*); +extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*); +extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*); +extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*); +extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*); +extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*); +extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*); +extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*); +extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*); +extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*); +extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*); +extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*); +extern bool_t xdr_rpc_loc_server_pdp_type_e_type (XDR *, rpc_loc_server_pdp_type_e_type*); +extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*); +extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (XDR *, rpc_loc_server_multi_open_status_s_type*); +extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*); +extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*); +extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*); +extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*); +extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*); +extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*); +extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*); +extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*); +extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*); +extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*); +extern bool_t xdr_rpc_loc_error_estimate_config_e_type (XDR *, rpc_loc_error_estimate_config_e_type*); +extern bool_t xdr_rpc_loc_apn_profiles_type (XDR *, rpc_loc_apn_profiles_type*); +extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*); +extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*); +extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*); +extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*); +extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*); +extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*); +extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*); +extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_client_handle_type (); +extern bool_t xdr_rpc_loc_event_mask_type (); +extern bool_t xdr_rpc_loc_position_valid_mask_type (); +extern bool_t xdr_rpc_loc_pos_technology_mask_type (); +extern bool_t xdr_rpc_loc_session_status_e_type (); +extern bool_t xdr_rpc_loc_calendar_time_s_type (); +extern bool_t xdr_rpc_loc_parsed_position_s_type (); +extern bool_t xdr_rpc_loc_sv_system_e_type (); +extern bool_t xdr_rpc_loc_sv_status_e_type (); +extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (); +extern bool_t xdr_rpc_loc_sv_info_s_type (); +extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (); +extern bool_t xdr_rpc_loc_gnss_info_s_type (); +extern bool_t xdr_rpc_loc_nmea_report_s_type (); +extern bool_t xdr_rpc_loc_status_event_e_type (); +extern bool_t xdr_rpc_loc_engine_state_e_type (); +extern bool_t xdr_rpc_loc_fix_session_state_e_type (); +extern bool_t xdr_rpc_loc_status_event_payload_u_type (); +extern bool_t xdr_rpc_loc_status_event_s_type (); +extern bool_t xdr_rpc_loc_server_addr_e_type (); +extern bool_t xdr_rpc_loc_server_addr_ipv4_type (); +extern bool_t xdr_rpc_loc_server_addr_url_type (); +extern bool_t xdr_rpc_loc_server_addr_ipv6_type (); +extern bool_t xdr_rpc_loc_server_addr_u_type (); +extern bool_t xdr_rpc_loc_server_info_s_type (); +extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (); +extern bool_t xdr_rpc_loc_ni_event_e_type (); +extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (); +extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (); +extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (); +extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (); +extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (); +extern bool_t xdr_rpc_loc_ni_location_type_e_type (); +extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (); +extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (); +extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (); +extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (); +extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (); +extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (); +extern bool_t xdr_rpc_loc_ni_event_payload_u_type (); +extern bool_t xdr_rpc_loc_ni_event_s_type (); +extern bool_t xdr_rpc_loc_assist_data_request_e_type (); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (); +extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (); +extern bool_t xdr_rpc_loc_time_download_source_s_type (); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (); +extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (); +extern bool_t xdr_rpc_loc_pos_inj_request_s_type (); +extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (); +extern bool_t xdr_rpc_loc_assist_data_request_s_type (); +extern bool_t xdr_rpc_loc_server_connection_handle (); +extern bool_t xdr_rpc_loc_server_protocol_e_type (); +extern bool_t xdr_rpc_loc_server_connection_e_type (); +extern bool_t xdr_rpc_loc_server_request_e_type (); +extern bool_t xdr_rpc_loc_server_open_req_s_type (); +extern bool_t xdr_rpc_loc_server_multi_open_req_s_type (); +extern bool_t xdr_rpc_loc_server_close_req_s_type (); +extern bool_t xdr_rpc_loc_server_request_u_type (); +extern bool_t xdr_rpc_loc_server_request_s_type (); +extern bool_t xdr_rpc_loc_qwip_request_e_type (); +extern bool_t xdr_rpc_loc_qwip_request_s_type (); +extern bool_t xdr_rpc_loc_reserved_payload_s_type (); +extern bool_t xdr_rpc_loc_ioctl_e_type (); +extern bool_t xdr_rpc_loc_api_version_s_type (); +extern bool_t xdr_rpc_loc_fix_recurrence_e_type (); +extern bool_t xdr_rpc_loc_operation_mode_e_type (); +extern bool_t xdr_rpc_loc_notify_e_type (); +extern bool_t xdr_rpc_loc_fix_criteria_s_type (); +extern bool_t xdr_rpc_loc_ni_user_resp_e_type (); +extern bool_t xdr_rpc_loc_user_verify_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (); +extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (); +extern bool_t xdr_rpc_loc_assist_data_time_s_type (); +extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (); +extern bool_t xdr_rpc_loc_assist_data_pos_s_type (); +extern bool_t xdr_rpc_loc_server_open_status_e_type (); +extern bool_t xdr_rpc_loc_server_pdp_type_e_type (); +extern bool_t xdr_rpc_loc_server_open_status_s_type (); +extern bool_t xdr_rpc_loc_server_multi_open_status_s_type (); +extern bool_t xdr_rpc_loc_server_close_status_e_type (); +extern bool_t xdr_rpc_loc_server_close_status_s_type (); +extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (); +extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (); +extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (); +extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (); +extern bool_t xdr_rpc_loc_wiper_position_report_s_type (); +extern bool_t xdr_rpc_loc_wiper_status_e_type (); +extern bool_t xdr_rpc_loc_fs_operation_e_type (); +extern bool_t xdr_rpc_loc_efs_data_s_type (); +extern bool_t xdr_rpc_loc_error_estimate_config_e_type (); +extern bool_t xdr_rpc_loc_apn_profiles_type (); +extern bool_t xdr_rpc_loc_lock_e_type (); +extern bool_t xdr_rpc_loc_nmea_sentence_type (); +extern bool_t xdr_rpc_loc_assist_data_type (); +extern bool_t xdr_rpc_loc_assist_data_delete_s_type (); +extern bool_t xdr_rpc_loc_ioctl_data_u_type (); +extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (); +extern bool_t xdr_rpc_loc_ioctl_callback_s_type (); +extern bool_t xdr_rpc_loc_event_payload_u_type (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_COMMON_RPC_H_RPCGEN */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h new file mode 100644 index 0000000..6138432 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_api_rpcgen_rpc.h @@ -0,0 +1,288 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _LOC_API_RPC_H_RPCGEN +#define _LOC_API_RPC_H_RPCGEN + +#include "librpc.h" +#include "commondefs_rpcgen_rpc.h" +#include "loc_api_rpcgen_common_rpc.h" + +#include <pthread.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct { + u_int rpc_loc_api_api_versions_return_type_len; + rpc_uint32 *rpc_loc_api_api_versions_return_type_val; +} rpc_loc_api_api_versions_return_type; + +typedef rpc_uint32 rpc_loc_event_cb_f_type; + +struct rpc_loc_open_args { + rpc_loc_event_mask_type event_reg_mask; + rpc_loc_event_cb_f_type event_callback; +}; +typedef struct rpc_loc_open_args rpc_loc_open_args; + +struct rpc_loc_close_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_close_args rpc_loc_close_args; + +struct rpc_loc_start_fix_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args; + +struct rpc_loc_stop_fix_args { + rpc_loc_client_handle_type handle; +}; +typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args; + +struct rpc_loc_ioctl_args { + rpc_loc_client_handle_type handle; + rpc_loc_ioctl_e_type ioctl_type; + rpc_loc_ioctl_data_u_type *ioctl_data; +}; +typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args; + +struct rpc_loc_api_api_version_s_args { + rpc_boolean len_not_null; +}; +typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args; + +struct rpc_loc_api_rpc_glue_code_info_remote_rets { + rpc_uint32 toolvers; + rpc_uint32 features; + rpc_uint32 proghash; + rpc_uint32 cbproghash; +}; +typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets; + +struct rpc_loc_open_rets { + rpc_loc_client_handle_type loc_open_result; +}; +typedef struct rpc_loc_open_rets rpc_loc_open_rets; + +struct rpc_loc_close_rets { + rpc_int32 loc_close_result; +}; +typedef struct rpc_loc_close_rets rpc_loc_close_rets; + +struct rpc_loc_start_fix_rets { + rpc_int32 loc_start_fix_result; +}; +typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets; + +struct rpc_loc_stop_fix_rets { + rpc_int32 loc_stop_fix_result; +}; +typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets; + +struct rpc_loc_ioctl_rets { + rpc_int32 loc_ioctl_result; +}; +typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets; + +struct rpc_loc_api_api_versions_rets { + rpc_loc_api_api_versions_return_type loc_api_api_versions_result; + rpc_uint32 *len; +}; +typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets; +#define LOC_APIVERS 0x00050006 + +#define LOC_APIPROG 0x3000008C +#define LOC_APIVERS_0001 0x00050001 + +#if defined(__STDC__) || defined(__cplusplus) +#define rpc_loc_api_null 0 +extern enum clnt_stat rpc_loc_api_null_0x00050001(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00050001_svc(void *, void *, struct svc_req *); +#define rpc_loc_api_rpc_glue_code_info_remote 1 +extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *); +extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, struct svc_req *); +#define rpc_loc_open 2 +extern enum clnt_stat rpc_loc_open_0x00050001(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *); +extern bool_t rpc_loc_open_0x00050001_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *); +#define rpc_loc_close 3 +extern enum clnt_stat rpc_loc_close_0x00050001(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *); +extern bool_t rpc_loc_close_0x00050001_svc(rpc_loc_close_args *, rpc_loc_close_rets *, struct svc_req *); +#define rpc_loc_start_fix 4 +extern enum clnt_stat rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *); +extern bool_t rpc_loc_start_fix_0x00050001_svc(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, struct svc_req *); +#define rpc_loc_stop_fix 5 +extern enum clnt_stat rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *); +extern bool_t rpc_loc_stop_fix_0x00050001_svc(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, struct svc_req *); +#define rpc_loc_ioctl 6 +extern enum clnt_stat rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *); +extern bool_t rpc_loc_ioctl_0x00050001_svc(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, struct svc_req *); +#define rpc_loc_api_api_versions 0xFFFFFFFF +extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(void *, rpc_loc_api_api_versions_rets *, CLIENT *); +extern bool_t rpc_loc_api_api_versions_0x00050001_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *); +extern int loc_apiprog_0x00050001_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define rpc_loc_api_null 0 +extern enum clnt_stat rpc_loc_api_null_0x00050001(); +extern bool_t rpc_loc_api_null_0x00050001_svc(); +#define rpc_loc_api_rpc_glue_code_info_remote 1 +extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00050001(); +extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00050001_svc(); +#define rpc_loc_open 2 +extern enum clnt_stat rpc_loc_open_0x00050001(); +extern bool_t rpc_loc_open_0x00050001_svc(); +#define rpc_loc_close 3 +extern enum clnt_stat rpc_loc_close_0x00050001(); +extern bool_t rpc_loc_close_0x00050001_svc(); +#define rpc_loc_start_fix 4 +extern enum clnt_stat rpc_loc_start_fix_0x00050001(); +extern bool_t rpc_loc_start_fix_0x00050001_svc(); +#define rpc_loc_stop_fix 5 +extern enum clnt_stat rpc_loc_stop_fix_0x00050001(); +extern bool_t rpc_loc_stop_fix_0x00050001_svc(); +#define rpc_loc_ioctl 6 +extern enum clnt_stat rpc_loc_ioctl_0x00050001(); +extern bool_t rpc_loc_ioctl_0x00050001_svc(); +#define rpc_loc_api_api_versions 0xFFFFFFFF +extern enum clnt_stat rpc_loc_api_api_versions_0x00050001(); +extern bool_t rpc_loc_api_api_versions_0x00050001_svc(); +extern int loc_apiprog_0x00050001_freeresult (); +#endif /* K&R C */ +#define LOC_APIVERS_0002 0x00050002 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_null_0x00050002(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00050002_svc(void *, void *, struct svc_req *); +extern int loc_apiprog_0x00050002_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_null_0x00050002(); +extern bool_t rpc_loc_api_null_0x00050002_svc(); +extern int loc_apiprog_0x00050002_freeresult (); +#endif /* K&R C */ +#define LOC_APIVERS_0003 0x00050003 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_null_0x00050003(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00050003_svc(void *, void *, struct svc_req *); +extern int loc_apiprog_0x00050003_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_null_0x00050003(); +extern bool_t rpc_loc_api_null_0x00050003_svc(); +extern int loc_apiprog_0x00050003_freeresult (); +#endif /* K&R C */ +#define LOC_APIVERS_0004 0x00050004 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_null_0x00050004(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00050004_svc(void *, void *, struct svc_req *); +extern int loc_apiprog_0x00050004_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_null_0x00050004(); +extern bool_t rpc_loc_api_null_0x00050004_svc(); +extern int loc_apiprog_0x00050004_freeresult (); +#endif /* K&R C */ +#define LOC_APIVERS_0005 0x00050005 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_null_0x00050005(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00050005_svc(void *, void *, struct svc_req *); +extern int loc_apiprog_0x00050005_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_null_0x00050005(); +extern bool_t rpc_loc_api_null_0x00050005_svc(); +extern int loc_apiprog_0x00050005_freeresult (); +#endif /* K&R C */ +#define LOC_APIVERS_0006 0x00050006 + +#if defined(__STDC__) || defined(__cplusplus) +extern enum clnt_stat rpc_loc_api_null_0x00050006(void *, void *, CLIENT *); +extern bool_t rpc_loc_api_null_0x00050006_svc(void *, void *, struct svc_req *); +extern int loc_apiprog_0x00050006_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +extern enum clnt_stat rpc_loc_api_null_0x00050006(); +extern bool_t rpc_loc_api_null_0x00050006_svc(); +extern int loc_apiprog_0x00050006_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*); +extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*); +extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*); +extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*); +extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*); +extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*); +extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*); +extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*); +extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*); +extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*); +extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*); +extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*); +extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*); +extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*); +extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*); + +#else /* K&R C */ +extern bool_t xdr_rpc_loc_api_api_versions_return_type (); +extern bool_t xdr_rpc_loc_event_cb_f_type (); +extern bool_t xdr_rpc_loc_open_args (); +extern bool_t xdr_rpc_loc_close_args (); +extern bool_t xdr_rpc_loc_start_fix_args (); +extern bool_t xdr_rpc_loc_stop_fix_args (); +extern bool_t xdr_rpc_loc_ioctl_args (); +extern bool_t xdr_rpc_loc_api_api_version_s_args (); +extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (); +extern bool_t xdr_rpc_loc_open_rets (); +extern bool_t xdr_rpc_loc_close_rets (); +extern bool_t xdr_rpc_loc_start_fix_rets (); +extern bool_t xdr_rpc_loc_stop_fix_rets (); +extern bool_t xdr_rpc_loc_ioctl_rets (); +extern bool_t xdr_rpc_loc_api_api_versions_rets (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_LOC_API_RPC_H_RPCGEN */ diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h new file mode 100644 index 0000000..875c4f0 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/inc/loc_apicb_appinit.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* Initialization function for callbacks */ +int loc_apicb_app_init(); + +void loc_apicb_app_deinit(); + diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c new file mode 100644 index 0000000..2ef5852 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_svc.c @@ -0,0 +1,327 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_rpcgen_cb_rpc.h" +#include <stdio.h> +#include <stdlib.h> +#include <rpc/pmap_clnt.h> +#include <string.h> +#include <memory.h> +#include <sys/socket.h> +#include <netinet/in.h> + +#ifndef SIG_PF +#define SIG_PF void(*)(int) +#endif + +void +loc_apicbprog_0x00050001(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00050001_arg; + } argument; + union { + rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00050001_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_event_cb_f_type: + _xdr_argument = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_args; + _xdr_result = (xdrproc_t) xdr_rpc_loc_event_cb_f_type_rets; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_event_cb_f_type_0x00050001_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00050001_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} + +void +loc_apicbprog_0x00050002(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + int fill; + } argument; + union { + int rpc_loc_api_cb_null_0x00050002_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_api_cb_null: + _xdr_argument = (xdrproc_t) xdr_void; + _xdr_result = (xdrproc_t) xdr_int; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050002_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00050002_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} + +void +loc_apicbprog_0x00050003(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + int fill; + } argument; + union { + int rpc_loc_api_cb_null_0x00050003_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_api_cb_null: + _xdr_argument = (xdrproc_t) xdr_void; + _xdr_result = (xdrproc_t) xdr_int; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050003_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00050003_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} + +void +loc_apicbprog_0x00050004(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + int fill; + } argument; + union { + int rpc_loc_api_cb_null_0x00050004_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_api_cb_null: + _xdr_argument = (xdrproc_t) xdr_void; + _xdr_result = (xdrproc_t) xdr_int; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050004_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00050004_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} + +void +loc_apicbprog_0x00050005(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + int fill; + } argument; + union { + int rpc_loc_api_cb_null_0x00050005_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_api_cb_null: + _xdr_argument = (xdrproc_t) xdr_void; + _xdr_result = (xdrproc_t) xdr_int; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050005_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00050005_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} + +void +loc_apicbprog_0x00050006(struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + int fill; + } argument; + union { + int rpc_loc_api_cb_null_0x00050006_res; + } result; + bool_t retval; + xdrproc_t _xdr_argument, _xdr_result; + bool_t (*local)(char *, void *, struct svc_req *); + + switch (rqstp->rq_proc) { + case NULLPROC: + (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL); + return; + + case rpc_loc_api_cb_null: + _xdr_argument = (xdrproc_t) xdr_void; + _xdr_result = (xdrproc_t) xdr_int; + local = (bool_t (*) (char *, void *, struct svc_req *))rpc_loc_api_cb_null_0x00050006_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + retval = (bool_t) (*local)((char *)&argument, (void *)&result, rqstp); + if (retval > 0 && !svc_sendreply(transp, (xdrproc_t) _xdr_result, (char *)&result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "%s", "unable to free arguments"); + exit (1); + } + if (!loc_apicbprog_0x00050006_freeresult (transp, _xdr_result, (caddr_t) &result)) + fprintf (stderr, "%s", "unable to free results"); + + return; +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c new file mode 100644 index 0000000..ad171dc --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_cb_xdr.c @@ -0,0 +1,60 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_rpcgen_cb_rpc.h" + +bool_t +xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp) +{ +; + + if (!xdr_rpc_uint32 (xdrs, &objp->cb_id)) + return FALSE; + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle)) + return FALSE; + if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp) +{ +; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result)) + return FALSE; + return TRUE; +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c new file mode 100644 index 0000000..3e39576 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_clnt.c @@ -0,0 +1,155 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include <memory.h> /* for memset */ +#include "loc_api_rpcgen_rpc.h" + +/* Default timeout can be changed using clnt_control() */ +static struct timeval TIMEOUT = { 25, 0 }; + +enum clnt_stat +rpc_loc_api_null_0x00050001(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_rpc_glue_code_info_remote_0x00050001(void *argp, rpc_loc_api_rpc_glue_code_info_remote_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_rpc_glue_code_info_remote, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_api_rpc_glue_code_info_remote_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_open_0x00050001(rpc_loc_open_args *argp, rpc_loc_open_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_open, + (xdrproc_t) xdr_rpc_loc_open_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_open_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_close_0x00050001(rpc_loc_close_args *argp, rpc_loc_close_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_close, + (xdrproc_t) xdr_rpc_loc_close_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_close_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_start_fix_0x00050001(rpc_loc_start_fix_args *argp, rpc_loc_start_fix_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_start_fix, + (xdrproc_t) xdr_rpc_loc_start_fix_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_start_fix_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_stop_fix_0x00050001(rpc_loc_stop_fix_args *argp, rpc_loc_stop_fix_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_stop_fix, + (xdrproc_t) xdr_rpc_loc_stop_fix_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_stop_fix_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_ioctl_0x00050001(rpc_loc_ioctl_args *argp, rpc_loc_ioctl_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_ioctl, + (xdrproc_t) xdr_rpc_loc_ioctl_args, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_ioctl_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_api_versions_0x00050001(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_api_versions, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_null_0x00050002(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_null_0x00050003(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_null_0x00050004(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_null_0x00050005(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} + +enum clnt_stat +rpc_loc_api_null_0x00050006(void *argp, void *clnt_res, CLIENT *clnt) +{ + return (clnt_call(clnt, rpc_loc_api_null, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c new file mode 100644 index 0000000..21be8f4 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_common_xdr.c @@ -0,0 +1,1775 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_rpcgen_common_rpc.h" + +bool_t +xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->year)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->month)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->day_of_week)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->day)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->hour)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->minute)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->second)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->millisecond)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status)) + return FALSE; + if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds)) + return FALSE; + if (!xdr_float (xdrs, &objp->time_unc)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_horizontal)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_vertical)) + return FALSE; + if (!xdr_float (xdrs, &objp->heading)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_circular)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth)) + return FALSE; + if (!xdr_float (xdrs, &objp->vert_unc)) + return FALSE; + if (!xdr_float (xdrs, &objp->speed_unc)) + return FALSE; + if (!xdr_float (xdrs, &objp->heading_unc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_vertical)) + return FALSE; + if (!xdr_float (xdrs, &objp->magnetic_deviation)) + return FALSE; + if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->prn)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->health_status)) + return FALSE; + if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->has_eph)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->has_alm)) + return FALSE; + if (!xdr_float (xdrs, &objp->elevation)) + return FALSE; + if (!xdr_float (xdrs, &objp->azimuth)) + return FALSE; + if (!xdr_float (xdrs, &objp->snr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_float (xdrs, &objp->position_dop)) + return FALSE; + if (!xdr_float (xdrs, &objp->horizontal_dop)) + return FALSE; + if (!xdr_float (xdrs, &objp->vertical_dop)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->sv_count)) + return FALSE; + if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80, + sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint16 (xdrs, &objp->length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->nmea_sentences, 200)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state)) + return FALSE; + break; + case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: + if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->addr)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->port)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint16 (xdrs, &objp->length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->addr, 256)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_ipv6_type (XDR *xdrs, rpc_loc_server_addr_ipv6_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_vector (xdrs, (char *)objp->addr, 8, + sizeof (rpc_uint16), (xdrproc_t) xdr_rpc_uint16)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->port)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_SERVER_ADDR_IPV4: + if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4)) + return FALSE; + break; + case RPC_LOC_SERVER_ADDR_URL: + if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url)) + return FALSE; + break; + case RPC_LOC_SERVER_ADDR_IPV6: + if (!xdr_rpc_loc_server_addr_ipv6_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv6)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type)) + return FALSE; + if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->requester_id_length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->requester_id, 200)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->pos_qos_incl)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->pos_qos)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->tbf)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->presence)) + return FALSE; + if (!xdr_opaque (xdrs, objp->session_id, 4)) + return FALSE; + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_opaque (xdrs, objp->requestor_id_string, 200)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_opaque (xdrs, objp->client_name_string, 64)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->bit_mask)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->horacc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->veracc)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->delay)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id)) + return FALSE; + if (!xdr_opaque (xdrs, objp->supl_hash, 8)) + return FALSE; + if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method)) + return FALSE; + if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name)) + return FALSE; + if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->ext_client_address_len)) + return FALSE; + if (!xdr_opaque (xdrs, objp->ext_client_address, 20)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->unused_bits)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->ms_available)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_u_char (xdrs, &objp->data_coding_scheme)) + return FALSE; + if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->string_len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->lcs_service_type_id)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->invoke_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->notification_length)) + return FALSE; + if (!xdr_opaque (xdrs, objp->notification_text, 64)) + return FALSE; + if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme)) + return FALSE; + if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data)) + return FALSE; + if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type)) + return FALSE; + if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location)) + return FALSE; + if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id)) + return FALSE; + if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string)) + return FALSE; + if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req)) + return FALSE; + if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req)) + return FALSE; + break; + case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ: + if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp) +{ + register int32_t *buf; + + if (!xdr_string (xdrs, objp, 256)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp) +{ + register int32_t *buf; + + if (!xdr_vector (xdrs, (char *)objp, 3, + sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold)) + return FALSE; + if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp) +{ + register int32_t *buf; + + if (!xdr_string (xdrs, objp, 256)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp) +{ + register int32_t *buf; + + if (!xdr_vector (xdrs, (char *)objp, 3, + sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size)) + return FALSE; + if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_pos_inj_request_s_type (XDR *xdrs, rpc_loc_pos_inj_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->flags)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->position_uncertainty)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_ASSIST_DATA_TIME_REQ: + if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download)) + return FALSE; + break; + case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: + if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download)) + return FALSE; + break; + case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ: + if (!xdr_rpc_loc_pos_inj_request_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.pos_injection)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_connection_e_type (XDR *xdrs, rpc_loc_server_connection_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_multi_open_req_s_type (XDR *xdrs, rpc_loc_server_multi_open_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol)) + return FALSE; + if (!xdr_rpc_loc_server_connection_e_type (xdrs, &objp->connection_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_SERVER_REQUEST_OPEN: + if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req)) + return FALSE; + break; + case RPC_LOC_SERVER_REQUEST_CLOSE: + if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req)) + return FALSE; + break; + case RPC_LOC_SERVER_REQUEST_MULTI_OPEN: + if (!xdr_rpc_loc_server_multi_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.multi_open_req)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event)) + return FALSE; + if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint16 (xdrs, &objp->data_size)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_char (xdrs, &objp->major)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->minor)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type)) + return FALSE; + if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time)) + return FALSE; + if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled)) + return FALSE; + if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->min_interval)) + return FALSE; + if (!xdr_float (xdrs, &objp->min_distance)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp)) + return FALSE; + if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->part)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->part_len)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_boolean (xdrs, &objp->enable)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, &objp->time_utc)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint64 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask)) + return FALSE; + if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc)) + return FALSE; + if (!xdr_double (xdrs, &objp->latitude)) + return FALSE; + if (!xdr_double (xdrs, &objp->longitude)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid)) + return FALSE; + if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level)) + return FALSE; + if (!xdr_float (xdrs, &objp->hor_unc_circular)) + return FALSE; + if (!xdr_float (xdrs, &objp->vert_unc)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_horizontal)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->confidence_vertical)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_pdp_type_e_type (XDR *xdrs, rpc_loc_server_pdp_type_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status)) + return FALSE; + if (!xdr_opaque (xdrs, objp->apn_name, 100)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_multi_open_status_s_type (XDR *xdrs, rpc_loc_server_multi_open_status_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status)) + return FALSE; + if (!xdr_rpc_loc_server_pdp_type_e_type (xdrs, &objp->pdp_type)) + return FALSE; + if (!xdr_opaque (xdrs, objp->apn_name, 100)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle)) + return FALSE; + if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_int32 (xdrs, &objp->lat)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->lon)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->HEPE)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_opaque (xdrs, objp->mac_addr, 6)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->rssi)) + return FALSE; + if (!xdr_rpc_uint16 (xdrs, &objp->channel)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->ap_info, 50, + sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag)) + return FALSE; + if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time)) + return FALSE; + if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position)) + return FALSE; + if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_opaque (xdrs, objp->filename, 64)) + return FALSE; + if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->total_size)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->part_len)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->part)) + return FALSE; + if (!xdr_rpc_uint8 (xdrs, &objp->total_parts)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->reserved)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_error_estimate_config_e_type (XDR *xdrs, rpc_loc_error_estimate_config_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_apn_profiles_type (XDR *xdrs, rpc_loc_apn_profiles_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_uint32 (xdrs, &objp->srv_system_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->pdp_type)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->reserved)) + return FALSE; + if (!xdr_opaque (xdrs, objp->apn_name, 100)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp) +{ + register int32_t *buf; + + int i; + if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->reserved, 8, + sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time)) + return FALSE; + break; + case RPC_LOC_IOCTL_INJECT_POSITION: + if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT: + if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos)) + return FALSE; + break; + case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS: + if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr)) + return FALSE; + break; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete)) + return FALSE; + break; + case RPC_LOC_IOCTL_ACCESS_EFS_DATA: + if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data)) + return FALSE; + break; + case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG: + if (!xdr_rpc_loc_error_estimate_config_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.error_estimate_config)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL: + if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.xtra_t_session_control)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE: + case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE: + if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_data_u_type_u.apn_profiles, 6, + sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_DATA_ENABLE: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.data_enable)) + return FALSE; + break; + case RPC_LOC_IOCTL_SET_SUPL_VERSION: + if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.supl_version)) + return FALSE; + break; + case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS: + if (!xdr_rpc_loc_server_multi_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.multi_conn_open_status)) + return FALSE; + break; + case RPC_LOC_IOCTL_RESERVED_CMD: + if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.reserved)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_IOCTL_GET_API_VERSION: + if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr)) + return FALSE; + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source)) + return FALSE; + break; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL: + if (!xdr_rpc_uint8 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.xtra_t_session_control)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE: + case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE: + if (!xdr_vector (xdrs, (char *)objp->rpc_loc_ioctl_callback_data_u_type_u.apn_profiles, 6, + sizeof (rpc_loc_apn_profiles_type), (xdrproc_t) xdr_rpc_loc_apn_profiles_type)) + return FALSE; + break; + case RPC_LOC_IOCTL_GET_SUPL_VERSION: + if (!xdr_rpc_uint32 (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.supl_version)) + return FALSE; + break; + default: + break; + } + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp) +{ + register int32_t *buf; + + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type)) + return FALSE; + if (!xdr_rpc_int32 (xdrs, &objp->status)) + return FALSE; + if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp) +{ + register int32_t *buf; + + if (!xdr_u_quad_t (xdrs, &objp->disc)) + return FALSE; + switch (objp->disc) { + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report)) + return FALSE; + break; + case RPC_LOC_EVENT_SATELLITE_REPORT: + if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report)) + return FALSE; + break; + case RPC_LOC_EVENT_NMEA_POSITION_REPORT: + case RPC_LOC_EVENT_NMEA_1HZ_REPORT: + if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report)) + return FALSE; + break; + case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: + if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request)) + return FALSE; + break; + case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: + if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request)) + return FALSE; + break; + case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: + if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request)) + return FALSE; + break; + case RPC_LOC_EVENT_IOCTL_REPORT: + if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report)) + return FALSE; + break; + case RPC_LOC_EVENT_STATUS_REPORT: + if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report)) + return FALSE; + break; + case RPC_LOC_EVENT_WPS_NEEDED_REQUEST: + if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request)) + return FALSE; + break; + case RPC_LOC_EVENT_RESERVED: + if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved)) + return FALSE; + break; + default: + break; + } + return TRUE; +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c new file mode 100644 index 0000000..a0fdcab --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_api_rpcgen_xdr.c @@ -0,0 +1,199 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "loc_api_rpcgen_rpc.h" + +bool_t +xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp) +{ +; + + if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0, + sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp) +{ +; + + if (!xdr_rpc_uint32 (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp) +{ +; + + if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask)) + return FALSE; + if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp) +{ +; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp) +{ +; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp) +{ +; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp) +{ +; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle)) + return FALSE; + if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp) +{ +; + + if (!xdr_rpc_boolean (xdrs, &objp->len_not_null)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp) +{ +; + + if (!xdr_rpc_uint32 (xdrs, &objp->toolvers)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->features)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->proghash)) + return FALSE; + if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp) +{ +; + + if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp) +{ +; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp) +{ +; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp) +{ +; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp) +{ +; + + if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result)) + return FALSE; + return TRUE; +} + +bool_t +xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp) +{ +; + + if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result)) + return FALSE; + if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32)) + return FALSE; + return TRUE; +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c new file mode 100644 index 0000000..b469eb0 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/src/loc_apicb_appinit.c @@ -0,0 +1,74 @@ +/* Copyright (c) 2011, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#include "librpc.h" +#include "loc_api_rpcgen_rpc.h" +#include "loc_api_rpcgen_cb_rpc.h" + + +#define RPC_FUNC_VERSION_BASE(a,b) a ## b +#define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b) + + +static SVCXPRT* svrPort = NULL; + +extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp); + +int loc_apicb_app_init(void) +{ + + /* Register a callback server to use the loc_apicbprog_0x00010001 */ + if (svrPort == NULL) { + svrPort = svcrtr_create(); + } + if (!svrPort) return -1; + + xprt_register(svrPort); + + + + if(svc_register(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0)) + { + return 0; + } + else + { + return -1; + } +} +void loc_apicb_app_deinit(void) +{ + + if (svrPort == NULL) + { + return; + } + + + svc_unregister(svrPort, LOC_APICBPROG,LOC_APICBVERS_0001); +} diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr new file mode 100644 index 0000000..82dca56 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api.xdr @@ -0,0 +1,261 @@ +/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* LOC_API TOOL VERSION: 4.48 */ +/* GENERATED: TUE JUN 14 2011 */ +/*============================================================================= + L O C _ A P I . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + the loc_api API. + + --------------------------------------------------------------------------- + + + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1 + +loc_api Definition File(s): +Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24 +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + +typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>; + +/* + * Declare an rpc_uint32 type for each callback type in the API + */ +typedef rpc_uint32 rpc_loc_event_cb_f_type; + + + +/* + * These are struct declarations for the function arguments + */ + +struct rpc_loc_open_args { + rpc_loc_event_mask_type event_reg_mask; + rpc_loc_event_cb_f_type event_callback; +}; + +struct rpc_loc_close_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_start_fix_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_stop_fix_args { + rpc_loc_client_handle_type handle; +}; + +struct rpc_loc_ioctl_args { + rpc_loc_client_handle_type handle; + rpc_loc_ioctl_e_type ioctl_type; + rpc_loc_ioctl_data_u_type *ioctl_data; +}; + + + +struct rpc_loc_api_api_version_s_args { + rpc_boolean len_not_null; +}; + +/* + * These are struct declarations for the function results + */ + +struct rpc_loc_api_rpc_glue_code_info_remote_rets { + rpc_uint32 toolvers; /* Tool version */ + rpc_uint32 features; /* Features turned on in the code. + * 0x00000001 ONCRPC Server Cleanup Support + */ + rpc_uint32 proghash; /* Unique hash value for the API XDR definition */ + rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */ +}; + +struct rpc_loc_open_rets { + rpc_loc_client_handle_type loc_open_result; +}; + +struct rpc_loc_close_rets { + rpc_int32 loc_close_result; +}; + +struct rpc_loc_start_fix_rets { + rpc_int32 loc_start_fix_result; +}; + +struct rpc_loc_stop_fix_rets { + rpc_int32 loc_stop_fix_result; +}; + +struct rpc_loc_ioctl_rets { + rpc_int32 loc_ioctl_result; +}; + + struct rpc_loc_api_api_versions_rets { + rpc_loc_api_api_versions_return_type loc_api_api_versions_result; + rpc_uint32 *len; +}; + +/* + * XDR definition of the LOC_API program ( vers. 0x00050006 ) + */ + +program LOC_APIPROG { + version LOC_APIVERS_0001 { + + void + rpc_loc_api_null( void ) = 0; + + rpc_loc_api_rpc_glue_code_info_remote_rets + rpc_loc_api_rpc_glue_code_info_remote( void ) = 1; + + rpc_loc_open_rets + rpc_loc_open( rpc_loc_open_args ) = 2; + + rpc_loc_close_rets + rpc_loc_close( rpc_loc_close_args ) = 3; + + rpc_loc_start_fix_rets + rpc_loc_start_fix( rpc_loc_start_fix_args ) = 4; + + rpc_loc_stop_fix_rets + rpc_loc_stop_fix( rpc_loc_stop_fix_args ) = 5; + + rpc_loc_ioctl_rets + rpc_loc_ioctl( rpc_loc_ioctl_args ) = 6; + + rpc_loc_api_api_versions_rets + rpc_loc_api_api_versions( void ) = 0xFFFFFFFF; + + + + + } = 0x00050001; + +version LOC_APIVERS_0002 { + +/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002 +RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ +*/ +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002 +RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL +RPC_LOC_IOCTL_RESERVED_CMD +RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL +*/ + + void + rpc_loc_api_null( void ) = 0; + + } = 0x00050002; + +version LOC_APIVERS_0003 { + +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003 +RPC_LOC_IOCTL_SET_DATA_ENABLE +RPC_LOC_IOCTL_SET_LBS_APN_PROFILE +RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE +RPC_LOC_IOCTL_GET_LBS_APN_PROFILE +RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE +*/ + + void + rpc_loc_api_null( void ) = 0; + + } = 0x00050003; + +version LOC_APIVERS_0004 { + +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004 +RPC_LOC_IOCTL_GET_SUPL_VERSION +RPC_LOC_IOCTL_SET_SUPL_VERSION +*/ + + void + rpc_loc_api_null( void ) = 0; + + } = 0x00050004; + +version LOC_APIVERS_0005 { + +/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005 +RPC_LOC_SERVER_ADDR_IPV6 +*/ +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005 +RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG +*/ + + void + rpc_loc_api_null( void ) = 0; + + } = 0x00050005; + + + + version LOC_APIVERS_0006 { + +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006 +RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS +*/ +/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006 +RPC_LOC_SERVER_REQUEST_MULTI_OPEN +*/ + + void + rpc_loc_api_null( void ) = 0; + + } = 0x00050006; + + +} = 0x3000008C; + +const LOC_APIVERS = 0x00050006; diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr new file mode 100644 index 0000000..4756c6c --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_cb.xdr @@ -0,0 +1,187 @@ +/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* LOC_API TOOL VERSION: 4.48 */ +/* GENERATED: TUE JUN 14 2011 */ +/*============================================================================= + L O C _ A P I _ C B . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + an api that represents the grouping of the different callback functions the + loc_api API supports. + + --------------------------------------------------------------------------- + + + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1 + +loc_api Definition File(s): +Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24 +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + + +/* + * These are struct declarations for the function arguments + */ + +struct rpc_loc_event_cb_f_type_args { + rpc_uint32 cb_id; + rpc_loc_client_handle_type loc_handle; + rpc_loc_event_mask_type loc_event; + rpc_loc_event_payload_u_type *loc_event_payload; +}; + + + + + +/* + * These are struct declaratios for the function results + */ + +struct rpc_loc_event_cb_f_type_rets { + rpc_int32 loc_event_cb_f_type_result; +}; + + + +/* + * XDR definition of the LOC_API callback program ( vers. 0x00050006 ) + */ + +program LOC_APICBPROG { + version LOC_APICBVERS_0001 { + + rpc_loc_event_cb_f_type_rets + rpc_loc_event_cb_f_type( rpc_loc_event_cb_f_type_args ) = 1; + + + + + } = 0x00050001; + +version LOC_APICBVERS_0002 { + +/* Following elements added in enum rpc_loc_assist_data_request_e_type in 0x00050002 +RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ +*/ +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050002 +RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL +RPC_LOC_IOCTL_RESERVED_CMD +RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL +*/ + + int + rpc_loc_api_cb_null( void ) = 0xffffff00; + + } = 0x00050002; + +version LOC_APICBVERS_0003 { + +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050003 +RPC_LOC_IOCTL_SET_DATA_ENABLE +RPC_LOC_IOCTL_SET_LBS_APN_PROFILE +RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE +RPC_LOC_IOCTL_GET_LBS_APN_PROFILE +RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE +*/ + + int + rpc_loc_api_cb_null( void ) = 0xffffff00; + + } = 0x00050003; + +version LOC_APICBVERS_0004 { + +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050004 +RPC_LOC_IOCTL_GET_SUPL_VERSION +RPC_LOC_IOCTL_SET_SUPL_VERSION +*/ + + int + rpc_loc_api_cb_null( void ) = 0xffffff00; + + } = 0x00050004; + +version LOC_APICBVERS_0005 { + +/* Following elements added in enum rpc_loc_server_addr_e_type in 0x00050005 +RPC_LOC_SERVER_ADDR_IPV6 +*/ +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050005 +RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG +*/ + + int + rpc_loc_api_cb_null( void ) = 0xffffff00; + + } = 0x00050005; + + + + version LOC_APICBVERS_0006 { + +/* Following elements added in enum rpc_loc_ioctl_e_type in 0x00050006 +RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS +*/ +/* Following elements added in enum rpc_loc_server_request_e_type in 0x00050006 +RPC_LOC_SERVER_REQUEST_MULTI_OPEN +*/ + + int + rpc_loc_api_cb_null( void ) = 0xffffff00; + + } = 0x00050006; + + +} = 0x3100008C; + +const LOC_APICBVERS = 0x00050006; diff --git a/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr new file mode 100644 index 0000000..e059c66 --- /dev/null +++ b/gps/loc_api/libloc_api-rpc-50001/libloc_api-rpc-stub/xdr/loc_api_common.xdr @@ -0,0 +1,1021 @@ +/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation, nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +/* LOC_API TOOL VERSION: 4.48 */ +/* GENERATED: TUE JUN 14 2011 */ +/*============================================================================= + L O C _ A P I _ C O M M O N . X D R + +GENERAL DESCRIPTION + This is an AUTO GENERATED file that provides an xdr compatible definition of + an api that represents the grouping of the different callback functions the + loc_api API supports. + + --------------------------------------------------------------------------- + + + --------------------------------------------------------------------------- +=============================================================================*/ + +/*============================================================================= + + Edit History + + AUTO GENERATED + +Generated by following versions of Htorpc modules: +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/htorpc.pl#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Start.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Htoxdr.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/XDR.pm#3 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Output.pm#5 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Parser.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/Metacomments.pm#1 +Id: //source/qcom/qct/core/mproc/tools/rel/2h09/htorpc/lib/Htorpc/SymbolTable.pm#1 + +loc_api Definition File(s): +Id: //source/qcom/qct/modem/api/gps/main/latest/loc_api.h#24 +=============================================================================*/ +/*============================================================================= +$Header$ +=============================================================================*/ + + + +const LOC_API_TOOLVERS = 0x00040030; +const LOC_API_FEATURES = 0x00000001; + +const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100; + +const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020; + +const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200; + +const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002; + +const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001; + +const RPC_LOC_EVENT_RESERVED = 0x8000000000000000; + +const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040; + +const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008; + +const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080; + +const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004; + +const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010; + +const RPC_LOC_API_CB_NULL_VERSION = 0x00050002; +const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001; +const RPC_LOC_API_API_VERSIONS_VERSION = 0x00050001; +const RPC_LOC_STOP_FIX_VERSION = 0x00050001; +const RPC_LOC_START_FIX_VERSION = 0x00050001; +const RPC_LOC_IOCTL_VERSION = 0x00050001; +const RPC_LOC_CLOSE_VERSION = 0x00050001; +const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001; +const RPC_LOC_OPEN_VERSION = 0x00050001; +const RPC_LOC_API_NULL_VERSION = 0x00050001; +const RPC_LOC_API_API_MAJOR_NUM = 0x0005; +const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0; + +typedef rpc_int32 rpc_loc_client_handle_type; + +typedef rpc_uint64 rpc_loc_event_mask_type; + +typedef rpc_uint64 rpc_loc_position_valid_mask_type; + +typedef rpc_uint32 rpc_loc_pos_technology_mask_type; + +enum rpc_loc_session_status_e_type { + RPC_LOC_SESS_STATUS_SUCCESS = 0, + RPC_LOC_SESS_STATUS_IN_PROGESS = 1, + RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2, + RPC_LOC_SESS_STATUS_TIMEOUT = 3, + RPC_LOC_SESS_STATUS_USER_END = 4, + RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5, + RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6, + RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7, + RPC_LOC_SESS_STATUS_MAX = 268435456 +}; + +struct rpc_loc_calendar_time_s_type { + rpc_uint16 year; + unsigned char month; + unsigned char day_of_week; + unsigned char day; + unsigned char hour; + unsigned char minute; + unsigned char second; + rpc_uint16 millisecond; +}; + +struct rpc_loc_parsed_position_s_type { + rpc_loc_position_valid_mask_type valid_mask; + rpc_loc_session_status_e_type session_status; + rpc_loc_calendar_time_s_type timestamp_calendar; + rpc_uint64 timestamp_utc; + rpc_uint8 leap_seconds; + float time_unc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float speed_horizontal; + float speed_vertical; + float heading; + float hor_unc_circular; + float hor_unc_ellipse_semi_major; + float hor_unc_ellipse_semi_minor; + float hor_unc_ellipse_orient_azimuth; + float vert_unc; + float speed_unc; + float heading_unc; + unsigned char confidence_horizontal; + unsigned char confidence_vertical; + float magnetic_deviation; + rpc_loc_pos_technology_mask_type technology_mask; +}; + +enum rpc_loc_sv_system_e_type { + RPC_LOC_SV_SYSTEM_GPS = 1, + RPC_LOC_SV_SYSTEM_GALILEO = 2, + RPC_LOC_SV_SYSTEM_SBAS = 3, + RPC_LOC_SV_SYSTEM_COMPASS = 4, + RPC_LOC_SV_SYSTEM_GLONASS = 5, + RPC_LOC_SV_SYSTEM_MAX = 268435456 +}; + +enum rpc_loc_sv_status_e_type { + RPC_LOC_SV_STATUS_IDLE = 1, + RPC_LOC_SV_STATUS_SEARCH = 2, + RPC_LOC_SV_STATUS_TRACK = 3, + RPC_LOC_SV_STATUS_MAX = 268435456 +}; + +typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type; + +struct rpc_loc_sv_info_s_type { + rpc_loc_sv_info_valid_mask_type valid_mask; + rpc_loc_sv_system_e_type system; + rpc_uint8 prn; + rpc_uint8 health_status; + rpc_loc_sv_status_e_type process_status; + rpc_boolean has_eph; + rpc_boolean has_alm; + float elevation; + float azimuth; + float snr; +}; + +typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type; + +struct rpc_loc_gnss_info_s_type { + rpc_loc_gnss_info_valid_mask_type valid_mask; + float position_dop; + float horizontal_dop; + float vertical_dop; + rpc_boolean altitude_assumed; + rpc_uint16 sv_count; + rpc_loc_sv_info_s_type sv_list<80>; /* EVAL:[LOC_API_MAX_SV_COUNT]*/ +}; + +struct rpc_loc_nmea_report_s_type { + rpc_uint16 length; + opaque nmea_sentences[200]; +}; + +enum rpc_loc_status_event_e_type { + RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1, + RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2, + RPC_LOC_STATUS_EVENT_MAX = 268435456 +}; + +enum rpc_loc_engine_state_e_type { + RPC_LOC_ENGINE_STATE_ON = 1, + RPC_LOC_ENGINE_STATE_OFF = 2, + RPC_LOC_ENGINE_STATE_MAX = 268435456 +}; + +enum rpc_loc_fix_session_state_e_type { + RPC_LOC_FIX_SESSION_STATE_BEGIN = 1, + RPC_LOC_FIX_SESSION_STATE_END = 2, + RPC_LOC_FIX_SESSION_STATE_MAX = 268435456 +}; + +union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) { + case RPC_LOC_STATUS_EVENT_ENGINE_STATE: + rpc_loc_engine_state_e_type engine_state; + case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE: + rpc_loc_fix_session_state_e_type fix_session_state; + default: + void; +}; + +struct rpc_loc_status_event_s_type { + rpc_loc_status_event_e_type event; + rpc_loc_status_event_payload_u_type payload; +}; + +enum rpc_loc_server_addr_e_type { + RPC_LOC_SERVER_ADDR_IPV4 = 1, + RPC_LOC_SERVER_ADDR_URL = 2, + RPC_LOC_SERVER_ADDR_IPV6 = 3, + RPC_LOC_SERVER_ADDR_MAX = 268435456 +}; + +struct rpc_loc_server_addr_ipv4_type { + rpc_uint32 addr; + rpc_uint16 port; +}; + +struct rpc_loc_server_addr_url_type { + rpc_uint16 length; + opaque addr[256]; +}; + +struct rpc_loc_server_addr_ipv6_type { + rpc_uint16 addr[8]; + rpc_uint32 port; +}; + +union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) { + case RPC_LOC_SERVER_ADDR_IPV4: + rpc_loc_server_addr_ipv4_type ipv4; + case RPC_LOC_SERVER_ADDR_URL: + rpc_loc_server_addr_url_type url; + case RPC_LOC_SERVER_ADDR_IPV6: + rpc_loc_server_addr_ipv6_type ipv6; + default: + void; +}; + +struct rpc_loc_server_info_s_type { + rpc_loc_server_addr_e_type addr_type; + rpc_loc_server_addr_u_type addr_info; +}; + +enum rpc_loc_ni_notify_verify_e_type { + RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1, + RPC_LOC_NI_USER_NOTIFY_ONLY = 2, + RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3, + RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4, + RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5, + RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456 +}; + +enum rpc_loc_ni_event_e_type { + RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1, + RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2, + RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3, + RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4, + RPC_LOC_NI_EVENT_MAX = 268435456 +}; + +enum rpc_loc_ni_datacoding_scheme_e_type { + RPC_LOC_NI_PRESUPL_ISO646IRV = 0, + RPC_LOC_NI_PRESUPL_ISO8859 = 1, + RPC_LOC_NI_PRESUPL_UTF8 = 2, + RPC_LOC_NI_PRESUPL_UTF16 = 3, + RPC_LOC_NI_PRESUPL_UCS2 = 4, + RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5, + RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6, + RPC_LOC_NI_PRESUPL_JIS = 7, + RPC_LOC_NI_PRESUPL_EUC = 8, + RPC_LOC_NI_PRESUPL_GB2312 = 9, + RPC_LOC_NI_PRESUPL_CNS11643 = 10, + RPC_LOC_NI_PRESUPL_KSC1001 = 11, + RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647, + RPC_LOC_NI_SS_GERMAN = 12, + RPC_LOC_NI_SS_ENGLISH = 13, + RPC_LOC_NI_SS_ITALIAN = 14, + RPC_LOC_NI_SS_FRENCH = 15, + RPC_LOC_NI_SS_SPANISH = 16, + RPC_LOC_NI_SS_DUTCH = 17, + RPC_LOC_NI_SS_SWEDISH = 18, + RPC_LOC_NI_SS_DANISH = 19, + RPC_LOC_NI_SS_PORTUGUESE = 20, + RPC_LOC_NI_SS_FINNISH = 21, + RPC_LOC_NI_SS_NORWEGIAN = 22, + RPC_LOC_NI_SS_GREEK = 23, + RPC_LOC_NI_SS_TURKISH = 24, + RPC_LOC_NI_SS_HUNGARIAN = 25, + RPC_LOC_NI_SS_POLISH = 26, + RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27, + RPC_LOC_NI_SUPL_UTF8 = 28, + RPC_LOC_NI_SUPL_UCS2 = 29, + RPC_LOC_NI_SUPL_GSM_DEFAULT = 30, + RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647 +}; + +enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type { + RPC_LOC_NI_VX_OCTET = 0, + RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1, + RPC_LOC_NI_VX_ASCII = 2, + RPC_LOC_NI_VX_IA5 = 3, + RPC_LOC_NI_VX_UNICODE = 4, + RPC_LOC_NI_VX_SHIFT_JIS = 5, + RPC_LOC_NI_VX_KOREAN = 6, + RPC_LOC_NI_VX_LATIN_HEBREW = 7, + RPC_LOC_NI_VX_LATIN = 8, + RPC_LOC_NI_VX_GSM = 9, + RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456 +}; + +enum rpc_loc_ni_vx_pos_mode_e_type { + RPC_LOC_VX_MS_ASSISTED_ONLY = 1, + RPC_LOC_VX_MS_BASED_ONLY = 2, + RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3, + RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4, + RPC_LOC_VX_POS_MODE_MAX = 268435456 +}; + +struct rpc_loc_ni_vx_requester_id_s_type { + unsigned char requester_id_length; + opaque requester_id[200]; +}; + +struct rpc_loc_ni_vx_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + unsigned char pos_qos_incl; + unsigned char pos_qos; + rpc_uint32 num_fixes; + rpc_uint32 tbf; + rpc_loc_ni_vx_pos_mode_e_type pos_mode; + rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme; + rpc_loc_ni_vx_requester_id_s_type requester_id; + rpc_uint16 user_resp_timer_val; +}; + +enum rpc_loc_ni_supl_pos_method_e_type { + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2, + RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3, + RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4, + RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5, + RPC_LOC_NI_POSMETHOD_AFLT = 6, + RPC_LOC_NI_POSMETHOD_ECID = 7, + RPC_LOC_NI_POSMETHOD_EOTD = 8, + RPC_LOC_NI_POSMETHOD_OTDOA = 9, + RPC_LOC_NI_POSMETHOD_NO_POSITION = 10, + RPC_LOC_NI_POSMETHOD_MAX = 268435456 +}; + +struct rpc_loc_ni_supl_slp_session_id_s_type { + unsigned char presence; + opaque session_id[4]; + rpc_loc_server_info_s_type slp_address; +}; + +struct rpc_loc_ni_requestor_id_s_type { + unsigned char data_coding_scheme; + opaque requestor_id_string[200]; + unsigned char string_len; +}; + +struct rpc_loc_ni_supl_client_name_s_type { + unsigned char data_coding_scheme; + opaque client_name_string[64]; + unsigned char string_len; +}; + +struct rpc_loc_ni_supl_qop_s_type { + unsigned char bit_mask; + unsigned char horacc; + unsigned char veracc; + rpc_uint16 maxLocAge; + unsigned char delay; +}; + +struct rpc_loc_ni_supl_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + rpc_uint16 flags; + rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id; + opaque supl_hash[8]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_supl_pos_method_e_type pos_method; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_supl_client_name_s_type client_name; + rpc_loc_ni_supl_qop_s_type supl_qop; + rpc_uint16 user_response_timer; +}; + +struct rpc_loc_ni_ext_client_address_s_type { + unsigned char ext_client_address_len; + opaque ext_client_address[20]; +}; + +enum rpc_loc_ni_location_type_e_type { + RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1, + RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2, + RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3, + RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456 +}; + +struct rpc_loc_ni_deferred_location_s_type { + unsigned char unused_bits; + unsigned char ms_available; +}; + +struct rpc_loc_ni_codeword_string_s_type { + unsigned char data_coding_scheme; + opaque lcs_codeword_string[20]; + unsigned char string_len; +}; + +struct rpc_loc_ni_service_type_id_s_type { + unsigned char lcs_service_type_id; +}; + +struct rpc_loc_ni_umts_cp_notify_verify_req_s_type { + rpc_loc_ni_notify_verify_e_type notification_priv_type; + unsigned char invoke_id; + rpc_uint16 flags; + unsigned char notification_length; + opaque notification_text[64]; + rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme; + rpc_loc_ni_ext_client_address_s_type ext_client_address_data; + rpc_loc_ni_location_type_e_type location_type; + rpc_loc_ni_deferred_location_s_type deferred_location; + rpc_loc_ni_requestor_id_s_type requestor_id; + rpc_loc_ni_codeword_string_s_type codeword_string; + rpc_loc_ni_service_type_id_s_type service_type_id; + rpc_uint16 user_response_timer; +}; + +enum rpc_loc_ni_service_interaction_e_type { + RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1, + RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456 +}; + +struct rpc_loc_ni_vx_service_interaction_req_s_type { + rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req; + rpc_loc_ni_service_interaction_e_type service_interation_type; +}; + +union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) { + case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ: + rpc_loc_ni_vx_notify_verify_req_s_type vx_req; + case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ: + rpc_loc_ni_supl_notify_verify_req_s_type supl_req; + case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ: + rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req; + case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ: + rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req; + default: + void; +}; + +struct rpc_loc_ni_event_s_type { + rpc_loc_ni_event_e_type event; + rpc_loc_ni_event_payload_u_type payload; +}; + +enum rpc_loc_assist_data_request_e_type { + RPC_LOC_ASSIST_DATA_TIME_REQ = 1, + RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2, + RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ = 3, + RPC_LOC_ASSIST_DATA_MAX = 268435456 +}; + +typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/ + +typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; + +struct rpc_loc_time_download_source_s_type { + rpc_uint32 delay_threshold; + rpc_struct_loc_time_download_source_s_type_servers servers; +}; + +typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<LOC_API_MAX_SERVER_ADDR_LENGTH>; + +typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; + +struct rpc_loc_predicted_orbits_data_source_s_type { + rpc_uint32 max_file_size; + rpc_uint32 max_part_size; + rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers; +}; + +struct rpc_loc_pos_inj_request_s_type { + rpc_uint32 flags; + double latitude; + double longitude; + rpc_uint32 position_uncertainty; + rpc_uint64 timestamp; +}; + +union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) { + case RPC_LOC_ASSIST_DATA_TIME_REQ: + rpc_loc_time_download_source_s_type time_download; + case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ: + rpc_loc_predicted_orbits_data_source_s_type data_download; + case RPC_LOC_ASSIST_DATA_POSITION_INJECTION_REQ: + rpc_loc_pos_inj_request_s_type pos_injection; + default: + void; +}; + +struct rpc_loc_assist_data_request_s_type { + rpc_loc_assist_data_request_e_type event; + rpc_loc_assist_data_request_payload_u_type payload; +}; + +typedef rpc_uint32 rpc_loc_server_connection_handle; + +enum rpc_loc_server_protocol_e_type { + RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0, + RPC_LOC_SERVER_PROTOCOL_SUPL = 1, + RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2, + RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3, + RPC_LOC_SERVER_PROTOCOL_MAX = 16777216 +}; + +enum rpc_loc_server_connection_e_type { + RPC_LOC_SERVER_CONNECTION_LBS = 0, + RPC_LOC_SERVER_CONNECTION_WWAN_INTERNET, + RPC_LOC_SERVER_CONNECTION_MAX = 16777216 +}; + +enum rpc_loc_server_request_e_type { + RPC_LOC_SERVER_REQUEST_OPEN = 1, + RPC_LOC_SERVER_REQUEST_CLOSE = 2, + RPC_LOC_SERVER_REQUEST_MULTI_OPEN = 3, + RPC_LOC_SERVER_REQUEST_MAX = 268435456 +}; + +struct rpc_loc_server_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; +}; + +struct rpc_loc_server_multi_open_req_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_protocol_e_type protocol; + rpc_loc_server_connection_e_type connection_type; +}; + +struct rpc_loc_server_close_req_s_type { + rpc_loc_server_connection_handle conn_handle; +}; + +union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) { + case RPC_LOC_SERVER_REQUEST_OPEN: + rpc_loc_server_open_req_s_type open_req; + case RPC_LOC_SERVER_REQUEST_CLOSE: + rpc_loc_server_close_req_s_type close_req; + case RPC_LOC_SERVER_REQUEST_MULTI_OPEN: + rpc_loc_server_multi_open_req_s_type multi_open_req; + default: + void; +}; + +struct rpc_loc_server_request_s_type { + rpc_loc_server_request_e_type event; + rpc_loc_server_request_u_type payload; +}; + +enum rpc_loc_qwip_request_e_type { + RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0, + RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM, + RPC_LOC_QWIP_STOP_PERIODIC_FIXES, + RPC_LOC_QWIP_SUSPEND, + RPC_LOC_QWIP_REQUEST_MAX = 268435456 +}; + +struct rpc_loc_qwip_request_s_type { + rpc_loc_qwip_request_e_type request_type; + rpc_uint16 tbf_ms; +}; + +struct rpc_loc_reserved_payload_s_type { + rpc_uint16 data_size; + opaque data<>; +}; + +enum rpc_loc_ioctl_e_type { + RPC_LOC_IOCTL_GET_API_VERSION = 1, + RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2, + RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3, + RPC_LOC_IOCTL_SERVICE_START_INDEX = 400, + RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400, + RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402, + RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403, + RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404, + RPC_LOC_IOCTL_INJECT_UTC_TIME = 405, + RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406, + RPC_LOC_IOCTL_INJECT_POSITION = 407, + RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408, + RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409, + RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410, + RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411, + RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412, + RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413, + RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG = 414, + RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS = 415, + RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800, + RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800, + RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801, + RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802, + RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803, + RPC_LOC_IOCTL_SET_NMEA_TYPES = 804, + RPC_LOC_IOCTL_GET_NMEA_TYPES = 805, + RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806, + RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807, + RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808, + RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809, + RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810, + RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811, + RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812, + RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813, + RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL = 814, + RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL = 815, + RPC_LOC_IOCTL_SET_LBS_APN_PROFILE = 816, + RPC_LOC_IOCTL_GET_LBS_APN_PROFILE = 817, + RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE = 818, + RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE = 819, + RPC_LOC_IOCTL_SET_DATA_ENABLE = 820, + RPC_LOC_IOCTL_SET_SUPL_VERSION = 821, + RPC_LOC_IOCTL_GET_SUPL_VERSION = 822, + RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000, + RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000, + RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001, + RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002, + RPC_LOC_IOCTL_RESERVED_CMD = 8000, + RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824 +}; + +struct rpc_loc_api_version_s_type { + unsigned char major; + unsigned char minor; +}; + +enum rpc_loc_fix_recurrence_e_type { + RPC_LOC_PERIODIC_FIX = 1, + RPC_LOC_SINGLE_FIX = 2, + RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456 +}; + +enum rpc_loc_operation_mode_e_type { + RPC_LOC_OPER_MODE_DEFAULT = 1, + RPC_LOC_OPER_MODE_MSB = 2, + RPC_LOC_OPER_MODE_MSA = 3, + RPC_LOC_OPER_MODE_STANDALONE = 4, + RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5, + RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6, + RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7, + RPC_LOC_OPER_MODE_CELL_ID = 8, + RPC_LOC_OPER_MODE_MAX = 268435456 +}; + +enum rpc_loc_notify_e_type { + RPC_LOC_NOTIFY_ON_INTERVAL = 1, + RPC_LOC_NOTIFY_ON_DISTANCE = 2, + RPC_LOC_NOTIFY_ON_ANY = 3, + RPC_LOC_NOTIFY_ON_ALL = 4, + RPC_LOC_NOTIFY_TYPE_MAX = 268435456 +}; + +struct rpc_loc_fix_criteria_s_type { + rpc_uint32 valid_mask; + rpc_loc_fix_recurrence_e_type recurrence_type; + rpc_loc_operation_mode_e_type preferred_operation_mode; + rpc_uint32 preferred_accuracy; + rpc_uint32 preferred_response_time; + rpc_boolean intermediate_pos_report_enabled; + rpc_loc_notify_e_type notify_type; + rpc_uint32 min_interval; + float min_distance; + rpc_uint32 min_dist_sample_interval; +}; + +enum rpc_loc_ni_user_resp_e_type { + RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3, + RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456 +}; + +struct rpc_loc_user_verify_s_type { + rpc_loc_ni_user_resp_e_type user_resp; + rpc_loc_ni_event_s_type ni_event_pass_back; +}; + +enum rpc_loc_predicted_orbits_data_format_e_type { + RPC_LOC_PREDICTED_ORBITS_XTRA = 0, + RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456 +}; + +struct rpc_loc_predicted_orbits_data_s_type { + rpc_loc_predicted_orbits_data_format_e_type format_type; + rpc_uint32 total_size; + rpc_uint8 total_parts; + rpc_uint8 part; + rpc_uint16 part_len; + opaque data_ptr<>; +}; + +struct rpc_loc_predicted_orbits_data_validity_report_s_type { + rpc_uint64 start_time_utc; + rpc_uint16 valid_duration_hrs; +}; + +struct rpc_loc_predicted_orbits_auto_download_config_s_type { + rpc_boolean enable; + unsigned char auto_check_every_hrs; +}; + +struct rpc_loc_assist_data_time_s_type { + rpc_uint64 time_utc; + rpc_uint32 uncertainty; +}; + +typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type; + +struct rpc_loc_assist_data_pos_s_type { + rpc_loc_assist_pos_valid_mask_type valid_mask; + rpc_uint64 timestamp_utc; + double latitude; + double longitude; + float altitude_wrt_ellipsoid; + float altitude_wrt_mean_sea_level; + float hor_unc_circular; + float vert_unc; + unsigned char confidence_horizontal; + unsigned char confidence_vertical; + rpc_int32 timestamp_age; +}; + +enum rpc_loc_server_open_status_e_type { + RPC_LOC_SERVER_OPEN_SUCCESS = 1, + RPC_LOC_SERVER_OPEN_FAIL = 2, + RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456 +}; + +enum rpc_loc_server_pdp_type_e_type { + RPC_LOC_SERVER_PDP_IP = 0, + RPC_LOC_SERVER_PDP_PPP, + RPC_LOC_SERVER_PDP_IPV6, + RPC_LOC_SERVER_PDP_IPV4V6, + RPC_LOC_SERVER_PDP_MAX = 268435456 +}; + +struct rpc_loc_server_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + opaque apn_name[100]; +}; + +struct rpc_loc_server_multi_open_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_open_status_e_type open_status; + rpc_loc_server_pdp_type_e_type pdp_type; + opaque apn_name[100]; +}; + +enum rpc_loc_server_close_status_e_type { + RPC_LOC_SERVER_CLOSE_SUCCESS = 1, + RPC_LOC_SERVER_CLOSE_FAIL = 2, + RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456 +}; + +struct rpc_loc_server_close_status_s_type { + rpc_loc_server_connection_handle conn_handle; + rpc_loc_server_close_status_e_type close_status; +}; + +struct rpc_loc_wiper_fix_time_s_type { + rpc_uint32 slow_clock_count; +}; + +struct rpc_loc_wiper_fix_pos_s_type { + rpc_int32 lat; + rpc_int32 lon; + rpc_uint16 HEPE; + rpc_uint8 num_of_aps_used; + rpc_uint8 fix_error_code; +}; + +struct rpc_loc_wiper_ap_info_s_type { + opaque mac_addr[6]; + rpc_int32 rssi; + rpc_uint16 channel; + rpc_uint8 ap_qualifier; +}; + +struct rpc_loc_wiper_ap_set_s_type { + rpc_uint8 num_of_aps; + rpc_loc_wiper_ap_info_s_type ap_info[50]; +}; + +struct rpc_loc_wiper_position_report_s_type { + rpc_uint8 wiper_valid_info_flag; + rpc_loc_wiper_fix_time_s_type wiper_fix_time; + rpc_loc_wiper_fix_pos_s_type wiper_fix_position; + rpc_loc_wiper_ap_set_s_type wiper_ap_set; +}; + +enum rpc_loc_wiper_status_e_type { + RPC_LOC_WIPER_STATUS_AVAILABLE = 1, + RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2, + RPC_LOC_WIPER_STATUS_E_SIZE = 268435456 +}; + +enum rpc_loc_fs_operation_e_type { + RPC_LOC_FS_CREATE_WRITE_FILE = 1, + RPC_LOC_FS_APPEND_FILE = 2, + RPC_LOC_FS_DELETE_FILE = 3, + RPC_LOC_FS_READ_FILE = 4, + RPC_LOC_FS_MAX = 268435456 +}; + +struct rpc_loc_efs_data_s_type { + opaque filename[64]; + rpc_loc_fs_operation_e_type operation; + rpc_uint32 total_size; + opaque data_ptr<>; + rpc_uint32 part_len; + rpc_uint8 part; + rpc_uint8 total_parts; + rpc_uint32 reserved; +}; + +enum rpc_loc_error_estimate_config_e_type { + RPC_LOC_ERROR_ESTIMATE_CONFIG_SET = 1, + RPC_LOC_ERROR_ESTIMATE_CONFIG_CLEAR = 2, + RPC_LOC_ERROR_ESTIMATE_MAX = 268435456 +}; + +struct rpc_loc_apn_profiles_type { + rpc_uint32 srv_system_type; + rpc_uint32 pdp_type; + rpc_uint32 reserved; + opaque apn_name[100]; +}; + +enum rpc_loc_lock_e_type { + RPC_LOC_LOCK_NONE = 1, + RPC_LOC_LOCK_MI = 2, + RPC_LOC_LOCK_MT = 3, + RPC_LOC_LOCK_ALL = 4, + RPC_LOC_LOCK_MAX = 268435456 +}; + +typedef rpc_uint32 rpc_loc_nmea_sentence_type; + +typedef rpc_uint32 rpc_loc_assist_data_type; + +struct rpc_loc_assist_data_delete_s_type { + rpc_loc_assist_data_type type; + rpc_uint32 reserved[8]; +}; + +union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) { + case RPC_LOC_IOCTL_SET_FIX_CRITERIA: + rpc_loc_fix_criteria_s_type fix_criteria; + case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE: + rpc_loc_user_verify_s_type user_verify_resp; + case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA: + rpc_loc_predicted_orbits_data_s_type predicted_orbits_data; + case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD: + rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download; + case RPC_LOC_IOCTL_INJECT_UTC_TIME: + rpc_loc_assist_data_time_s_type assistance_data_time; + case RPC_LOC_IOCTL_INJECT_POSITION: + rpc_loc_assist_data_pos_s_type assistance_data_position; + case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS: + rpc_loc_server_open_status_s_type conn_open_status; + case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS: + rpc_loc_server_close_status_s_type conn_close_status; + case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT: + rpc_loc_wiper_position_report_s_type wiper_pos; + case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS: + rpc_loc_wiper_status_e_type wiper_status; + case RPC_LOC_IOCTL_SET_ENGINE_LOCK: + rpc_loc_lock_e_type engine_lock; + case RPC_LOC_IOCTL_SET_SBAS_CONFIG: + rpc_boolean sbas_mode; + case RPC_LOC_IOCTL_SET_NMEA_TYPES: + rpc_loc_nmea_sentence_type nmea_types; + case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM: + rpc_boolean on_demand_lpm; + case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR: + rpc_loc_server_info_s_type server_addr; + case RPC_LOC_IOCTL_DELETE_ASSIST_DATA: + rpc_loc_assist_data_delete_s_type assist_data_delete; + case RPC_LOC_IOCTL_ACCESS_EFS_DATA: + rpc_loc_efs_data_s_type efs_data; + case RPC_LOC_IOCTL_ERROR_ESTIMATE_CONFIG: + rpc_loc_error_estimate_config_e_type error_estimate_config; + case RPC_LOC_IOCTL_SET_XTRA_T_SESSION_CONTROL: + rpc_uint8 xtra_t_session_control; + case RPC_LOC_IOCTL_SET_LBS_APN_PROFILE: + case RPC_LOC_IOCTL_SET_XTRA_APN_PROFILE: + rpc_loc_apn_profiles_type apn_profiles[6]; + case RPC_LOC_IOCTL_SET_DATA_ENABLE: + rpc_boolean data_enable; + case RPC_LOC_IOCTL_SET_SUPL_VERSION: + rpc_uint32 supl_version; + case RPC_LOC_IOCTL_INFORM_SERVER_MULTI_OPEN_STATUS: + rpc_loc_server_multi_open_status_s_type multi_conn_open_status; + case RPC_LOC_IOCTL_RESERVED_CMD: + rpc_loc_reserved_payload_s_type reserved; + default: + void; +}; + +union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) { + case RPC_LOC_IOCTL_GET_API_VERSION: + rpc_loc_api_version_s_type api_version; + case RPC_LOC_IOCTL_GET_FIX_CRITERIA: + rpc_loc_fix_criteria_s_type fix_criteria; + case RPC_LOC_IOCTL_GET_ENGINE_LOCK: + rpc_loc_lock_e_type engine_lock; + case RPC_LOC_IOCTL_GET_SBAS_CONFIG: + rpc_boolean sbas_mode; + case RPC_LOC_IOCTL_GET_NMEA_TYPES: + rpc_loc_nmea_sentence_type nmea_types; + case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM: + rpc_boolean on_demand_lpm; + case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR: + case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR: + rpc_loc_server_info_s_type server_addr; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE: + rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source; + case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY: + rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity; + case RPC_LOC_IOCTL_GET_XTRA_T_SESSION_CONTROL: + rpc_uint8 xtra_t_session_control; + case RPC_LOC_IOCTL_GET_LBS_APN_PROFILE: + case RPC_LOC_IOCTL_GET_XTRA_APN_PROFILE: + rpc_loc_apn_profiles_type apn_profiles[6]; + case RPC_LOC_IOCTL_GET_SUPL_VERSION: + rpc_uint32 supl_version; + default: + void; +}; + +struct rpc_loc_ioctl_callback_s_type { + rpc_loc_ioctl_e_type type; + rpc_int32 status; + rpc_loc_ioctl_callback_data_u_type data; +}; + +union rpc_loc_event_payload_u_type switch (unsigned hyper disc) { + case RPC_LOC_EVENT_PARSED_POSITION_REPORT: + rpc_loc_parsed_position_s_type parsed_location_report; + case RPC_LOC_EVENT_SATELLITE_REPORT: + rpc_loc_gnss_info_s_type gnss_report; + case RPC_LOC_EVENT_NMEA_POSITION_REPORT: + case RPC_LOC_EVENT_NMEA_1HZ_REPORT: + rpc_loc_nmea_report_s_type nmea_report; + case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST: + rpc_loc_ni_event_s_type ni_request; + case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST: + rpc_loc_assist_data_request_s_type assist_data_request; + case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST: + rpc_loc_server_request_s_type loc_server_request; + case RPC_LOC_EVENT_IOCTL_REPORT: + rpc_loc_ioctl_callback_s_type ioctl_report; + case RPC_LOC_EVENT_STATUS_REPORT: + rpc_loc_status_event_s_type status_report; + case RPC_LOC_EVENT_WPS_NEEDED_REQUEST: + rpc_loc_qwip_request_s_type qwip_request; + case RPC_LOC_EVENT_RESERVED: + rpc_loc_reserved_payload_s_type reserved; + default: + void; +}; + diff --git a/gps/loc_api/libloc_api_50001/Android.mk b/gps/loc_api/libloc_api_50001/Android.mk index 0c6d22d..c8ee6c2 100644 --- a/gps/loc_api/libloc_api_50001/Android.mk +++ b/gps/loc_api/libloc_api_50001/Android.mk @@ -16,7 +16,8 @@ LOCAL_SHARED_LIBRARIES := \ libdl \ liblog \ libloc_core \ - libgps.utils + libgps.utils \ + libloc_pla LOCAL_SRC_FILES += \ loc_eng.cpp \ @@ -41,8 +42,9 @@ LOCAL_CFLAGS += \ LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core \ - $(LOCAL_PATH) \ - $(TARGET_OUT_HEADERS)/libflp + $(call project-path-for,qcom-gps) \ + $(TARGET_OUT_HEADERS)/libflp \ + $(TARGET_OUT_HEADERS)/libloc_pla LOCAL_COPY_HEADERS_TO:= libloc_eng/ LOCAL_COPY_HEADERS:= \ @@ -75,7 +77,8 @@ LOCAL_SHARED_LIBRARIES := \ libloc_eng \ libloc_core \ libgps.utils \ - libdl + libdl \ + libloc_pla LOCAL_SRC_FILES += \ loc.cpp \ @@ -85,6 +88,10 @@ LOCAL_CFLAGS += \ -fno-short-enums \ -D_ANDROID_ \ +ifeq ($(TARGET_BUILD_VARIANT),user) + LOCAL_CFLAGS += -DTARGET_BUILD_VARIANT_USER +endif + ifeq ($(TARGET_USES_QCOM_BSP), true) LOCAL_CFLAGS += -DTARGET_USES_QCOM_BSP endif @@ -93,7 +100,8 @@ endif LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core \ - $(TARGET_OUT_HEADERS)/libflp + $(TARGET_OUT_HEADERS)/libflp \ + $(TARGET_OUT_HEADERS)/libloc_pla LOCAL_PRELINK_MODULE := false LOCAL_MODULE_RELATIVE_PATH := hw diff --git a/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp b/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp index e0f21ec..3af4fb7 100644 --- a/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/gps/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -397,6 +397,23 @@ void LocEngAdapter::reportSv(GnssSvStatus &svStatus, } } + +void LocEngAdapter::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) +{ + // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary. + if (! mUlp->reportSvMeasurement(svMeasurementSet)) { + //Send to Internal Adapter later if needed by LA + } +} + +void LocEngAdapter::reportSvPolynomial(GnssSvPolynomial &svPolynomial) +{ + // We send SvMeasurementSet to AmtProxy/ULPProxy to be forwarded as necessary. + if (! mUlp->reportSvPolynomial(svPolynomial)) { + //Send to Internal Adapter later if needed by LA + } +} + void LocEngAdapter::setInSession(bool inSession) { mNavigating = inSession; @@ -534,9 +551,8 @@ enum loc_api_adapter_err LocEngAdapter::setTime(GpsUtcTime time, if (mSupportsTimeInjection) { LOC_LOGD("%s:%d]: Injecting time", __func__, __LINE__); result = mLocApi->setTime(time, timeReference, uncertainty); - } else { - mSupportsTimeInjection = true; } + return result; } @@ -566,26 +582,10 @@ enum loc_api_adapter_err LocEngAdapter::setXtraVersionCheck(int check) 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) +void LocEngAdapter::reportGnssMeasurementData(GnssData &gnssMeasurementData) { - 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__); - } + sendMsg(new LocEngReportGnssMeasurement(mOwner, + gnssMeasurementData)); } /* diff --git a/gps/loc_api/libloc_api_50001/LocEngAdapter.h b/gps/loc_api/libloc_api_50001/LocEngAdapter.h index a193e81..416e4b7 100644 --- a/gps/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/gps/loc_api/libloc_api_50001/LocEngAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,7 +33,6 @@ #include <hardware/gps.h> #include <loc.h> #include <loc_eng_log.h> -#include <log_util.h> #include <LocAdapterBase.h> #include <LocDualContext.h> #include <UlpProxyBase.h> @@ -85,6 +84,7 @@ public: bool mSupportsAgpsRequests; bool mSupportsPositionInjection; bool mSupportsTimeInjection; + GnssSystemInfo mGnssInfo; LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner, ContextBase* context, @@ -105,6 +105,9 @@ public: inline bool hasCPIExtendedCapabilities() { return mContext->hasCPIExtendedCapabilities(); } + inline bool hasNativeXtraClient() { + return mContext->hasNativeXtraClient(); + } inline const MsgTask* getMsgTask() { return mMsgTask; } inline enum loc_api_adapter_err @@ -187,6 +190,11 @@ public: return mLocApi->setSUPLVersion(version); } inline enum loc_api_adapter_err + setNMEATypes (uint32_t typesMask) + { + return mLocApi->setNMEATypes(typesMask); + } + inline enum loc_api_adapter_err setLPPConfig(uint32_t profile) { return mLocApi->setLPPConfig(profile); @@ -222,14 +230,14 @@ public: algorithmConfig); } inline virtual enum loc_api_adapter_err - setExtPowerConfig(int isBatteryCharging) + setAGLONASSProtocol(unsigned long aGlonassProtocol) { - return mLocApi->setExtPowerConfig(isBatteryCharging); + return mLocApi->setAGLONASSProtocol(aGlonassProtocol); } inline virtual enum loc_api_adapter_err - setAGLONASSProtocol(unsigned long aGlonassProtocol) + setLPPeProtocol(unsigned long lppeCP, unsigned long lppeUP) { - return mLocApi->setAGLONASSProtocol(aGlonassProtocol); + return mLocApi->setLPPeProtocol(lppeCP, lppeUP); } inline virtual int initDataServiceClient() { @@ -272,6 +280,8 @@ public: virtual void reportSv(GnssSvStatus &svStatus, GpsLocationExtended &locationExtended, void* svExt); + virtual void reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet); + virtual void reportSvPolynomial(GnssSvPolynomial &svPolynomial); virtual void reportStatus(GpsStatusValue status); virtual void reportNmea(const char* nmea, int length); virtual bool reportXtraServer(const char* url1, const char* url2, @@ -284,7 +294,7 @@ public: virtual bool requestSuplES(int connHandle); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); - virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData); + virtual void reportGnssMeasurementData(GnssData &gnssMeasurementData); inline const LocPosMode& getPositionMode() const {return mFixCriteria;} @@ -337,12 +347,6 @@ public: } /* - Update Registration Mask - */ - void updateRegistrationMask(LOC_API_ADAPTER_EVENT_MASK_T event, - loc_registration_mask_status isEnabled); - - /* Set Gnss Constellation Config */ bool gnssConstellationConfig(); diff --git a/gps/loc_api/libloc_api_50001/Makefile.am b/gps/loc_api/libloc_api_50001/Makefile.am index 2374357..c762427 100644 --- a/gps/loc_api/libloc_api_50001/Makefile.am +++ b/gps/loc_api/libloc_api_50001/Makefile.am @@ -1,76 +1,78 @@ -AM_CFLAGS = \ - -I../../utils \ - -I../../platform_lib_abstractions \ - -fno-short-enums \ - -DFEATURE_GNSS_BIT_API - -libloc_adapter_so_la_SOURCES = loc_eng_log.cpp LocEngAdapter.cpp - -if USE_GLIB -libloc_adapter_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_adapter_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_adapter_so_la_CFLAGS = $(AM_CFLAGS) -libloc_adapter_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_adapter_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif -libloc_adapter_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la - - -libloc_eng_so_la_SOURCES = \ - loc_eng.cpp \ - loc_eng_agps.cpp \ - loc_eng_xtra.cpp \ - loc_eng_ni.cpp \ - loc_eng_log.cpp \ - loc_eng_dmn_conn.cpp \ - loc_eng_dmn_conn_handler.cpp \ - loc_eng_dmn_conn_thread_helper.c \ - loc_eng_dmn_conn_glue_msg.c \ - loc_eng_dmn_conn_glue_pipe.c - - -if USE_GLIB -libloc_eng_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libloc_eng_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libloc_eng_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libloc_eng_so_la_CFLAGS = $(AM_CFLAGS) -libloc_eng_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libloc_eng_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libloc_eng_so_la_LIBADD = -lstdc++ -lcutils -ldl ../../utils/libgps_utils_so.la libloc_adapter_so.la - - -libgps_default_so_la_SOURCES = \ - loc.cpp \ - gps.c - -if USE_GLIB -libgps_default_so_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@ -libgps_default_so_la_LDFLAGS = -lstdc++ -lpthread @GLIB_LIBS@ -shared -version-info 1:0:0 -libgps_default_so_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@ -else -libgps_default_so_la_CFLAGS = $(AM_CFLAGS) -libgps_default_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0 -libgps_default_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS) -endif - -libgps_default_so_la_LIBADD = -lstdc++ -lcutils ../../utils/libgps_utils_so.la -ldl libloc_eng_so.la - -library_include_HEADERS = \ - LocEngAdapter.h \ - loc.h \ - loc_eng.h \ - loc_eng_xtra.h \ - loc_eng_ni.h \ - loc_eng_agps.h \ - loc_eng_msg.h \ - loc_eng_log.h - -library_includedir = $(pkgincludedir)/libloc_api_50001 - -#Create and Install libraries -lib_LTLIBRARIES = libloc_adapter_so.la libloc_eng_so.la libgps_default_so.la +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/gps/loc_api/libloc_api_50001/loc.cpp b/gps/loc_api/libloc_api_50001/loc.cpp index d322a72..222d5da 100644 --- a/gps/loc_api/libloc_api_50001/loc.cpp +++ b/gps/loc_api/libloc_api_50001/loc.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -43,6 +43,7 @@ #include <fcntl.h> #include <errno.h> #include <LocDualContext.h> +#include <platform_lib_includes.h> #include <cutils/properties.h> using namespace loc_core; @@ -52,9 +53,15 @@ using namespace loc_core; //Globals defns static gps_location_callback gps_loc_cb = NULL; static gps_sv_status_callback gps_sv_cb = NULL; +static gps_ni_notify_callback gps_ni_cb = NULL; static void local_loc_cb(UlpLocation* location, void* locExt); static void local_sv_cb(GpsSvStatus* sv_status, void* svExt); +static void local_ni_cb(GpsNiNotification *notification, bool esEnalbed); + +GpsNiExtCallbacks sGpsNiExtCallbacks = { + local_ni_cb +}; static const GpsGeofencingInterface* get_geofence_interface(void); @@ -192,17 +199,18 @@ 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; char propBuf[PROPERTY_VALUE_MAX]; + memset(propBuf, 0, sizeof(propBuf)); 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"); @@ -275,6 +283,7 @@ SIDE EFFECTS static int loc_init(GpsCallbacks* callbacks) { int retVal = -1; + unsigned int target = (unsigned int) -1; ENTRY_LOG(); LOC_API_ADAPTER_EVENT_MASK_T event; @@ -285,6 +294,7 @@ static int loc_init(GpsCallbacks* callbacks) } event = LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT | + LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT | LOC_API_ADAPTER_BIT_SATELLITE_REPORT | LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST | LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST | @@ -293,6 +303,17 @@ static int loc_init(GpsCallbacks* callbacks) LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT | LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST; + target = loc_get_target(); + + /* If platform is "auto" and external dr enabled then enable + ** Measurement report and SV Polynomial report + */ + if((1 == gps_conf.EXTERNAL_DR_ENABLED)) + { + event |= LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT | + LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT; + } + LocCallbacks clientCallbacks = {local_loc_cb, /* location_cb */ callbacks->status_cb, /* status_cb */ local_sv_cb, /* sv_status_cb */ @@ -304,6 +325,8 @@ static int loc_init(GpsCallbacks* callbacks) NULL, /* location_ext_parser */ NULL, /* sv_ext_parser */ callbacks->request_utc_time_cb, /* request_utc_time_cb */ + callbacks->set_system_info_cb, /* set_system_info_cb */ + callbacks->gnss_sv_status_cb, /* gnss_sv_status_cb */ }; gps_loc_cb = callbacks->location_cb; @@ -312,7 +335,8 @@ static int loc_init(GpsCallbacks* callbacks) 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->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities() + && !loc_afw_data.adapter->hasNativeXtraClient(); loc_afw_data.adapter->setGpsLockMsg(0); loc_afw_data.adapter->requestUlp(ContextBase::getCarrierCapabilities()); loc_afw_data.adapter->setXtraUserAgent(); @@ -450,8 +474,12 @@ static int loc_set_position_mode(GpsPositionMode mode, break; } + // set position sharing option to true + bool sharePosition = true; + LocPosMode params(locMode, recurrence, min_interval, - preferred_accuracy, preferred_time, NULL, NULL); + preferred_accuracy, preferred_time, + sharePosition, NULL, NULL); ret_val = loc_eng_set_position_mode(loc_afw_data, params); EXIT_LOG(%d, ret_val); @@ -538,7 +566,10 @@ SIDE EFFECTS static void loc_delete_aiding_data(GpsAidingData f) { ENTRY_LOG(); + +#ifndef TARGET_BUILD_VARIANT_USER loc_eng_delete_aiding_data(loc_afw_data, f); +#endif EXIT_LOG(%s, VOID_RET); } @@ -565,10 +596,14 @@ 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; - } + } + if (NULL == get_gps_geofence_interface) { + LOC_LOGE ("%s, get_gps_geofence_interface is NULL\n", __func__); + goto exit; + } geofence_interface = get_gps_geofence_interface(); @@ -613,7 +648,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; @@ -730,7 +765,7 @@ static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType) bearerType = AGPS_APN_BEARER_IPV4V6; break; default: - bearerType = AGPS_APN_BEARER_INVALID; + bearerType = AGPS_APN_BEARER_IPV4; break; } @@ -960,7 +995,8 @@ SIDE EFFECTS void loc_ni_init(GpsNiCallbacks *callbacks) { ENTRY_LOG(); - loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks); + gps_ni_cb = callbacks->notify_cb; + loc_eng_ni_init(loc_afw_data, &sGpsNiExtCallbacks); EXIT_LOG(%s, VOID_RET); } @@ -1075,3 +1111,10 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt) EXIT_LOG(%s, VOID_RET); } +static void local_ni_cb(GpsNiNotification *notification, bool esEnalbed) +{ + if (NULL != gps_ni_cb) { + gps_ni_cb(notification); + } +} + diff --git a/gps/loc_api/libloc_api_50001/loc.h b/gps/loc_api/libloc_api_50001/loc.h index e56fdcf..8cf77fc 100644 --- a/gps/loc_api/libloc_api_50001/loc.h +++ b/gps/loc_api/libloc_api_50001/loc.h @@ -35,7 +35,6 @@ extern "C" { #endif /* __cplusplus */ #include <ctype.h> -#include <cutils/properties.h> #include <hardware/gps.h> #include <gps_extended.h> @@ -57,6 +56,8 @@ typedef struct { loc_ext_parser location_ext_parser; loc_ext_parser sv_ext_parser; gps_request_utc_time request_utc_time_cb; + gnss_set_system_info set_system_info_cb; + gnss_sv_status_callback gnss_sv_status_cb; } LocCallbacks; #ifdef __cplusplus diff --git a/gps/loc_api/libloc_api_50001/loc_eng.cpp b/gps/loc_api/libloc_api_50001/loc_eng.cpp index c06206b..c1cc640 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng.cpp +++ b/gps/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-2016, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -47,19 +47,8 @@ #include <new> #include <LocEngAdapter.h> -#include <cutils/sched_policy.h> -#ifndef USE_GLIB -#include <utils/SystemClock.h> -#include <utils/Log.h> -#endif /* USE_GLIB */ - -#ifdef USE_GLIB -#include <glib.h> -#include <sys/syscall.h> -#endif /* USE_GLIB */ #include <string.h> - #include <loc_eng.h> #include <loc_eng_ni.h> #include <loc_eng_dmn_conn.h> @@ -68,8 +57,7 @@ #include <loc_eng_nmea.h> #include <msg_q.h> #include <loc.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> #include "loc_core_log.h" #include "loc_eng_log.h" @@ -98,8 +86,11 @@ static const loc_param_s_type gps_conf_table[] = {"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'}, + {"LPPE_CP_TECHNOLOGY", &gps_conf.LPPE_CP_TECHNOLOGY, NULL, 'n'}, + {"LPPE_UP_TECHNOLOGY", &gps_conf.LPPE_UP_TECHNOLOGY, NULL, 'n'}, {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'}, {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'}, + {"SUPL_ES", &gps_conf.SUPL_ES, 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'}, @@ -109,6 +100,8 @@ static const loc_param_s_type gps_conf_table[] = {"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'}, + {"AGPS_CONFIG_INJECT", &gps_conf.AGPS_CONFIG_INJECT, NULL, 'n'}, + {"EXTERNAL_DR_ENABLED", &gps_conf.EXTERNAL_DR_ENABLED, NULL, 'n'}, }; static const loc_param_s_type sap_conf_table[] = @@ -141,6 +134,7 @@ static void loc_default_parameters(void) gps_conf.GPS_LOCK = 0; gps_conf.SUPL_VER = 0x10000; gps_conf.SUPL_MODE = 0x3; + gps_conf.SUPL_ES = 0; gps_conf.CAPABILITIES = 0x7; /* LTE Positioning Profile configuration is disable by default*/ gps_conf.LPP_PROFILE = 0; @@ -150,6 +144,10 @@ static void loc_default_parameters(void) gps_conf.XTRA_VERSION_CHECK=0; /*Use emergency PDN by default*/ gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = 1; + /* By default no LPPe CP technology is enabled*/ + gps_conf.LPPE_CP_TECHNOLOGY = 0; + /* By default no LPPe UP technology is enabled*/ + gps_conf.LPPE_UP_TECHNOLOGY = 0; /*Defaults for sap.conf*/ sap_conf.GYRO_BIAS_RANDOM_WALK = 0; @@ -180,6 +178,9 @@ static void loc_default_parameters(void) /* None of the 10 slots for agps certificates are writable by default */ gps_conf.AGPS_CERT_WRITABLE_MASK = 0; + + /* inject supl config to modem with config values from config.xml or gps.conf, default 1 */ + gps_conf.AGPS_CONFIG_INJECT = 1; } // 2nd half of init(), singled out for @@ -206,6 +207,7 @@ static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data); static void deleteAidingData(loc_eng_data_s_type &logEng); static AgpsStateMachine* getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType); +static void createAgnssNifs(loc_eng_data_s_type& locEng); static int dataCallCb(void *cb_data); static void update_aiding_data_for_deletion(loc_eng_data_s_type& loc_eng_data) { if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON && @@ -406,7 +408,9 @@ struct LocEngSetServerIpv4 : public LocMsg { locallog(); } inline virtual void proc() const { - mAdapter->setServer(mNlAddr, mPort, mServerType); + if (gps_conf.AGPS_CONFIG_INJECT) { + mAdapter->setServer(mNlAddr, mPort, mServerType); + } } inline void locallog() const { LOC_LOGV("LocEngSetServerIpv4 - addr: %x, port: %d, type: %s", @@ -437,7 +441,9 @@ struct LocEngSetServerUrl : public LocMsg { delete[] mUrl; } inline virtual void proc() const { - mAdapter->setServer(mUrl, mLen); + if (gps_conf.AGPS_CONFIG_INJECT) { + mAdapter->setServer(mUrl, mLen); + } } inline void locallog() const { LOC_LOGV("LocEngSetServerUrl - url: %s", mUrl); @@ -458,7 +464,9 @@ struct LocEngAGlonassProtocol : public LocMsg { locallog(); } inline virtual void proc() const { - mAdapter->setAGLONASSProtocol(mAGlonassProtocl); + if (gps_conf.AGPS_CONFIG_INJECT) { + mAdapter->setAGLONASSProtocol(mAGlonassProtocl); + } } inline void locallog() const { LOC_LOGV("A-GLONASS protocol: 0x%lx", mAGlonassProtocl); @@ -468,6 +476,29 @@ struct LocEngAGlonassProtocol : public LocMsg { } }; + +struct LocEngLPPeProtocol : public LocMsg { + LocEngAdapter* mAdapter; + const unsigned long mLPPeCP; + const unsigned long mLPPeUP; + inline LocEngLPPeProtocol(LocEngAdapter* adapter, + unsigned long lppeCP, unsigned long lppeUP) : + LocMsg(), mAdapter(adapter), mLPPeCP(lppeCP), mLPPeUP(lppeUP) + { + locallog(); + } + inline virtual void proc() const { + mAdapter->setLPPeProtocol(mLPPeCP, mLPPeUP); + } + inline void locallog() const { + LOC_LOGV("LPPe CP: 0x%lx LPPe UP: 0x%1x", mLPPeCP, mLPPeUP); + } + inline virtual void log() const { + locallog(); + } +}; + + // case LOC_ENG_MSG_SUPL_VERSION: struct LocEngSuplVer : public LocMsg { LocEngAdapter* mAdapter; @@ -479,7 +510,9 @@ struct LocEngSuplVer : public LocMsg { locallog(); } inline virtual void proc() const { - mAdapter->setSUPLVersion(mSuplVer); + if (gps_conf.AGPS_CONFIG_INJECT) { + mAdapter->setSUPLVersion(mSuplVer); + } } inline void locallog() const { LOC_LOGV("SUPL Version: %d", mSuplVer); @@ -507,6 +540,31 @@ struct LocEngSuplMode : public LocMsg { } }; +// case LOC_ENG_MSG_SET_NMEA_TYPE: +struct LocEngSetNmeaTypes : public LocMsg { + LocEngAdapter* mAdapter; + uint32_t nmeaTypesMask; + inline LocEngSetNmeaTypes(LocEngAdapter* adapter, + uint32_t typesMask) : + LocMsg(), mAdapter(adapter), nmeaTypesMask(typesMask) + { + locallog(); + } + inline virtual void proc() const { + // set the nmea types + mAdapter->setNMEATypes(nmeaTypesMask); + } + inline void locallog() const + { + LOC_LOGV("LocEngSetNmeaTypes %u\n",nmeaTypesMask); + } + inline virtual void log() const + { + locallog(); + } +}; + + // case LOC_ENG_MSG_LPP_CONFIG: struct LocEngLppConfig : public LocMsg { LocEngAdapter* mAdapter; @@ -518,7 +576,9 @@ struct LocEngLppConfig : public LocMsg { locallog(); } inline virtual void proc() const { - mAdapter->setLPPConfig(mLppConfig); + if (gps_conf.AGPS_CONFIG_INJECT) { + mAdapter->setLPPConfig(mLppConfig); + } } inline void locallog() const { LOC_LOGV("LocEngLppConfig - profile: %d", mLppConfig); @@ -697,29 +757,6 @@ struct LocEngSensorPerfControlConfig : public LocMsg { } }; -// case LOC_ENG_MSG_EXT_POWER_CONFIG: -struct LocEngExtPowerConfig : public LocMsg { - LocEngAdapter* mAdapter; - const int mIsBatteryCharging; - inline LocEngExtPowerConfig(LocEngAdapter* adapter, - int isBatteryCharging) : - LocMsg(), mAdapter(adapter), - mIsBatteryCharging(isBatteryCharging) - { - locallog(); - } - inline virtual void proc() const { - mAdapter->setExtPowerConfig(mIsBatteryCharging); - } - inline void locallog() const { - LOC_LOGV("LocEngExtPowerConfig - isBatteryCharging: %d", - mIsBatteryCharging); - } - inline virtual void log() const { - locallog(); - } -}; - // case LOC_ENG_MSG_REPORT_POSITION: LocEngReportPosition::LocEngReportPosition(LocAdapterBase* adapter, UlpLocation &loc, @@ -843,9 +880,9 @@ void LocEngReportSv::proc() const { if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) { - if (locEng->sv_status_cb != NULL) { - locEng->sv_status_cb((GpsSvStatus*)&(mSvStatus), - (void*)mSvExt); + if (locEng->gnss_sv_status_cb != NULL) { + LOC_LOGE("Calling gnss_sv_status_cb"); + locEng->gnss_sv_status_cb((GnssSvStatus*)&(mSvStatus)); } if (locEng->generateNmea) @@ -900,7 +937,6 @@ void LocEngReportNmea::proc() const { struct timeval tv; gettimeofday(&tv, (struct timezone *) NULL); int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000; - CALLBACK_LOG_CALLFLOW("nmea_cb", %d, mLen); if (locEng->nmea_cb != NULL) locEng->nmea_cb(now, mNmea, mLen); @@ -1088,7 +1124,7 @@ LocEngRequestSuplEs::LocEngRequestSuplEs(void* locEng, int id) : } void LocEngRequestSuplEs::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mLocEng; - if (locEng->ds_nif) { + if (locEng->ds_nif && gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) { AgpsStateMachine* sm = locEng->ds_nif; DSSubscriber s(sm, mID); sm->subscribeRsrc((Subscriber*)&s); @@ -1375,6 +1411,32 @@ struct LocEngSetCapabilities : public LocMsg { } }; +struct LocEngSetSystemInfo : public LocMsg { + loc_eng_data_s_type* mLocEng; + inline LocEngSetSystemInfo(loc_eng_data_s_type* locEng) : + LocMsg(), mLocEng(locEng) + { + locallog(); + } + inline virtual void proc() const { + if (NULL != mLocEng->set_system_info_cb) { + LOC_LOGV("calling set_system_info_cb 0x%x", + mLocEng->adapter->mGnssInfo.year_of_hw); + mLocEng->set_system_info_cb(&(mLocEng->adapter->mGnssInfo)); + } + else { + LOC_LOGV("set_system_info_cb is NULL.\n"); + } + } + inline void locallog() const + { + LOC_LOGV("LocEngSetSystemInfo"); + } + inline virtual void log() const + { + locallog(); + } +}; // case LOC_ENG_MSG_LOC_INIT: struct LocEngInit : public LocMsg { loc_eng_data_s_type* mLocEng; @@ -1387,6 +1449,7 @@ struct LocEngInit : public LocMsg { loc_eng_reinit(*mLocEng); // set the capabilities mLocEng->adapter->sendMsg(new LocEngSetCapabilities(mLocEng)); + mLocEng->adapter->sendMsg(new LocEngSetSystemInfo(mLocEng)); } inline void locallog() const { @@ -1403,16 +1466,18 @@ struct LocEngInit : public LocMsg { // case LOC_ENG_MSG_ATL_OPEN_SUCCESS: struct LocEngAtlOpenSuccess : public LocMsg { - AgpsStateMachine* mStateMachine; + loc_eng_data_s_type* mLocEng; + const AGpsExtType mAgpsType; const int mLen; char* mAPN; const AGpsBearerType mBearerType; - inline LocEngAtlOpenSuccess(AgpsStateMachine* statemachine, + inline LocEngAtlOpenSuccess(loc_eng_data_s_type* locEng, + const AGpsExtType agpsType, const char* name, int len, AGpsBearerType btype) : LocMsg(), - mStateMachine(statemachine), mLen(len), + mLocEng(locEng), mAgpsType(agpsType), mLen(len), mAPN(new char[len+1]), mBearerType(btype) { memcpy((void*)mAPN, (void*)name, len); @@ -1424,14 +1489,15 @@ struct LocEngAtlOpenSuccess : public LocMsg { delete[] mAPN; } inline virtual void proc() const { - mStateMachine->setBearer(mBearerType); - mStateMachine->setAPN(mAPN, mLen); - mStateMachine->onRsrcEvent(RSRC_GRANTED); + AgpsStateMachine* sm = getAgpsStateMachine(*mLocEng, mAgpsType); + sm->setBearer(mBearerType); + sm->setAPN(mAPN, mLen); + sm->onRsrcEvent(RSRC_GRANTED); } inline void locallog() const { LOC_LOGV("LocEngAtlOpenSuccess agps type: %s\n apn: %s\n" " bearer type: %s", - loc_get_agps_type_name(mStateMachine->getType()), + loc_get_agps_type_name(mAgpsType), mAPN, loc_get_agps_bear_name(mBearerType)); } @@ -1442,13 +1508,16 @@ struct LocEngAtlOpenSuccess : public LocMsg { // case LOC_ENG_MSG_ATL_CLOSED: struct LocEngAtlClosed : public LocMsg { - AgpsStateMachine* mStateMachine; - inline LocEngAtlClosed(AgpsStateMachine* statemachine) : - LocMsg(), mStateMachine(statemachine) { + loc_eng_data_s_type* mLocEng; + const AGpsExtType mAgpsType; + inline LocEngAtlClosed(loc_eng_data_s_type* locEng, + const AGpsExtType agpsType) : + LocMsg(), mLocEng(locEng), mAgpsType(agpsType) { locallog(); } inline virtual void proc() const { - mStateMachine->onRsrcEvent(RSRC_RELEASED); + AgpsStateMachine* sm = getAgpsStateMachine(*mLocEng, mAgpsType); + sm->onRsrcEvent(RSRC_RELEASED); } inline void locallog() const { LOC_LOGV("LocEngAtlClosed"); @@ -1460,13 +1529,16 @@ struct LocEngAtlClosed : public LocMsg { // case LOC_ENG_MSG_ATL_OPEN_FAILED: struct LocEngAtlOpenFailed : public LocMsg { - AgpsStateMachine* mStateMachine; - inline LocEngAtlOpenFailed(AgpsStateMachine* statemachine) : - LocMsg(), mStateMachine(statemachine) { + loc_eng_data_s_type* mLocEng; + const AGpsExtType mAgpsType; + inline LocEngAtlOpenFailed(loc_eng_data_s_type* locEng, + const AGpsExtType agpsType) : + LocMsg(), mLocEng(locEng), mAgpsType(agpsType) { locallog(); } inline virtual void proc() const { - mStateMachine->onRsrcEvent(RSRC_DENIED); + AgpsStateMachine* sm = getAgpsStateMachine(*mLocEng, mAgpsType); + sm->onRsrcEvent(RSRC_DENIED); } inline void locallog() const { LOC_LOGV("LocEngAtlOpenFailed"); @@ -1508,22 +1580,17 @@ inline void LocEngUp::log() const { locallog(); } -struct LocEngDataClientInit : public LocMsg { +struct LocEngAgnssNifInit : public LocMsg { loc_eng_data_s_type* mLocEng; - inline LocEngDataClientInit(loc_eng_data_s_type* locEng) : + inline LocEngAgnssNifInit(loc_eng_data_s_type* locEng) : LocMsg(), mLocEng(locEng) { locallog(); } virtual void proc() const { - loc_eng_data_s_type *locEng = (loc_eng_data_s_type *)mLocEng; - if(!locEng->adapter->initDataServiceClient()) { - locEng->ds_nif = new DSStateMachine(servicerTypeExt, - (void *)dataCallCb, - locEng->adapter); - } + createAgnssNifs(*mLocEng); } void locallog() const { - LOC_LOGV("LocEngDataClientInit\n"); + LOC_LOGV("LocEngAgnssNifInit\n"); } virtual void log() const { locallog(); @@ -1576,29 +1643,6 @@ struct LocEngInstallAGpsCert : public LocMsg { } }; -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) : @@ -1606,10 +1650,13 @@ struct LocEngGnssConstellationConfig : public LocMsg { locallog(); } inline virtual void proc() const { + mAdapter->mGnssInfo.size = sizeof(GnssSystemInfo); if (mAdapter->gnssConstellationConfig()) { LOC_LOGV("Modem supports GNSS measurements\n"); gps_conf.CAPABILITIES |= GPS_CAPABILITY_MEASUREMENTS; + mAdapter->mGnssInfo.year_of_hw = 2016; } else { + mAdapter->mGnssInfo.year_of_hw = 2015; LOC_LOGV("Modem does not support GNSS measurements\n"); } } @@ -1622,50 +1669,59 @@ struct LocEngGnssConstellationConfig : public LocMsg { }; // case LOC_ENG_MSG_REPORT_GNSS_MEASUREMENT: -LocEngReportGpsMeasurement::LocEngReportGpsMeasurement(void* locEng, - GpsData &gpsData) : - LocMsg(), mLocEng(locEng), mGpsData(gpsData) +LocEngReportGnssMeasurement::LocEngReportGnssMeasurement(void* locEng, + GnssData &gnssData) : + LocMsg(), mLocEng(locEng), mGnssData(gnssData) { locallog(); } -void LocEngReportGpsMeasurement::proc() const { +void LocEngReportGnssMeasurement::proc() const { loc_eng_data_s_type* locEng = (loc_eng_data_s_type*) mLocEng; if (locEng->mute_session_state != LOC_MUTE_SESS_IN_SESSION) { - if (locEng->gps_measurement_cb != NULL) { - locEng->gps_measurement_cb((GpsData*)&(mGpsData)); + if (locEng->gnss_measurement_cb != NULL) { + LOC_LOGV("Calling gnss_measurement_cb"); + locEng->gnss_measurement_cb((GnssData*)&(mGnssData)); } } } -void LocEngReportGpsMeasurement::locallog() const { +void LocEngReportGnssMeasurement::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++) { + __func__, __LINE__, mGnssData.measurement_count); + for (int i =0; i< mGnssData.measurement_count && i < GNSS_MAX_SVS; i++) { LOC_LOGV(" GNSS measurement data in GPS HAL: \n" - " GPS_HAL => Measurement ID | prn | time_offset_ns | state |" - " received_gps_tow_ns| c_n0_dbhz | pseudorange_rate_mps |" + " GPS_HAL => Measurement ID | svid | time_offset_ns | state |" + " c_n0_dbhz | pseudorange_rate_mps |" " pseudorange_rate_uncertainty_mps |" " accumulated_delta_range_state | flags \n" - " GPS_HAL => %d | %d | %f | %d | %lld | %f | %f | %f | %d | %d \n", + " GPS_HAL => %d | %d | %f | %d | %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); + mGnssData.measurements[i].svid, + mGnssData.measurements[i].time_offset_ns, + mGnssData.measurements[i].state, + mGnssData.measurements[i].c_n0_dbhz, + mGnssData.measurements[i].pseudorange_rate_mps, + mGnssData.measurements[i].pseudorange_rate_uncertainty_mps, + mGnssData.measurements[i].accumulated_delta_range_state, + mGnssData.measurements[i].flags); } - LOC_LOGV(" GPS_HAL => Clocks Info: type | time_ns \n" - " GPS_HAL => Clocks Info: %d | %lld", mGpsData.clock.type, - mGpsData.clock.time_ns); - } -} -inline void LocEngReportGpsMeasurement::log() const { + LOC_LOGV(" GPS_HAL => Clocks Info: \n" + " time_ns | full_bias_ns | bias_ns | bias_uncertainty_ns | " + " drift_nsps | drift_uncertainty_nsps | hw_clock_discontinuity_count | flags" + " GPS_HAL => Clocks Info: %lld | %lld | %g | %g | %g | %g | %d | 0x%04x\n", + mGnssData.clock.time_ns, + mGnssData.clock.full_bias_ns, + mGnssData.clock.bias_ns, + mGnssData.clock.bias_uncertainty_ns, + mGnssData.clock.drift_nsps, + mGnssData.clock.drift_uncertainty_nsps, + mGnssData.clock.hw_clock_discontinuity_count, + mGnssData.clock.flags); + } +} +inline void LocEngReportGnssMeasurement::log() const { locallog(); } @@ -1727,6 +1783,8 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb; loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb; loc_eng_data.request_utc_time_cb = callbacks->request_utc_time_cb; + loc_eng_data.set_system_info_cb = callbacks->set_system_info_cb; + loc_eng_data.gnss_sv_status_cb = callbacks->gnss_sv_status_cb; loc_eng_data.location_ext_parser = callbacks->location_ext_parser ? callbacks->location_ext_parser : noProc; loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ? @@ -1742,7 +1800,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report loc_eng_data.generateNmea = true; } - else + else if (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_MP) { loc_eng_data.generateNmea = false; } @@ -1751,6 +1809,8 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, new LocEngAdapter(event, &loc_eng_data, context, (LocThread::tCreate)callbacks->create_thread_cb); + loc_eng_data.adapter->mGnssInfo.size = sizeof(GnssSystemInfo); + loc_eng_data.adapter->mGnssInfo.year_of_hw = 2015; LOC_LOGD("loc_eng_init created client, id = %p\n", loc_eng_data.adapter); loc_eng_data.adapter->sendMsg(new LocEngInit(&loc_eng_data)); @@ -1771,6 +1831,15 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data) 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)); + adapter->sendMsg(new LocEngLPPeProtocol(adapter, gps_conf.LPPE_CP_TECHNOLOGY, + gps_conf.LPPE_UP_TECHNOLOGY)); + + if (!loc_eng_data.generateNmea) + { + NmeaSentenceTypesMask typesMask = LOC_NMEA_ALL_SUPPORTED_MASK; + LOC_LOGD("loc_eng_init setting nmea types, mask = %u\n",typesMask); + adapter->sendMsg(new LocEngSetNmeaTypes(adapter,typesMask)); + } /* 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 || @@ -2116,6 +2185,9 @@ void loc_eng_delete_aiding_data(loc_eng_data_s_type &loc_eng_data, GpsAidingData ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return); + //report delete aiding data to ULP to send to DRPlugin + loc_eng_data.adapter->getUlpProxy()->reportDeleteAidingData(f); + loc_eng_data.adapter->sendMsg(new LocEngDelAidData(&loc_eng_data, f)); EXIT_LOG(%s, VOID_RET); @@ -2274,31 +2346,14 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call EXIT_LOG(%s, VOID_RET); return; } + bool agpsCapable = ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || + (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)); LocEngAdapter* adapter = loc_eng_data.adapter; loc_eng_data.agps_status_cb = callbacks->status_cb; - loc_eng_data.internet_nif = new AgpsStateMachine(servicerTypeAgps, - (void *)loc_eng_data.agps_status_cb, - AGPS_TYPE_WWAN_ANY, - false); - loc_eng_data.wifi_nif = new AgpsStateMachine(servicerTypeAgps, - (void *)loc_eng_data.agps_status_cb, - AGPS_TYPE_WIFI, - true); - - if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || - (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) { - loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps, - (void *)loc_eng_data.agps_status_cb, - AGPS_TYPE_SUPL, - false); - + if (agpsCapable && NULL != adapter) { 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); + adapter->sendMsg(new LocEngAgnssNifInit(&loc_eng_data)); } loc_eng_agps_reinit(loc_eng_data); } @@ -2314,6 +2369,35 @@ static void deleteAidingData(loc_eng_data_s_type &logEng) { } } +// must be called under msg handler context +static void createAgnssNifs(loc_eng_data_s_type& locEng) { + bool agpsCapable = ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || + (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)); + LocEngAdapter* adapter = locEng.adapter; + if (agpsCapable && NULL != adapter && adapter->mSupportsAgpsRequests) { + if (NULL == locEng.internet_nif) { + locEng.internet_nif= new AgpsStateMachine(servicerTypeAgps, + (void *)locEng.agps_status_cb, + AGPS_TYPE_WWAN_ANY, + false); + } + if (NULL == locEng.agnss_nif) { + locEng.agnss_nif = new AgpsStateMachine(servicerTypeAgps, + (void *)locEng.agps_status_cb, + AGPS_TYPE_SUPL, + false); + } + if (NULL == locEng.ds_nif && + gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL && + 0 == adapter->initDataServiceClient()) { + locEng.ds_nif = new DSStateMachine(servicerTypeExt, + (void *)dataCallCb, + locEng.adapter); + } + } +} + +// must be called under msg handler context static AgpsStateMachine* getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) { AgpsStateMachine* stateMachine; @@ -2328,9 +2412,14 @@ getAgpsStateMachine(loc_eng_data_s_type &locEng, AGpsExtType agpsType) { break; } case AGPS_TYPE_SUPL_ES: { - locEng.ds_nif ? - stateMachine = locEng.ds_nif: + if (gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) { + if (NULL == locEng.ds_nif) { + createAgnssNifs(locEng); + } + stateMachine = locEng.ds_nif; + } else { stateMachine = locEng.agnss_nif; + } break; } default: @@ -2372,10 +2461,9 @@ int loc_eng_agps_open(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType, LOC_LOGD("loc_eng_agps_open APN name = [%s]", apn); int apn_len = smaller_of(strlen (apn), MAX_APN_LEN); - AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType); - loc_eng_data.adapter->sendMsg( - new LocEngAtlOpenSuccess(sm, apn, apn_len, bearerType)); + new LocEngAtlOpenSuccess(&loc_eng_data, agpsType, + apn, apn_len, bearerType)); EXIT_LOG(%d, 0); return 0; @@ -2404,8 +2492,8 @@ int loc_eng_agps_closed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agpsType) INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb, return -1); - AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType); - loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(sm)); + loc_eng_data.adapter->sendMsg(new LocEngAtlClosed(&loc_eng_data, + agpsType)); EXIT_LOG(%d, 0); return 0; @@ -2434,8 +2522,8 @@ int loc_eng_agps_open_failed(loc_eng_data_s_type &loc_eng_data, AGpsExtType agps INIT_CHECK(loc_eng_data.adapter && loc_eng_data.agps_status_cb, return -1); - AgpsStateMachine* sm = getAgpsStateMachine(loc_eng_data, agpsType); - loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(sm)); + loc_eng_data.adapter->sendMsg(new LocEngAtlOpenFailed(&loc_eng_data, + agpsType)); EXIT_LOG(%d, 0); return 0; @@ -2711,13 +2799,20 @@ void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, if (gps_conf_tmp.SUPL_MODE != gps_conf.SUPL_MODE) { adapter->sendMsg(new LocEngSuplMode(adapter->getUlpProxy())); } + // we always update lock mask, this is because if this is dsds device, we would not + // know if modem has switched dds, if so, lock mask may also need to be updated. + // if we have power vote, HAL is on, lock mask 0; else gps_conf.GPS_LOCK. + adapter->setGpsLockMsg(adapter->getPowerVote() ? 0 : gps_conf.GPS_LOCK); } 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.SUPL_MODE = gps_conf.SUPL_MODE; + gps_conf_tmp.SUPL_ES = gps_conf.SUPL_ES; gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK; + gps_conf_tmp.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL = + gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL; gps_conf = gps_conf_tmp; } @@ -2843,29 +2938,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 @@ -2923,8 +2995,8 @@ int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data, { ENTRY_LOG_CALLFLOW(); - STATE_CHECK((NULL == loc_eng_data.gps_measurement_cb), - "gps measurement already initialized", + STATE_CHECK((NULL == loc_eng_data.gnss_measurement_cb), + "gnss measurement already initialized", return GPS_MEASUREMENT_ERROR_ALREADY_INIT); STATE_CHECK((callbacks != NULL), "callbacks can not be NULL", @@ -2935,12 +3007,9 @@ int loc_eng_gps_measurement_init(loc_eng_data_s_type &loc_eng_data, // 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)); + loc_eng_data.adapter->updateEvtMask(event, LOC_REGISTRATION_MASK_ENABLED); // set up the callback - loc_eng_data.gps_measurement_cb = callbacks->measurement_callback; + loc_eng_data.gnss_measurement_cb = callbacks->gnss_measurement_callback; LOC_LOGD ("%s, event masks updated successfully", __func__); return GPS_MEASUREMENT_OPERATION_SUCCESS; @@ -2970,11 +3039,8 @@ void loc_eng_gps_measurement_close(loc_eng_data_s_type &loc_eng_data) // 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)); + loc_eng_data.adapter->updateEvtMask(event, LOC_REGISTRATION_MASK_DISABLED); // set up the callback - loc_eng_data.gps_measurement_cb = NULL; + loc_eng_data.gnss_measurement_cb = NULL; EXIT_LOG(%d, 0); } diff --git a/gps/loc_api/libloc_api_50001/loc_eng.h b/gps/loc_api/libloc_api_50001/loc_eng.h index 6f90b23..1ff391a 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng.h +++ b/gps/loc_api/libloc_api_50001/loc_eng.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, 2016 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -54,7 +54,6 @@ typedef unsigned char boolean; #include <loc_eng_agps.h> #include <loc_cfg.h> #include <loc_log.h> -#include <log_util.h> #include <loc_eng_agps.h> #include <LocEngAdapter.h> @@ -90,12 +89,14 @@ typedef struct loc_eng_data_s loc_sv_status_cb_ext sv_status_cb; agps_status_extended agps_status_cb; gps_nmea_callback nmea_cb; - gps_ni_notify_callback ni_notify_cb; + loc_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; + gnss_set_system_info set_system_info_cb; + gnss_sv_status_callback gnss_sv_status_cb; + gnss_measurement_callback gnss_measurement_cb; boolean intermediateFix; AGpsStatusValue agps_status; loc_eng_xtra_data_s_type xtra_module_data; @@ -120,7 +121,8 @@ typedef struct loc_eng_data_s // For nmea generation boolean generateNmea; - uint32_t sv_used_mask; + uint32_t gps_used_mask; + uint32_t glo_used_mask; float hdop; float pdop; float vdop; diff --git a/gps/loc_api/libloc_api_50001/loc_eng_agps.cpp b/gps/loc_api/libloc_api_50001/loc_eng_agps.cpp index 5016b5c..43af70f 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_agps.cpp +++ b/gps/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 <loc_eng_agps.h> #include <loc_eng_log.h> -#include <log_util.h> #include <platform_lib_includes.h> #include <loc_eng_dmn_conn_handler.h> #include <loc_eng_dmn_conn.h> diff --git a/gps/loc_api/libloc_api_50001/loc_eng_agps.h b/gps/loc_api/libloc_api_50001/loc_eng_agps.h index 2d689ce..58ce084 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_agps.h +++ b/gps/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 @@ -40,10 +40,14 @@ #include <linked_list.h> #include <loc_timer.h> #include <LocEngAdapter.h> +#include <platform_lib_includes.h> +#if defined(USE_GLIB) && !defined(OFF_TARGET) +#include <glib.h> +#endif /* USE_GLIB */ // forward declaration class AgpsStateMachine; -class Subscriber; +struct Subscriber; // NIF resource events typedef enum { diff --git a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp b/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp index c257dff..5510fc5 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn.cpp +++ b/gps/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 <grp.h> #include <sys/stat.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> #include "loc_eng_dmn_conn_glue_msg.h" #include "loc_eng_dmn_conn_handler.h" #include "loc_eng_dmn_conn.h" diff --git a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c b/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c index a1076ff..e947fa1 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_msg.c +++ b/gps/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 <linux/types.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> #include "loc_eng_dmn_conn_glue_msg.h" #include "loc_eng_dmn_conn_handler.h" diff --git a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c b/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c index dffcad0..cbc4ea6 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_glue_pipe.c +++ b/gps/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 <sys/stat.h> #include "loc_eng_dmn_conn_glue_pipe.h" -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> /*=========================================================================== FUNCTION loc_eng_dmn_conn_glue_pipeget @@ -110,8 +109,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/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp b/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp index edd53f2..137f686 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_handler.cpp +++ b/gps/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 <string.h> #include <unistd.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> #include "loc_eng_msg.h" #include "loc_eng_dmn_conn.h" #include "loc_eng_dmn_conn_handler.h" diff --git a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c b/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c index 9fed9d4..b30f6d7 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_dmn_conn_thread_helper.c +++ b/gps/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 <stdio.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> #include "loc_eng_dmn_conn_thread_helper.h" /*=========================================================================== diff --git a/gps/loc_api/libloc_api_50001/loc_eng_msg.h b/gps/loc_api/libloc_api_50001/loc_eng_msg.h index 9c7b9bc..2fa9b42 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/gps/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,16 +34,16 @@ #include <gps_extended.h> #include <stdlib.h> #include <string.h> -#include <log_util.h> #include <loc_eng_log.h> #include <loc_eng.h> #include <MsgTask.h> #include <LocEngAdapter.h> +#include <platform_lib_includes.h> #ifndef SSID_BUF_SIZE #define SSID_BUF_SIZE (32+1) #endif -#ifdef USE_GLIB +#if defined(USE_GLIB) && !defined(OFF_TARGET) #include <glib.h> @@ -289,11 +289,11 @@ struct LocEngGetZpp : public LocMsg { void send() const; }; -struct LocEngReportGpsMeasurement : public LocMsg { +struct LocEngReportGnssMeasurement : public LocMsg { void* mLocEng; - const GpsData mGpsData; - LocEngReportGpsMeasurement(void* locEng, - GpsData &gpsData); + const GnssData mGnssData; + LocEngReportGnssMeasurement(void* locEng, + GnssData &gnssData); virtual void proc() const; void locallog() const; virtual void log() const; diff --git a/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp b/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp index 4597b98..9b454c6 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -43,8 +43,7 @@ #include <loc_eng.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> using namespace loc_core; @@ -189,7 +188,7 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, } CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id); - loc_eng_data.ni_notify_cb((GpsNiNotification*)notif); + loc_eng_data.ni_notify_cb((GpsNiNotification*)notif, gps_conf.SUPL_ES != 0); } EXIT_LOG(%s, VOID_RET); } diff --git a/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp b/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp index 126a97f..3d2336f 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_nmea.cpp +++ b/gps/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, 2016, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,14 +29,10 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_eng_nmea" -#define GPS_PRN_START 1 -#define GPS_PRN_END 32 -#define GLONASS_PRN_START 65 -#define GLONASS_PRN_END 96 #include <loc_eng.h> #include <loc_eng_nmea.h> #include <math.h> -#include "log_util.h" +#include <platform_lib_includes.h> /*=========================================================================== FUNCTION loc_eng_nmea_send @@ -59,7 +55,6 @@ void loc_eng_nmea_send(char *pNmea, int length, loc_eng_data_s_type *loc_eng_dat struct timeval tv; gettimeofday(&tv, (struct timezone *) NULL); int64_t now = tv.tv_sec * 1000LL + tv.tv_usec / 1000; - CALLBACK_LOG_CALLFLOW("nmea_cb", %p, pNmea); if (loc_eng_data_p->nmea_cb != NULL) loc_eng_data_p->nmea_cb(now, pNmea, length); LOC_LOGD("NMEA <%s", pNmea); @@ -93,8 +88,12 @@ int loc_eng_nmea_put_checksum(char *pNmea, int maxSize) length++; } + // length now contains nmea sentence string length not including $ sign. int checksumLength = snprintf(pNmea,(maxSize-length-1),"*%02X\r\n", checksum); - return (length + checksumLength); + + // total length of nmea sentence is length of nmea sentence inc $ sign plus + // length of checksum (+1 is to cover the $ character in the length). + return (length + checksumLength + 1); } /*=========================================================================== @@ -102,6 +101,12 @@ FUNCTION loc_eng_nmea_generate_pos DESCRIPTION Generate NMEA sentences generated based on position report + Currently below sentences are generated within this function: + - $GPGSA : GPS DOP and active SVs + - $GNGSA : GLONASS DOP and active SVs + - $GPVTG : Track made good and ground speed + - $GPRMC : Recommended minimum navigation information + - $GPGGA : Time, position and fix related data DEPENDENCIES NONE @@ -136,6 +141,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) { // ------------------ @@ -144,7 +150,7 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, uint32_t svUsedCount = 0; uint32_t svUsedList[32] = {0}; - uint32_t mask = loc_eng_data_p->sv_used_mask; + uint32_t mask = loc_eng_data_p->gps_used_mask; for (uint8_t i = 1; mask > 0 && svUsedCount < 32; i++) { if (mask & 1) @@ -152,7 +158,7 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, mask = mask >> 1; } // clear the cache so they can't be used again - loc_eng_data_p->sv_used_mask = 0; + loc_eng_data_p->gps_used_mask = 0; char fixType; if (svUsedCount == 0) @@ -211,6 +217,99 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, loc_eng_nmea_send(sentence, length, loc_eng_data_p); // ------------------ + // ------$GNGSA------ + // ------------------ + uint32_t gloUsedCount = 0; + uint32_t gloUsedList[32] = {0}; + + // Reset locals for GNGSA sentence generation + pMarker = sentence; + lengthRemaining = sizeof(sentence); + mask = loc_eng_data_p->glo_used_mask; + fixType = '\0'; + + // Parse the glonass sv mask, and fetch glo sv ids + // Mask corresponds to the offset. + // GLONASS SV ids are from 65-96 + const int GLONASS_SV_ID_OFFSET = 64; + for (uint8_t i = 1; mask > 0 && gloUsedCount < 32; i++) + { + if (mask & 1) + gloUsedList[gloUsedCount++] = i + GLONASS_SV_ID_OFFSET; + mask = mask >> 1; + } + // clear the cache so they can't be used again + loc_eng_data_p->glo_used_mask = 0; + + if (gloUsedCount == 0) + fixType = '1'; // no fix + else if (gloUsedCount <= 3) + fixType = '2'; // 2D fix + else + fixType = '3'; // 3D fix + + // Start printing the sentence + // Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v*cc + // GNGSA : for glonass SVs + // a : Mode : A : Automatic, allowed to automatically switch 2D/3D + // x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix) + // xx : 12 SV ID + // p.p : Position DOP (Dilution of Precision) + // h.h : Horizontal DOP + // v.v : Vertical DOP + // cc : Checksum value + length = snprintf(pMarker, lengthRemaining, "$GNGSA,A,%c,", fixType); + + if (length < 0 || length >= lengthRemaining) + { + LOC_LOGE("NMEA Error in string formatting"); + return; + } + pMarker += length; + lengthRemaining -= length; + + // Add first 12 GLONASS satellite IDs + for (uint8_t i = 0; i < 12; i++) + { + if (i < gloUsedCount) + length = snprintf(pMarker, lengthRemaining, "%02d,", gloUsedList[i]); + else + length = snprintf(pMarker, lengthRemaining, ","); + + if (length < 0 || length >= lengthRemaining) + { + LOC_LOGE("NMEA Error in string formatting"); + return; + } + pMarker += length; + lengthRemaining -= length; + } + + // Add the position/horizontal/vertical DOP values + if (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_DOP) + { // dop is in locationExtended, (QMI) + length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f", + locationExtended.pdop, + locationExtended.hdop, + locationExtended.vdop); + } + else if (loc_eng_data_p->pdop > 0 && loc_eng_data_p->hdop > 0 && loc_eng_data_p->vdop > 0) + { // dop was cached from sv report (RPC) + length = snprintf(pMarker, lengthRemaining, "%.1f,%.1f,%.1f", + loc_eng_data_p->pdop, + loc_eng_data_p->hdop, + loc_eng_data_p->vdop); + } + else + { // no dop + length = snprintf(pMarker, lengthRemaining, ",,"); + } + + /* Sentence is ready, add checksum and broadcast */ + length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); + loc_eng_nmea_send(sentence, length, loc_eng_data_p); + + // ------------------ // ------$GPVTG------ // ------------------ @@ -281,8 +380,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 +533,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) { @@ -565,6 +664,10 @@ void loc_eng_nmea_generate_pos(loc_eng_data_s_type *loc_eng_data_p, length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); loc_eng_nmea_send(sentence, length, loc_eng_data_p); + strlcpy(sentence, "$GNGSA,A,1,,,,,,,,,,,,,,,", sizeof(sentence)); + length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); + loc_eng_nmea_send(sentence, length, loc_eng_data_p); + strlcpy(sentence, "$GPVTG,,T,,M,,N,,K,N", sizeof(sentence)); length = loc_eng_nmea_put_checksum(sentence, sizeof(sentence)); loc_eng_nmea_send(sentence, length, loc_eng_data_p); @@ -621,15 +724,27 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, //Count GPS SVs for saparating GPS from GLONASS and throw others + loc_eng_data_p->gps_used_mask = 0; + loc_eng_data_p->glo_used_mask = 0; for(svNumber=1; svNumber <= svCount; svNumber++) { - if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START)&& - (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) ) + if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation) { + // cache the used in fix mask, as it will be needed to send $GPGSA + // during the position report + if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX)) + { + loc_eng_data_p->gps_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1)); + } gpsCount++; } - else if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) && - (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) + else if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation) { + // cache the used in fix mask, as it will be needed to send $GNGSA + // during the position report + if (GNSS_SV_FLAGS_USED_IN_FIX == (svStatus.gnss_sv_list[svNumber - 1].flags & GNSS_SV_FLAGS_USED_IN_FIX)) + { + loc_eng_data_p->glo_used_mask |= (1 << (svStatus.gnss_sv_list[svNumber - 1].svid - 1)); + } glnCount++; } } @@ -669,13 +784,12 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++) { - if( (svStatus.sv_list[svNumber-1].prn >= GPS_PRN_START) && - (svStatus.sv_list[svNumber-1].prn <= GPS_PRN_END) ) + if (GNSS_CONSTELLATION_GPS == svStatus.gnss_sv_list[svNumber - 1].constellation) { length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,", - svStatus.sv_list[svNumber-1].prn, - (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int - (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int + svStatus.gnss_sv_list[svNumber-1].svid, + (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].elevation), //float to int + (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].azimuth)); //float to int if (length < 0 || length >= lengthRemaining) { @@ -685,10 +799,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, pMarker += length; lengthRemaining -= length; - if (svStatus.sv_list[svNumber-1].snr > 0) + if (svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz > 0) { length = snprintf(pMarker, lengthRemaining,"%02d", - (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int + (int)(0.5 + svStatus.gnss_sv_list[svNumber-1].c_n0_dbhz)); //float to int if (length < 0 || length >= lengthRemaining) { @@ -747,13 +861,13 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, for (int i=0; (svNumber <= svCount) && (i < 4); svNumber++) { - if( (svStatus.sv_list[svNumber-1].prn >= GLONASS_PRN_START) && - (svStatus.sv_list[svNumber-1].prn <= GLONASS_PRN_END) ) { + if (GNSS_CONSTELLATION_GLONASS == svStatus.gnss_sv_list[svNumber - 1].constellation) + { length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,", - svStatus.sv_list[svNumber-1].prn, - (int)(0.5 + svStatus.sv_list[svNumber-1].elevation), //float to int - (int)(0.5 + svStatus.sv_list[svNumber-1].azimuth)); //float to int + svStatus.gnss_sv_list[svNumber - 1].svid, + (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].elevation), //float to int + (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].azimuth)); //float to int if (length < 0 || length >= lengthRemaining) { @@ -763,10 +877,10 @@ void loc_eng_nmea_generate_sv(loc_eng_data_s_type *loc_eng_data_p, pMarker += length; lengthRemaining -= length; - if (svStatus.sv_list[svNumber-1].snr > 0) + if (svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz > 0) { length = snprintf(pMarker, lengthRemaining,"%02d", - (int)(0.5 + svStatus.sv_list[svNumber-1].snr)); //float to int + (int)(0.5 + svStatus.gnss_sv_list[svNumber - 1].c_n0_dbhz)); //float to int if (length < 0 || length >= lengthRemaining) { @@ -790,10 +904,6 @@ 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; - // 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. diff --git a/gps/loc_api/libloc_api_50001/loc_eng_xtra.cpp b/gps/loc_api/libloc_api_50001/loc_eng_xtra.cpp index 7bb8083..b5bf4e7 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_xtra.cpp +++ b/gps/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 <loc_eng.h> #include <MsgTask.h> -#include "log_util.h" -#include "platform_lib_includes.h" +#include <platform_lib_includes.h> using namespace loc_core; @@ -124,6 +123,13 @@ int loc_eng_xtra_init (loc_eng_data_s_type &loc_eng_data, loc_eng_xtra_data_s_type *xtra_module_data_ptr; ENTRY_LOG(); + if(!loc_eng_data.adapter->mSupportsTimeInjection + || loc_eng_data.adapter->hasNativeXtraClient()) { + LOC_LOGD("XTRA is already supported. disable it here.\n"); + EXIT_LOG(%d, 1); // return 1 denote failure + return 1; + } + if(callbacks == NULL) { LOC_LOGE("loc_eng_xtra_init: failed, cb is NULL"); } else { |