summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2011-11-21 22:59:44 -0800
committerSteve Kondik <shade@chemlab.org>2011-11-21 22:59:44 -0800
commit9f8ad0824da8c1e4a2095af88e8242313e13caaa (patch)
treec30a290dcfb154063d85e8d26970e81ed8ad7d7c
parent015f4e275bb9aca9daad79898224202d2c07b7a3 (diff)
parent13598000cefe59c5409a5bfb939cfd2c914a2d97 (diff)
downloadandroid_hardware_qcom_gps-cm-9.1.0.tar.gz
android_hardware_qcom_gps-cm-9.1.0.tar.bz2
android_hardware_qcom_gps-cm-9.1.0.zip
Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_hardware_qcom_gps into HEADics-releaseicscm-9.1.0
Conflicts: loc_api/libloc_api-rpc/Android.mk Change-Id: I168e74f56112358932560ce051cd341aa1b2d295
-rwxr-xr-xloc_api/libloc_api-rpc/Android.mk8
-rwxr-xr-xloc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c11
-rwxr-xr-xloc_api/libloc_api-rpc/gen-20000/Makefile.xdr38
-rwxr-xr-xloc_api/libloc_api-rpc/gen-20000/loc_api.xdr164
-rwxr-xr-xloc_api/libloc_api-rpc/gen-20000/loc_api_cb.xdr90
-rw-r--r--loc_api/libloc_api-rpc/gen-20000/loc_api_cb_svc.c64
-rw-r--r--loc_api/libloc_api-rpc/gen-20000/loc_api_cb_xdr.c32
-rw-r--r--loc_api/libloc_api-rpc/gen-20000/loc_api_clnt.c82
-rwxr-xr-xloc_api/libloc_api-rpc/gen-20000/loc_api_common.xdr812
-rw-r--r--loc_api/libloc_api-rpc/gen-20000/loc_api_common_xdr.c1458
-rwxr-xr-xloc_api/libloc_api-rpc/gen-20000/loc_api_fixup.c48
-rwxr-xr-xloc_api/libloc_api-rpc/gen-20000/loc_api_rpc_glue.c356
-rw-r--r--loc_api/libloc_api-rpc/gen-20000/loc_api_xdr.c171
-rwxr-xr-xloc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr9
-rw-r--r--loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c14
-rwxr-xr-xloc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c11
-rw-r--r--loc_api/libloc_api-rpc/gen-50000/loc_api.xdr181
-rw-r--r--loc_api/libloc_api-rpc/gen-50000/loc_api_cb.xdr107
-rwxr-xr-xloc_api/libloc_api-rpc/gen-50000/loc_api_cb_svc.c64
-rwxr-xr-xloc_api/libloc_api-rpc/gen-50000/loc_api_cb_xdr.c32
-rwxr-xr-xloc_api/libloc_api-rpc/gen-50000/loc_api_clnt.c91
-rw-r--r--loc_api/libloc_api-rpc/gen-50000/loc_api_common.xdr926
-rwxr-xr-xloc_api/libloc_api-rpc/gen-50000/loc_api_common_xdr.c1651
-rwxr-xr-xloc_api/libloc_api-rpc/gen-50000/loc_api_fixup.c52
-rw-r--r--loc_api/libloc_api-rpc/gen-50000/loc_api_rpc_glue.c512
-rw-r--r--loc_api/libloc_api-rpc/gen-50000/loc_api_sync_call.c518
-rwxr-xr-xloc_api/libloc_api-rpc/gen-50000/loc_api_xdr.c171
-rw-r--r--loc_api/libloc_api-rpc/inc-20000/loc_api.h198
-rw-r--r--loc_api/libloc_api-rpc/inc-20000/loc_api_cb.h64
-rw-r--r--loc_api/libloc_api-rpc/inc-20000/loc_api_common.h1043
-rwxr-xr-xloc_api/libloc_api-rpc/inc-20000/loc_api_fixup.h188
-rwxr-xr-xloc_api/libloc_api-rpc/inc-20000/loc_apicb_appinit.h34
-rw-r--r--loc_api/libloc_api-rpc/inc-3200/loc_api_common.h11
-rw-r--r--loc_api/libloc_api-rpc/inc-50000/debug.h69
-rwxr-xr-xloc_api/libloc_api-rpc/inc-50000/loc_api.h214
-rwxr-xr-xloc_api/libloc_api-rpc/inc-50000/loc_api_cb.h81
-rwxr-xr-xloc_api/libloc_api-rpc/inc-50000/loc_api_common.h1154
-rw-r--r--loc_api/libloc_api-rpc/inc-50000/loc_api_fixup.h209
-rw-r--r--loc_api/libloc_api-rpc/inc-50000/loc_api_rpc_glue.h99
-rw-r--r--loc_api/libloc_api-rpc/inc-50000/loc_api_sync_call.h105
-rw-r--r--loc_api/libloc_api-rpc/inc-50000/loc_apicb_appinit.h45
-rw-r--r--loc_api/libloc_api-rpc/inc/loc_api_sync_call.h106
-rw-r--r--loc_api/libloc_api-rpc/src/loc_api_sync_call.c532
-rw-r--r--[-rwxr-xr-x]loc_api/libloc_api/Android.mk20
-rwxr-xr-xloc_api/libloc_api/loc_eng.cpp2601
-rwxr-xr-xloc_api/libloc_api/loc_eng.h205
-rw-r--r--loc_api/libloc_api/loc_eng_cfg.cpp235
-rw-r--r--loc_api/libloc_api/loc_eng_cfg.h76
-rwxr-xr-xloc_api/libloc_api/loc_eng_ioctl.cpp357
-rwxr-xr-xloc_api/libloc_api/loc_eng_ioctl.h99
-rw-r--r--loc_api/libloc_api/loc_eng_log.cpp435
-rw-r--r--loc_api/libloc_api/loc_eng_log.h55
-rwxr-xr-xloc_api/libloc_api/loc_eng_ni.cpp920
-rwxr-xr-xloc_api/libloc_api/loc_eng_ni.h76
-rwxr-xr-xloc_api/libloc_api/loc_eng_xtra.cpp312
-rwxr-xr-xloc_api/libloc_api/loc_eng_xtra.h71
-rwxr-xr-xloc_api/libloc_api_goog/Android.mk48
-rw-r--r--loc_api/libloc_api_goog/gps.c66
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng.cpp1537
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng.h119
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng_ioctl.cpp358
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng_ioctl.h75
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng_ni.cpp609
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng_ni.h55
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng_xtra.cpp183
-rwxr-xr-xloc_api/libloc_api_goog/loc_eng_xtra.h49
66 files changed, 18422 insertions, 1964 deletions
diff --git a/loc_api/libloc_api-rpc/Android.mk b/loc_api/libloc_api-rpc/Android.mk
index 68ea79e..55949ae 100755
--- a/loc_api/libloc_api-rpc/Android.mk
+++ b/loc_api/libloc_api-rpc/Android.mk
@@ -22,7 +22,8 @@ generated_files:= \
gen-$(AMSS_VERSION)/loc_api_xdr.c \
gen-$(AMSS_VERSION)/loc_api_fixup.c \
gen-$(AMSS_VERSION)/loc_api_rpc_glue.c \
- src/loc_apicb_appinit.c
+ src/loc_apicb_appinit.c \
+ src/loc_api_sync_call.c
LOCAL_SRC_FILES:= $(generated_files)
@@ -49,7 +50,8 @@ LOCAL_COPY_HEADERS:= \
$(RPC_INC)/loc_api_fixup.h \
$(RPC_INC)/loc_apicb_appinit.h \
inc/debug.h \
- inc/loc_api_rpc_glue.h
+ inc/loc_api_rpc_glue.h \
+ inc/loc_api_sync_call.h
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH) \
@@ -59,7 +61,9 @@ LOCAL_C_INCLUDES:= \
$(TARGET_OUT_HEADERS)/librpc
LOCAL_MODULE:= libloc_api-rpc
+
LOCAL_MODULE_TAGS := optional
+
include $(BUILD_STATIC_LIBRARY)
endif
diff --git a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
index fbaca8b..e5029cf 100755
--- a/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
+++ b/loc_api/libloc_api-rpc/gen-1240/loc_api_rpc_glue.c
@@ -55,6 +55,7 @@ when who what, where, why
#include <rpc/rpc.h>
#include <rpc/clnt.h>
+#include "loc_api_sync_call.h"
/* Include RPC headers */
#include "loc_api_rpc_glue.h"
@@ -120,6 +121,9 @@ bool_t rpc_loc_event_cb_f_type_0x00040001_svc(
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_api_saved_cb(loc_handle, loc_event, loc_event_payload);
ret->loc_event_cb_f_type_result = rc;
@@ -171,6 +175,8 @@ int loc_api_glue_init(void)
}
/* Init RPC callbacks */
+ loc_api_sync_call_init();
+
int rc = loc_apicb_app_init();
if (rc >= 0)
{
@@ -218,6 +224,11 @@ int32 loc_close(rpc_loc_client_handle_type handle)
stat = RPC_FUNC_VERSION(rpc_loc_close_, /* LOC_APIVERS */ 0x00040001)(&args, &rets, loc_api_clnt);
LOC_GLUE_CHECK_RESULT(stat, int32);
+ if (loc_api_clnt != NULL)
+ clnt_destroy(loc_api_clnt);
+
+ loc_api_clnt = NULL;
+
return (int32) rets.loc_close_result;
}
diff --git a/loc_api/libloc_api-rpc/gen-20000/Makefile.xdr b/loc_api/libloc_api-rpc/gen-20000/Makefile.xdr
new file mode 100755
index 0000000..60f730c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/Makefile.xdr
@@ -0,0 +1,38 @@
+# Copyright (c) 2009, QUALCOMM USA, INC.
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+# · Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+# · Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+# · Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+CLIENTS:= loc_api
+SERVERS:= loc_api_cb
+COMMON:= loc_api_common
+RPC_INC:= inc-$(AMSS_VERSION)
+
+all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
+
+$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
+
+$(CLIENTS) $(SERVERS) $(COMMON)::
+ rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
+ rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
+
+$(CLIENTS)::
+ rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
+
+$(SERVERS)::
+ rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
+
+fixup:
+ mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
+ sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
+ rm -f ../$(RPC_INC)/loc_api_common.h.bak
+
+clean:
+ rm -f $(addsuffix _clnt.c, $(CLIENTS))
+ rm -f $(addsuffix _svc.c, $(SERVERS))
+ rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
+ rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api.xdr b/loc_api/libloc_api-rpc/gen-20000/loc_api.xdr
new file mode 100755
index 0000000..9fe623f
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api.xdr
@@ -0,0 +1,164 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ the loc_api API.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+typedef rpc_uint32 rpc_loc_api_api_versions_return_type<>;
+
+/*
+ * Declare an rpc_uint32 type for each callback type in the API
+ */
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+
+
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+
+/*
+ * These are struct declarations for the function results
+ */
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers; /* Tool version */
+ rpc_uint32 features; /* Features turned on in the code.
+ * 0x00000001 ONCRPC Server Cleanup Support
+ */
+ rpc_uint32 proghash; /* Unique hash value for the API XDR definition */
+ rpc_uint32 cbproghash; /* Unique hash value for the Callbacks' XDR definition */
+};
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+
+ struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+
+/*
+ * XDR definition of the LOC_API program ( vers. 0x00020001 )
+ */
+
+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;
+
+
+ } = 0x00020001;
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00020001;
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-20000/loc_api_cb.xdr
new file mode 100755
index 0000000..94d8152
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_cb.xdr
@@ -0,0 +1,90 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C B . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+/*
+ * These are struct declarations for the function arguments
+ */
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+
+
+
+
+
+/*
+ * These are struct declaratios for the function results
+ */
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+
+
+
+/*
+ * XDR definition of the LOC_API callback program ( vers. 0x00020001 )
+ */
+
+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;
+
+
+ } = 0x00020001;
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00020001;
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_cb_svc.c
new file mode 100644
index 0000000..56122b6
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_0x00020001(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_0x00020002_arg;
+ } argument;
+ union {
+ rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_0x00020002_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_0x00020002_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_0x00020001_freeresult (transp, _xdr_result, (caddr_t) &result))
+ fprintf (stderr, "%s", "unable to free results");
+
+ return;
+}
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_cb_xdr.c
new file mode 100644
index 0000000..1d7795e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_clnt.c
new file mode 100644
index 0000000..b33ce32
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_clnt.c
@@ -0,0 +1,82 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_0x00020002(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_0x00020002(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_0x00020002(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_0x00020002(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_0x00020002(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_0x00020002(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_0x00020002(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_0x00020002(void *argp, rpc_loc_api_api_versions_rets *clnt_res, CLIENT *clnt)
+{
+ return (clnt_call(clnt, rpc_loc_api_api_versions,
+ (xdrproc_t) xdr_void, (caddr_t) argp,
+ (xdrproc_t) xdr_rpc_loc_api_api_versions_rets, (caddr_t) clnt_res,
+ TIMEOUT));
+}
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-20000/loc_api_common.xdr
new file mode 100755
index 0000000..f83663e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_common.xdr
@@ -0,0 +1,812 @@
+/* LOC_API TOOL VERSION: 3.28 */
+/*=============================================================================
+ L O C _ A P I _ C O M M O N . X D R
+
+GENERAL DESCRIPTION
+ This is an AUTO GENERATED file that provides an xdr compatible definition of
+ an api that represents the grouping of the different callback functions the
+ loc_api API supports.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+/*=============================================================================
+
+ Edit History
+
+ AUTO GENERATED
+
+Generated by following versions of Htorpc modules:
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/htorpc.pl#9
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Start.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/XDR.pm#7
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Parser.pm#3
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/Metacomments.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/03.01/htorpc/lib/Htorpc/SymbolTable.pm#4
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_OPEN_VERSION = 0x00020001;
+const RPC_LOC_CLOSE_VERSION = 0x00020001;
+const RPC_LOC_START_FIX_VERSION = 0x00020001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00020001;
+const RPC_LOC_IOCTL_VERSION = 0x00020001;
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00020001;
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0001;
+typedef bool rpc_boolean;
+typedef unsigned long rpc_uint32;
+
+typedef unsigned short rpc_uint16;
+
+typedef unsigned char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef unsigned char rpc_byte;
+
+typedef unsigned hyper rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ unsigned char month;
+ unsigned char day_of_week;
+ unsigned char day;
+ unsigned char hour;
+ unsigned char minute;
+ unsigned char second;
+ rpc_uint16 millisecond;
+};
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456
+};
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ rpc_loc_sv_info_s_type sv_list<RPC_LOC_API_MAX_SV_COUNT>;
+};
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ opaque nmea_sentences<RPC_LOC_API_MAX_NMEA_STRING_LENGTH>;
+};
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456
+};
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456
+};
+
+union rpc_loc_status_event_payload_u_type switch (rpc_loc_status_event_e_type disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ rpc_loc_engine_state_e_type engine_state;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ default:
+ void;
+};
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200];
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string<RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ unsigned char maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address<RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS>;
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string<RPC_LOC_NI_CODEWORD_LENGTH>;
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text<RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH>;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<RPC_LOC_API_MAX_SERVER_ADDR_LENGTH>;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ string apn_name<>;
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
+const RPC_LOC_API_NULL_VERSION = 0x00020001;
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00020001;
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_common_xdr.c
new file mode 100644
index 0000000..be784f4
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_common_xdr.c
@@ -0,0 +1,1458 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, RPC_LOC_API_MAX_SV_COUNT,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->nmea_sentences.nmea_sentences_val, (u_int *) &objp->nmea_sentences.nmea_sentences_len, RPC_LOC_API_MAX_NMEA_STRING_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_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;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->addr.addr_val, (u_int *) &objp->addr.addr_len, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->requestor_id_string.requestor_id_string_val, (u_int *) &objp->requestor_id_string.requestor_id_string_len, RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->client_name_string.client_name_string_val, (u_int *) &objp->client_name_string.client_name_string_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->ext_client_address.ext_client_address_val, (u_int *) &objp->ext_client_address.ext_client_address_len, RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->lcs_codeword_string.lcs_codeword_string_val, (u_int *) &objp->lcs_codeword_string.lcs_codeword_string_len, RPC_LOC_NI_CODEWORD_LENGTH))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->notification_text.notification_text_val, (u_int *) &objp->notification_text.notification_text_len, RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, RPC_LOC_API_MAX_SERVER_ADDR_LENGTH))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->apn_name, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_fixup.c
new file mode 100755
index 0000000..fe512f5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_fixup.c
@@ -0,0 +1,48 @@
+/*=============================================================================
+ L O C _ A P I _ F I X U P . C
+
+GENERAL DESCRIPTION
+ This file adds API constants that are not automatically transmitted to
+ the RPC stubs, and it also fixes other RPC-related problems.
+
+ ---------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ ---------------------------------------------------------------------------
+=============================================================================*/
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_rpc_glue.c
new file mode 100755
index 0000000..857a6cd
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_rpc_glue.c
@@ -0,0 +1,356 @@
+/******************************************************************************
+ @file loc_api_rpc_glue.c
+ @brief Android Loc API glue code using rpcgen.
+
+ DESCRIPTION
+ Loc API glue code for Android
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+03/05/2009 dx Initial version
+
+======================================================================*/
+/*=====================================================================
+
+ INCLUDE FILES FOR MODULE
+
+======================================================================*/
+//#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <pthread.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include <rpc/rpc.h>
+#include <rpc/clnt.h>
+#include "loc_api_sync_call.h"
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "lib_api_rpc_glue"
+#include <utils/Log.h>
+
+/* Comment this out to enable logging */
+#undef LOGD
+#define LOGD(...) {}
+
+/*=====================================================================
+ External declarations
+======================================================================*/
+
+CLIENT* loc_api_clnt = NULL;
+
+/* Callback ID and pointer */
+#define LOC_API_CB_ID 1
+loc_event_cb_f_type *loc_api_saved_cb = NULL; /* the only callback of Loc API client */
+
+#define RPC_FUNC_VERSION_BASE(a,b) a ## b
+#define RPC_FUNC_VERSION(a,b) RPC_FUNC_VERSION_BASE(a,b)
+
+#define LOC_GLUE_CHECK_INIT(ret_type) \
+ if (loc_api_clnt == NULL) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_0x00020002_svc(
+ rpc_loc_event_cb_f_type_args *argp,
+ rpc_loc_event_cb_f_type_rets *ret,
+ struct svc_req *req)
+{
+ /* Callback not registered, or unexpected ID (shouldn't happen) */
+ if (loc_api_saved_cb == NULL || argp->cb_id != LOC_API_CB_ID)
+ {
+ LOGD("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGD("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGD("Callback received: %x (handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) argp->loc_handle,
+ (int) ret);
+
+ /* Forward callback to real callback procedure */
+ rpc_loc_client_handle_type loc_handle = argp->loc_handle;
+ rpc_loc_event_mask_type loc_event = argp->loc_event;
+ const rpc_loc_event_payload_u_type* loc_event_payload =
+ (const rpc_loc_event_payload_u_type*) argp->loc_event_payload;
+
+ /* Gives control to synchronous call handler */
+ loc_api_callback_process_sync_call(loc_handle, loc_event, loc_event_payload);
+
+ int32 rc = loc_api_saved_cb(loc_handle, loc_event, loc_event_payload);
+ ret->loc_event_cb_f_type_result = rc;
+
+ return 1; /* ok */
+}
+
+int loc_apicbprog_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ xdr_free (xdr_result, result);
+
+ /*
+ * Insert additional freeing code here, if needed
+ */
+ // LOGD("***** loc_apicbprog_freeresult\n");
+
+ return 1;
+}
+
+int loc_apicbprog_0x00020001_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
+{
+ return loc_apicbprog_freeresult (transp, xdr_result, result);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_glue_init
+
+DESCRIPTION
+ Initiates the RPC client
+
+RETURN VALUE
+ 1 for success
+ 0 for failure
+
+===========================================================================*/
+int loc_api_glue_init(void)
+{
+ if (loc_api_clnt == NULL)
+ {
+ /* Print msg */
+ LOGD("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, /*LOC_APIVERS*/ 0x00020002, NULL);
+ LOGD("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ fprintf(stderr, "Error: cannot create RPC client.\n");
+ return 0;
+ }
+
+ /* Init RPC callbacks */
+ loc_api_sync_call_init();
+
+ int rc = loc_apicb_app_init();
+ if (rc >= 0)
+ {
+ LOGD("Loc API callback initialized.\n");
+ } else {
+ fprintf(stderr, "Loc API callback initialization failed.\n");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+rpc_loc_client_handle_type loc_open (
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+ )
+{
+ LOC_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+ args.event_callback = LOC_API_CB_ID;
+ loc_api_saved_cb = event_callback;
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ if (loc_api_clnt != NULL)
+ clnt_destroy(loc_api_clnt);
+
+ loc_api_clnt = NULL;
+
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix(rpc_loc_client_handle_type handle)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+ )
+{
+ LOGD("ioctl start");
+ LOC_GLUE_CHECK_INIT(int32);
+
+ LOGD("ioctl checked");
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ LOGD("ioctl has data");
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ case RPC_LOC_IOCTL_INJECT_RTC_VALUE:
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ case RPC_LOC_IOCTL_QUERY_ENGINE_STATE:
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_info.disc =
+ args.ioctl_data->rpc_loc_ioctl_data_u_type_u.server_addr.addr_type;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ default:
+ break;
+ } /* switch */
+ } /* ioctl_data != NULL */
+
+ rpc_loc_ioctl_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ LOGD("ioctl is set");
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
+ LOGD("ioctl is called");
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ LOGD("ioctl checked glue");
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, LOC_APIVERS)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/loc_api/libloc_api-rpc/gen-20000/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-20000/loc_api_xdr.c
new file mode 100644
index 0000000..835f6b1
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-20000/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
index 7ef6357..a1cd75e 100755
--- a/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_common.xdr
@@ -195,6 +195,7 @@ struct 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
};
@@ -204,9 +205,17 @@ enum rpc_loc_engine_state_e_type {
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;
};
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
index 7b37b9c..e4cb4b4 100644
--- a/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_common_xdr.c
@@ -329,6 +329,16 @@ xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
}
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;
@@ -340,6 +350,10 @@ xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload
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;
}
diff --git a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
index 8c17122..ac137da 100755
--- a/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
+++ b/loc_api/libloc_api-rpc/gen-3200/loc_api_rpc_glue.c
@@ -55,6 +55,7 @@ when who what, where, why
#include <rpc/rpc.h>
#include <rpc/clnt.h>
+#include "loc_api_sync_call.h"
/* Include RPC headers */
#include "loc_api_rpc_glue.h"
@@ -120,6 +121,9 @@ bool_t rpc_loc_event_cb_f_type_0x00010001_svc(
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_api_saved_cb(loc_handle, loc_event, loc_event_payload);
ret->loc_event_cb_f_type_result = rc;
@@ -171,6 +175,8 @@ int loc_api_glue_init(void)
}
/* Init RPC callbacks */
+ loc_api_sync_call_init();
+
int rc = loc_apicb_app_init();
if (rc >= 0)
{
@@ -218,6 +224,11 @@ int32 loc_close(rpc_loc_client_handle_type handle)
stat = RPC_FUNC_VERSION(rpc_loc_close_, LOC_APIVERS)(&args, &rets, loc_api_clnt);
LOC_GLUE_CHECK_RESULT(stat, int32);
+ if (loc_api_clnt != NULL)
+ clnt_destroy(loc_api_clnt);
+
+ loc_api_clnt = NULL;
+
return (int32) rets.loc_close_result;
}
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api.xdr b/loc_api/libloc_api-rpc/gen-50000/loc_api.xdr
new file mode 100644
index 0000000..377448e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api.xdr
@@ -0,0 +1,181 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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.34 */
+/*=============================================================================
+ 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/04.01/htorpc/htorpc.pl#18
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#2
+
+loc_api Definition File(s):
+
+=============================================================================*/
+/*=============================================================================
+$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. 0x00050001 )
+ */
+
+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;
+} = 0x3000008c;
+
+const LOC_APIVERS = 0x00050001;
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_cb.xdr b/loc_api/libloc_api-rpc/gen-50000/loc_api_cb.xdr
new file mode 100644
index 0000000..be6d140
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_cb.xdr
@@ -0,0 +1,107 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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.34 */
+/*=============================================================================
+ 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/04.01/htorpc/htorpc.pl#18
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#2
+
+loc_api Definition File(s):
+
+=============================================================================*/
+/*=============================================================================
+$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. 0x00050001 )
+ */
+
+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;
+} = 0x3100008c;
+
+const LOC_APICBVERS = 0x00050001;
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_cb_svc.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_cb_svc.c
new file mode 100755
index 0000000..5a95101
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_cb_svc.c
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+void
+loc_apicbprog_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;
+}
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_cb_xdr.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_cb_xdr.c
new file mode 100755
index 0000000..1d7795e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_cb_xdr.c
@@ -0,0 +1,32 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_cb.h"
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_args (XDR *xdrs, rpc_loc_event_cb_f_type_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->cb_id))
+ return FALSE;
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->loc_event))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->loc_event_payload, sizeof (rpc_loc_event_payload_u_type), (xdrproc_t) xdr_rpc_loc_event_payload_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type_rets (XDR *xdrs, rpc_loc_event_cb_f_type_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_event_cb_f_type_result))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_clnt.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_clnt.c
new file mode 100755
index 0000000..486d13a
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_clnt.c
@@ -0,0 +1,91 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "loc_api.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+enum clnt_stat
+rpc_loc_api_null_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));
+}
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_common.xdr b/loc_api/libloc_api-rpc/gen-50000/loc_api_common.xdr
new file mode 100644
index 0000000..0b4e9ba
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_common.xdr
@@ -0,0 +1,926 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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.34 */
+/*=============================================================================
+ 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/04.01/htorpc/htorpc.pl#18
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Start.pm#2
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Htoxdr.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/XDR.pm#6
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Output.pm#26
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Parser.pm#1
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/Metacomments.pm#4
+Id: //source/qcom/qct/core/mproc/tools/rel/04.01/htorpc/lib/Htorpc/SymbolTable.pm#2
+
+loc_api Definition File(s):
+
+=============================================================================*/
+/*=============================================================================
+$Header$
+=============================================================================*/
+
+
+
+const LOC_API_TOOLVERS = 0x00040022;
+const LOC_API_FEATURES = 0x00000001;
+
+const RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST = 0x00000010;
+
+const RPC_LOC_EVENT_NMEA_1HZ_REPORT = 0x00000004;
+
+const RPC_LOC_EVENT_WPS_NEEDED_REQUEST = 0x00000200;
+
+const RPC_LOC_EVENT_IOCTL_REPORT = 0x00000080;
+
+const RPC_LOC_EVENT_LOCATION_SERVER_REQUEST = 0x00000040;
+
+const RPC_LOC_EVENT_RESERVED = 0x8000000000000000;
+
+const RPC_LOC_EVENT_PARSED_POSITION_REPORT = 0x00000001;
+
+const RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST = 0x00000020;
+
+const RPC_LOC_EVENT_NMEA_POSITION_REPORT = 0x00000008;
+
+const RPC_LOC_EVENT_SATELLITE_REPORT = 0x00000002;
+
+const RPC_LOC_EVENT_STATUS_REPORT = 0x00000100;
+
+const RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION = 0x00050001;
+const RPC_LOC_API_NULL_VERSION = 0x00050001;
+const RPC_LOC_OPEN_VERSION = 0x00050001;
+const RPC_LOC_CLOSE_VERSION = 0x00050001;
+const RPC_LOC_START_FIX_VERSION = 0x00050001;
+const RPC_LOC_STOP_FIX_VERSION = 0x00050001;
+const RPC_LOC_IOCTL_VERSION = 0x00050001;
+
+const RPC_LOC_EVENT_CB_F_TYPE_VERSION = 0x00050001;
+
+const RPC_LOC_APIAPI_VERSION_IS_HASHKEY = 0;
+const RPC_LOC_API_API_MAJOR_NUM = 0x0005;
+
+
+
+
+
+
+
+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]; /* EVAL:[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_MAX = 268435456
+};
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ opaque addr[256]; /* EVAL:[256]*/
+};
+
+union rpc_loc_server_addr_u_type switch (rpc_loc_server_addr_e_type disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ rpc_loc_server_addr_ipv4_type ipv4;
+ case RPC_LOC_SERVER_ADDR_URL:
+ rpc_loc_server_addr_url_type url;
+ default:
+ void;
+};
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456
+};
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647
+};
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ unsigned char requester_id_length;
+ opaque requester_id[200]; /* EVAL:[200]*/
+};
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char pos_qos_incl;
+ unsigned char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456
+};
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ unsigned char presence;
+ opaque session_id[4]; /* EVAL:[4]*/
+ rpc_loc_server_info_s_type slp_address;
+};
+
+struct rpc_loc_ni_requestor_id_s_type {
+ unsigned char data_coding_scheme;
+ opaque requestor_id_string[200]; /* EVAL:[200]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ unsigned char data_coding_scheme;
+ opaque client_name_string[64]; /* EVAL:[64]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_supl_qop_s_type {
+ unsigned char bit_mask;
+ unsigned char horacc;
+ unsigned char veracc;
+ rpc_uint16 maxLocAge;
+ unsigned char delay;
+};
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ opaque supl_hash[8]; /* EVAL:[8]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ unsigned char ext_client_address_len;
+ opaque ext_client_address[20]; /* EVAL:[20]*/
+};
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456
+};
+
+struct rpc_loc_ni_deferred_location_s_type {
+ unsigned char unused_bits;
+ unsigned char ms_available;
+};
+
+struct rpc_loc_ni_codeword_string_s_type {
+ unsigned char data_coding_scheme;
+ opaque lcs_codeword_string[20]; /* EVAL:[20]*/
+ unsigned char string_len;
+};
+
+struct rpc_loc_ni_service_type_id_s_type {
+ unsigned char lcs_service_type_id;
+};
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ unsigned char invoke_id;
+ rpc_uint16 flags;
+ unsigned char notification_length;
+ opaque notification_text[64]; /* EVAL:[64]*/
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456
+};
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+
+union rpc_loc_ni_event_payload_u_type switch (rpc_loc_ni_event_e_type disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ default:
+ void;
+};
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456
+};
+
+ typedef string rpc_struct_loc_time_download_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+
+ typedef string rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr<256>; /* EVAL:[LOC_API_MAX_SERVER_ADDR_LENGTH]*/
+
+ typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3]; /* EVAL:[3]*/
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+
+union rpc_loc_assist_data_request_payload_u_type switch (rpc_loc_assist_data_request_e_type disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ rpc_loc_time_download_source_s_type time_download;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ default:
+ void;
+};
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216
+};
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+
+union rpc_loc_server_request_u_type switch (rpc_loc_server_request_e_type disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ rpc_loc_server_open_req_s_type open_req;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ rpc_loc_server_close_req_s_type close_req;
+ default:
+ void;
+};
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES,
+ RPC_LOC_QWIP_SUSPEND,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456
+};
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ opaque data<>;
+};
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824
+};
+
+struct rpc_loc_api_version_s_type {
+ unsigned char major;
+ unsigned char minor;
+};
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456
+};
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456
+};
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456
+};
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456
+};
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456
+};
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ opaque data_ptr<>;
+};
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ unsigned char auto_check_every_hrs;
+};
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ unsigned char confidence_horizontal;
+ unsigned char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ opaque apn_name[100]; /* EVAL:[100]*/
+};
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456
+};
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+
+struct rpc_loc_wiper_ap_info_s_type {
+ opaque mac_addr[6]; /* EVAL:[6]*/
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50]; /* EVAL:[50]*/
+};
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456
+};
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456
+};
+
+struct rpc_loc_efs_data_s_type {
+ opaque filename[64]; /* EVAL:[64]*/
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ opaque data_ptr<>;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456
+};
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8]; /* EVAL:[8]*/
+};
+
+union rpc_loc_ioctl_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ rpc_loc_user_verify_s_type user_verify_resp;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ rpc_loc_server_open_status_s_type conn_open_status;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ rpc_loc_server_close_status_s_type conn_close_status;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ rpc_loc_wiper_status_e_type wiper_status;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ rpc_loc_efs_data_s_type efs_data;
+ default:
+ void;
+};
+
+union rpc_loc_ioctl_callback_data_u_type switch (rpc_loc_ioctl_e_type disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ rpc_loc_api_version_s_type api_version;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ rpc_loc_lock_e_type engine_lock;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ rpc_boolean sbas_mode;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ rpc_loc_nmea_sentence_type nmea_types;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ rpc_boolean on_demand_lpm;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ rpc_loc_server_info_s_type server_addr;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ default:
+ void;
+};
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+
+union rpc_loc_event_payload_u_type switch (unsigned hyper disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ rpc_loc_gnss_info_s_type gnss_report;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ rpc_loc_nmea_report_s_type nmea_report;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ rpc_loc_ni_event_s_type ni_request;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ rpc_loc_server_request_s_type loc_server_request;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ rpc_loc_status_event_s_type status_report;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ rpc_loc_qwip_request_s_type qwip_request;
+ case RPC_LOC_EVENT_RESERVED:
+ rpc_loc_reserved_payload_s_type reserved;
+ default:
+ void;
+};
+
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_common_xdr.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_common_xdr.c
new file mode 100755
index 0000000..920432a
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_common_xdr.c
@@ -0,0 +1,1651 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api_common.h"
+
+bool_t
+xdr_rpc_boolean (XDR *xdrs, rpc_boolean *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_bool (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint32 (XDR *xdrs, rpc_uint32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint16 (XDR *xdrs, rpc_uint16 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_short (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint8 (XDR *xdrs, rpc_uint8 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_int32 (XDR *xdrs, rpc_int32 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_long (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_byte (XDR *xdrs, rpc_byte *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_uint64 (XDR *xdrs, rpc_uint64 *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_client_handle_type (XDR *xdrs, rpc_loc_client_handle_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_mask_type (XDR *xdrs, rpc_loc_event_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_position_valid_mask_type (XDR *xdrs, rpc_loc_position_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_pos_technology_mask_type (XDR *xdrs, rpc_loc_pos_technology_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_session_status_e_type (XDR *xdrs, rpc_loc_session_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_calendar_time_s_type (XDR *xdrs, rpc_loc_calendar_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->year))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->month))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day_of_week))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->day))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->hour))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minute))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->second))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->millisecond))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_parsed_position_s_type (XDR *xdrs, rpc_loc_parsed_position_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_position_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_session_status_e_type (xdrs, &objp->session_status))
+ return FALSE;
+ if (!xdr_rpc_loc_calendar_time_s_type (xdrs, &objp->timestamp_calendar))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->leap_seconds))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->time_unc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_horizontal))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_major))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_semi_minor))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_ellipse_orient_azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->speed_unc))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->heading_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->magnetic_deviation))
+ return FALSE;
+ if (!xdr_rpc_loc_pos_technology_mask_type (xdrs, &objp->technology_mask))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_system_e_type (XDR *xdrs, rpc_loc_sv_system_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_status_e_type (XDR *xdrs, rpc_loc_sv_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_valid_mask_type (XDR *xdrs, rpc_loc_sv_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_sv_info_s_type (XDR *xdrs, rpc_loc_sv_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_sv_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_system_e_type (xdrs, &objp->system))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->prn))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->health_status))
+ return FALSE;
+ if (!xdr_rpc_loc_sv_status_e_type (xdrs, &objp->process_status))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_eph))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->has_alm))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->elevation))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->azimuth))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->snr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_valid_mask_type (XDR *xdrs, rpc_loc_gnss_info_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_gnss_info_s_type (XDR *xdrs, rpc_loc_gnss_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_gnss_info_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->position_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->horizontal_dop))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vertical_dop))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->altitude_assumed))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->sv_count))
+ return FALSE;
+ if (!xdr_array (xdrs, (char **)&objp->sv_list.sv_list_val, (u_int *) &objp->sv_list.sv_list_len, 80,
+ sizeof (rpc_loc_sv_info_s_type), (xdrproc_t) xdr_rpc_loc_sv_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_report_s_type (XDR *xdrs, rpc_loc_nmea_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->nmea_sentences, 1200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_e_type (XDR *xdrs, rpc_loc_status_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_engine_state_e_type (XDR *xdrs, rpc_loc_engine_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_session_state_e_type (XDR *xdrs, rpc_loc_fix_session_state_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_payload_u_type (XDR *xdrs, rpc_loc_status_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_STATUS_EVENT_ENGINE_STATE:
+ if (!xdr_rpc_loc_engine_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.engine_state))
+ return FALSE;
+ break;
+ case RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE:
+ if (!xdr_rpc_loc_fix_session_state_e_type (xdrs, &objp->rpc_loc_status_event_payload_u_type_u.fix_session_state))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_status_event_s_type (XDR *xdrs, rpc_loc_status_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_status_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_status_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_e_type (XDR *xdrs, rpc_loc_server_addr_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_ipv4_type (XDR *xdrs, rpc_loc_server_addr_ipv4_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->addr))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->port))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_url_type (XDR *xdrs, rpc_loc_server_addr_url_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint16 (xdrs, &objp->length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->addr, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_addr_u_type (XDR *xdrs, rpc_loc_server_addr_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_ADDR_IPV4:
+ if (!xdr_rpc_loc_server_addr_ipv4_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.ipv4))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_ADDR_URL:
+ if (!xdr_rpc_loc_server_addr_url_type (xdrs, &objp->rpc_loc_server_addr_u_type_u.url))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_info_s_type (XDR *xdrs, rpc_loc_server_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_addr_e_type (xdrs, &objp->addr_type))
+ return FALSE;
+ if (!xdr_rpc_loc_server_addr_u_type (xdrs, &objp->addr_info))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_notify_verify_e_type (XDR *xdrs, rpc_loc_ni_notify_verify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_e_type (XDR *xdrs, rpc_loc_ni_event_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_datacoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *xdrs, rpc_loc_ni_vx_pos_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *xdrs, rpc_loc_ni_vx_requester_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->requester_id_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requester_id, 200))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_vx_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos_incl))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->pos_qos))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->num_fixes))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->tbf))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_pos_mode_e_type (xdrs, &objp->pos_mode))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (xdrs, &objp->encoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_vx_requester_id_s_type (xdrs, &objp->requester_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_resp_timer_val))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *xdrs, rpc_loc_ni_supl_pos_method_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *xdrs, rpc_loc_ni_supl_slp_session_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->presence))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->session_id, 4))
+ return FALSE;
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->slp_address))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_requestor_id_s_type (XDR *xdrs, rpc_loc_ni_requestor_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->requestor_id_string, 200))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_client_name_s_type (XDR *xdrs, rpc_loc_ni_supl_client_name_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->client_name_string, 64))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_qop_s_type (XDR *xdrs, rpc_loc_ni_supl_qop_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->bit_mask))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->horacc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->veracc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->maxLocAge))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->delay))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_supl_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_slp_session_id_s_type (xdrs, &objp->supl_slp_session_id))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->supl_hash, 8))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_pos_method_e_type (xdrs, &objp->pos_method))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_client_name_s_type (xdrs, &objp->client_name))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_supl_qop_s_type (xdrs, &objp->supl_qop))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_ext_client_address_s_type (XDR *xdrs, rpc_loc_ni_ext_client_address_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->ext_client_address_len))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->ext_client_address, 20))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_location_type_e_type (XDR *xdrs, rpc_loc_ni_location_type_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_deferred_location_s_type (XDR *xdrs, rpc_loc_ni_deferred_location_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->unused_bits))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->ms_available))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_codeword_string_s_type (XDR *xdrs, rpc_loc_ni_codeword_string_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_u_char (xdrs, &objp->data_coding_scheme))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->lcs_codeword_string, 20))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->string_len))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_type_id_s_type (XDR *xdrs, rpc_loc_ni_service_type_id_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->lcs_service_type_id))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *xdrs, rpc_loc_ni_umts_cp_notify_verify_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_ni_notify_verify_e_type (xdrs, &objp->notification_priv_type))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->invoke_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->flags))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->notification_length))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->notification_text, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_datacoding_scheme_e_type (xdrs, &objp->datacoding_scheme))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_ext_client_address_s_type (xdrs, &objp->ext_client_address_data))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_location_type_e_type (xdrs, &objp->location_type))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_deferred_location_s_type (xdrs, &objp->deferred_location))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_requestor_id_s_type (xdrs, &objp->requestor_id))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_codeword_string_s_type (xdrs, &objp->codeword_string))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_type_id_s_type (xdrs, &objp->service_type_id))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->user_response_timer))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_service_interaction_e_type (XDR *xdrs, rpc_loc_ni_service_interaction_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *xdrs, rpc_loc_ni_vx_service_interaction_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->ni_vx_req))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_service_interaction_e_type (xdrs, &objp->service_interation_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_payload_u_type (XDR *xdrs, rpc_loc_ni_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_vx_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.vx_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_supl_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.supl_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ if (!xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.umts_cp_req))
+ return FALSE;
+ break;
+ case RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ:
+ if (!xdr_rpc_loc_ni_vx_service_interaction_req_s_type (xdrs, &objp->rpc_loc_ni_event_payload_u_type_u.service_interaction_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_event_s_type (XDR *xdrs, rpc_loc_ni_event_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_event_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_e_type (XDR *xdrs, rpc_loc_assist_data_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *xdrs, rpc_struct_loc_time_download_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_time_download_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_time_download_source_s_type (XDR *xdrs, rpc_loc_time_download_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->delay_threshold))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_time_download_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_string (xdrs, objp, 256))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *xdrs, rpc_struct_loc_predicted_orbits_data_source_s_type_servers objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_vector (xdrs, (char *)objp, 3,
+ sizeof (rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr), (xdrproc_t) xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_source_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_file_size))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->max_part_size))
+ return FALSE;
+ if (!xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (xdrs, objp->servers))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_payload_u_type (XDR *xdrs, rpc_loc_assist_data_request_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_ASSIST_DATA_TIME_REQ:
+ if (!xdr_rpc_loc_time_download_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.time_download))
+ return FALSE;
+ break;
+ case RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_assist_data_request_payload_u_type_u.data_download))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_request_s_type (XDR *xdrs, rpc_loc_assist_data_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_data_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_assist_data_request_payload_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_connection_handle (XDR *xdrs, rpc_loc_server_connection_handle *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_protocol_e_type (XDR *xdrs, rpc_loc_server_protocol_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_e_type (XDR *xdrs, rpc_loc_server_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_req_s_type (XDR *xdrs, rpc_loc_server_open_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_protocol_e_type (xdrs, &objp->protocol))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_req_s_type (XDR *xdrs, rpc_loc_server_close_req_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_u_type (XDR *xdrs, rpc_loc_server_request_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_SERVER_REQUEST_OPEN:
+ if (!xdr_rpc_loc_server_open_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.open_req))
+ return FALSE;
+ break;
+ case RPC_LOC_SERVER_REQUEST_CLOSE:
+ if (!xdr_rpc_loc_server_close_req_s_type (xdrs, &objp->rpc_loc_server_request_u_type_u.close_req))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_request_s_type (XDR *xdrs, rpc_loc_server_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_request_e_type (xdrs, &objp->event))
+ return FALSE;
+ if (!xdr_rpc_loc_server_request_u_type (xdrs, &objp->payload))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_e_type (XDR *xdrs, rpc_loc_qwip_request_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_qwip_request_s_type (XDR *xdrs, rpc_loc_qwip_request_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_qwip_request_e_type (xdrs, &objp->request_type))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->tbf_ms))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_reserved_payload_s_type (XDR *xdrs, rpc_loc_reserved_payload_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint16 (xdrs, &objp->data_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_e_type (XDR *xdrs, rpc_loc_ioctl_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_version_s_type (XDR *xdrs, rpc_loc_api_version_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_char (xdrs, &objp->major))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->minor))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_recurrence_e_type (XDR *xdrs, rpc_loc_fix_recurrence_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_operation_mode_e_type (XDR *xdrs, rpc_loc_operation_mode_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_notify_e_type (XDR *xdrs, rpc_loc_notify_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fix_criteria_s_type (XDR *xdrs, rpc_loc_fix_criteria_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_fix_recurrence_e_type (xdrs, &objp->recurrence_type))
+ return FALSE;
+ if (!xdr_rpc_loc_operation_mode_e_type (xdrs, &objp->preferred_operation_mode))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_accuracy))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->preferred_response_time))
+ return FALSE;
+ if (!xdr_rpc_boolean (xdrs, &objp->intermediate_pos_report_enabled))
+ return FALSE;
+ if (!xdr_rpc_loc_notify_e_type (xdrs, &objp->notify_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_interval))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->min_distance))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->min_dist_sample_interval))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ni_user_resp_e_type (XDR *xdrs, rpc_loc_ni_user_resp_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_user_verify_s_type (XDR *xdrs, rpc_loc_user_verify_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ni_user_resp_e_type (xdrs, &objp->user_resp))
+ return FALSE;
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->ni_event_pass_back))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *xdrs, rpc_loc_predicted_orbits_data_format_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_predicted_orbits_data_format_e_type (xdrs, &objp->format_type))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *xdrs, rpc_loc_predicted_orbits_data_validity_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->start_time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->valid_duration_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *xdrs, rpc_loc_predicted_orbits_auto_download_config_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->enable))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->auto_check_every_hrs))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_time_s_type (XDR *xdrs, rpc_loc_assist_data_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, &objp->time_utc))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->uncertainty))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_pos_valid_mask_type (XDR *xdrs, rpc_loc_assist_pos_valid_mask_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint64 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_pos_s_type (XDR *xdrs, rpc_loc_assist_data_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_assist_pos_valid_mask_type (xdrs, &objp->valid_mask))
+ return FALSE;
+ if (!xdr_rpc_uint64 (xdrs, &objp->timestamp_utc))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->latitude))
+ return FALSE;
+ if (!xdr_double (xdrs, &objp->longitude))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_ellipsoid))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->altitude_wrt_mean_sea_level))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->hor_unc_circular))
+ return FALSE;
+ if (!xdr_float (xdrs, &objp->vert_unc))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_horizontal))
+ return FALSE;
+ if (!xdr_u_char (xdrs, &objp->confidence_vertical))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->timestamp_age))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_e_type (XDR *xdrs, rpc_loc_server_open_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_open_status_s_type (XDR *xdrs, rpc_loc_server_open_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_open_status_e_type (xdrs, &objp->open_status))
+ return FALSE;
+ if (!xdr_opaque (xdrs, objp->apn_name, 100))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_e_type (XDR *xdrs, rpc_loc_server_close_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_server_close_status_s_type (XDR *xdrs, rpc_loc_server_close_status_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_server_connection_handle (xdrs, &objp->conn_handle))
+ return FALSE;
+ if (!xdr_rpc_loc_server_close_status_e_type (xdrs, &objp->close_status))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_time_s_type (XDR *xdrs, rpc_loc_wiper_fix_time_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->slow_clock_count))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_fix_pos_s_type (XDR *xdrs, rpc_loc_wiper_fix_pos_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->lat))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->lon))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->HEPE))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps_used))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->fix_error_code))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_info_s_type (XDR *xdrs, rpc_loc_wiper_ap_info_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->mac_addr, 6))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->rssi))
+ return FALSE;
+ if (!xdr_rpc_uint16 (xdrs, &objp->channel))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->ap_qualifier))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_ap_set_s_type (XDR *xdrs, rpc_loc_wiper_ap_set_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_uint8 (xdrs, &objp->num_of_aps))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->ap_info, 50,
+ sizeof (rpc_loc_wiper_ap_info_s_type), (xdrproc_t) xdr_rpc_loc_wiper_ap_info_s_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_position_report_s_type (XDR *xdrs, rpc_loc_wiper_position_report_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint8 (xdrs, &objp->wiper_valid_info_flag))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_time_s_type (xdrs, &objp->wiper_fix_time))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_fix_pos_s_type (xdrs, &objp->wiper_fix_position))
+ return FALSE;
+ if (!xdr_rpc_loc_wiper_ap_set_s_type (xdrs, &objp->wiper_ap_set))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_wiper_status_e_type (XDR *xdrs, rpc_loc_wiper_status_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_fs_operation_e_type (XDR *xdrs, rpc_loc_fs_operation_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_efs_data_s_type (XDR *xdrs, rpc_loc_efs_data_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_opaque (xdrs, objp->filename, 64))
+ return FALSE;
+ if (!xdr_rpc_loc_fs_operation_e_type (xdrs, &objp->operation))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->total_size))
+ return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->data_ptr.data_ptr_val, (u_int *) &objp->data_ptr.data_ptr_len, ~0))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->part_len))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->part))
+ return FALSE;
+ if (!xdr_rpc_uint8 (xdrs, &objp->total_parts))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->reserved))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_lock_e_type (XDR *xdrs, rpc_loc_lock_e_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_enum (xdrs, (enum_t *) objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_nmea_sentence_type (XDR *xdrs, rpc_loc_nmea_sentence_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_type (XDR *xdrs, rpc_loc_assist_data_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_assist_data_delete_s_type (XDR *xdrs, rpc_loc_assist_data_delete_s_type *objp)
+{
+ register int32_t *buf;
+
+ int i;
+ if (!xdr_rpc_loc_assist_data_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->reserved, 8,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_data_u_type (XDR *xdrs, rpc_loc_ioctl_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_SET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE:
+ if (!xdr_rpc_loc_user_verify_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.user_verify_resp))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA:
+ if (!xdr_rpc_loc_predicted_orbits_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_data))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD:
+ if (!xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.predicted_orbits_auto_download))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_UTC_TIME:
+ if (!xdr_rpc_loc_assist_data_time_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_time))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INJECT_POSITION:
+ if (!xdr_rpc_loc_assist_data_pos_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assistance_data_position))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS:
+ if (!xdr_rpc_loc_server_open_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_open_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS:
+ if (!xdr_rpc_loc_server_close_status_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.conn_close_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT:
+ case RPC_LOC_EVENT_NMEA_1HZ_REPORT:
+ if (!xdr_rpc_loc_wiper_position_report_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_pos))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS:
+ if (!xdr_rpc_loc_wiper_status_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.wiper_status))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_DELETE_ASSIST_DATA:
+ if (!xdr_rpc_loc_assist_data_delete_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.assist_data_delete))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_ACCESS_EFS_DATA:
+ if (!xdr_rpc_loc_efs_data_s_type (xdrs, &objp->rpc_loc_ioctl_data_u_type_u.efs_data))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_data_u_type (XDR *xdrs, rpc_loc_ioctl_callback_data_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ if (!xdr_rpc_loc_api_version_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.api_version))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_FIX_CRITERIA:
+ if (!xdr_rpc_loc_fix_criteria_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.fix_criteria))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ENGINE_LOCK:
+ if (!xdr_rpc_loc_lock_e_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.engine_lock))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_SBAS_CONFIG:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.sbas_mode))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_NMEA_TYPES:
+ if (!xdr_rpc_loc_nmea_sentence_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.nmea_types))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_ON_DEMAND_LPM:
+ if (!xdr_rpc_boolean (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.on_demand_lpm))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR:
+ case RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR:
+ if (!xdr_rpc_loc_server_info_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.server_addr))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE:
+ if (!xdr_rpc_loc_predicted_orbits_data_source_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_source))
+ return FALSE;
+ break;
+ case RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY:
+ if (!xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (xdrs, &objp->rpc_loc_ioctl_callback_data_u_type_u.predicted_orbits_data_validity))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_callback_s_type (XDR *xdrs, rpc_loc_ioctl_callback_s_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->type))
+ return FALSE;
+ if (!xdr_rpc_int32 (xdrs, &objp->status))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_callback_data_u_type (xdrs, &objp->data))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_payload_u_type (XDR *xdrs, rpc_loc_event_payload_u_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_u_quad_t (xdrs, &objp->disc))
+ return FALSE;
+ switch (objp->disc) {
+ case RPC_LOC_EVENT_PARSED_POSITION_REPORT:
+ if (!xdr_rpc_loc_parsed_position_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.parsed_location_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_SATELLITE_REPORT:
+ if (!xdr_rpc_loc_gnss_info_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.gnss_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NMEA_POSITION_REPORT:
+ if (!xdr_rpc_loc_nmea_report_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.nmea_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST:
+ if (!xdr_rpc_loc_ni_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ni_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST:
+ if (!xdr_rpc_loc_assist_data_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.assist_data_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_LOCATION_SERVER_REQUEST:
+ if (!xdr_rpc_loc_server_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.loc_server_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_IOCTL_REPORT:
+ if (!xdr_rpc_loc_ioctl_callback_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.ioctl_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_STATUS_REPORT:
+ if (!xdr_rpc_loc_status_event_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.status_report))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_WPS_NEEDED_REQUEST:
+ if (!xdr_rpc_loc_qwip_request_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.qwip_request))
+ return FALSE;
+ break;
+ case RPC_LOC_EVENT_RESERVED:
+ if (!xdr_rpc_loc_reserved_payload_s_type (xdrs, &objp->rpc_loc_event_payload_u_type_u.reserved))
+ return FALSE;
+ break;
+ default:
+ break;
+ }
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_fixup.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_fixup.c
new file mode 100755
index 0000000..32e3cda
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_fixup.c
@@ -0,0 +1,52 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rpc/rpc.h>
+
+#include "loc_api_fixup.h"
+
+#ifdef ADD_XDR_FLOAT
+
+int
+xdr_float(xdrp, fp)
+ XDR *xdrp;
+ float *fp;
+{
+ return xdr_long(xdrp, (long*)fp);
+}
+
+int
+xdr_double(xdrp, dp)
+ XDR *xdrp;
+ double *dp;
+{
+ return xdr_long(xdrp, (long*)dp + 1)
+ && xdr_long(xdrp, (long*)dp);
+}
+
+#endif /* ADD_XDR_FLOAT */
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_rpc_glue.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_rpc_glue.c
new file mode 100644
index 0000000..54eb9c4
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_rpc_glue.c
@@ -0,0 +1,512 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 <rpc/rpc.h>
+#include <rpc/clnt.h>
+
+/* Include RPC headers */
+#include "loc_api_rpc_glue.h"
+
+/* Callback init */
+#include "loc_apicb_appinit.h"
+
+/* Logging */
+#define LOG_TAG "loc_api_rpc_glue"
+#define LOG_NDDEBUG 0
+#include <utils/Log.h>
+
+/* Uncomment to force LOGD messages */
+// #define LOGD LOGI
+
+/*=====================================================================
+ 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 */
+ rpc_loc_client_handle_type handle; /* stores handle for client closing */
+} 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) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+#define LOC_GLUE_CHECK_RESULT(stat, ret_type) \
+ if (stat != RPC_SUCCESS) { return (ret_type) RPC_LOC_API_RPC_FAILURE; }
+
+/* Callback functions */
+/* Returns 1 if successful */
+bool_t rpc_loc_event_cb_f_type_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)
+ {
+ LOGE("Warning: No callback handler.\n");
+ ret->loc_event_cb_f_type_result = 0;
+ return 1; /* simply return */
+ }
+
+ LOGV("proc: %x prog: %x vers: %x\n",
+ (int) req->rq_proc,
+ (int) req->rq_prog,
+ (int) req->rq_vers);
+
+ LOGV("Callback received: %x (cb_id=0x%X handle=%d ret_ptr=%d)\n",
+ (int) argp->loc_event,
+ (int) 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_handle, loc_event, loc_event_payload);
+
+ LOGV("cb_func=0x%x", (unsigned) 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
+ */
+ // 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);
+
+/*===========================================================================
+
+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);
+
+/*===========================================================================
+
+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;
+ }
+
+ /* Print msg */
+ LOGV("Trying to create RPC client...\n");
+ loc_api_clnt = clnt_create(NULL, LOC_APIPROG, LOC_APIVERS, NULL);
+ LOGV("Created loc_api_clnt ---- %x\n", (unsigned int)loc_api_clnt);
+
+ if (loc_api_clnt == NULL)
+ {
+ 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)
+ {
+ LOGD("Loc API RPC client initialized.\n");
+ }
+ else {
+ 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_GLUE_CHECK_INIT(rpc_loc_client_handle_type);
+
+ rpc_loc_open_args args;
+ args.event_reg_mask = event_reg_mask;
+
+ int i;
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].cb_func == event_callback)
+ {
+ LOGW("Client already opened service (callback=0x%X)...\n",
+ (unsigned int) event_callback);
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ for (i = 0; i < LOC_API_CB_MAX_CLIENTS; i++)
+ {
+ if (loc_glue_callback_table[i].cb_func == NULL)
+ {
+ loc_glue_callback_table[i].cb_func = event_callback;
+ break;
+ }
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOGE("Too many clients opened at once...\n");
+ return RPC_LOC_CLIENT_HANDLE_INVALID;
+ }
+
+ args.event_callback = loc_glue_callback_table[i].cb_id;
+ LOGV("cb_id=%d, func=0x%x", i, (unsigned int) event_callback);
+
+ rpc_loc_open_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_open_, RPC_LOC_OPEN_VERSION)(&args, &rets, loc_api_clnt);
+ 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 (rpc_loc_client_handle_type) rets.loc_open_result;
+}
+
+int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_close_args args;
+ args.handle = handle;
+
+ rpc_loc_close_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_close_, RPC_LOC_CLOSE_VERSION)(&args, &rets, loc_api_clnt);
+
+ /* 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].handle = -1;
+ break;
+ }
+ }
+
+ if (i == LOC_API_CB_MAX_CLIENTS)
+ {
+ LOGW("Handle not found (handle=%d)...\n", (int) handle);
+ }
+
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+ return (int32) rets.loc_close_result;
+}
+
+int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_start_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_start_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_start_fix_, RPC_LOC_START_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_start_fix_result;
+}
+
+int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_stop_fix_args args;
+ args.handle = handle;
+
+ rpc_loc_stop_fix_rets rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_stop_fix_, RPC_LOC_STOP_FIX_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_stop_fix_result;
+}
+
+int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ rpc_loc_ioctl_args args;
+ args.handle = handle;
+ args.ioctl_data = ioctl_data;
+ args.ioctl_type = ioctl_type;
+ if (ioctl_data != NULL)
+ {
+ /* Assign ioctl union discriminator */
+ ioctl_data->disc = ioctl_type;
+
+ /* In case the user hasn't filled in other disc fields,
+ automatically fill them in here */
+ switch (ioctl_type)
+ {
+ case RPC_LOC_IOCTL_GET_API_VERSION:
+ 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;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_ioctl_, RPC_LOC_IOCTL_VERSION)(&args, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets.loc_ioctl_result;
+}
+
+/* Returns 0 if error */
+int32 loc_api_null(void)
+{
+ LOC_GLUE_CHECK_INIT(int32);
+
+ int32 rets;
+ enum clnt_stat stat = RPC_SUCCESS;
+
+ stat = RPC_FUNC_VERSION(rpc_loc_api_null_, RPC_LOC_API_NULL_VERSION)(NULL, &rets, loc_api_clnt);
+ LOC_GLUE_CHECK_RESULT(stat, int32);
+
+ return (int32) rets;
+}
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_sync_call.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_sync_call.c
new file mode 100644
index 0000000..da7f0fa
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_sync_call.c
@@ -0,0 +1,518 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 "loc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#include <utils/Log.h>
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_data_array_s_type loc_sync_data;
+
+/*===========================================================================
+
+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_init(&loc_sync_data.lock, NULL);
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ loc_sync_data.size = LOC_SYNC_CALL_BUFFER_SIZE;
+ loc_sync_data.in_use = FALSE;
+
+ memset(loc_sync_data.slot_in_use, 0, sizeof loc_sync_data.slot_in_use);
+
+ int i;
+ for (i = 0; i < loc_sync_data.size; i++)
+ {
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->loc_handle = -1;
+ slot->loc_cb_is_selected = FALSE; /* is cb selected? */
+ slot->loc_cb_is_waiting = FALSE; /* is waiting? */
+ slot->loc_cb_has_arrived = FALSE; /* callback has arrived */
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+}
+
+/*===========================================================================
+
+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->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 */
+)
+{
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ if (!loc_sync_data.in_use)
+ {
+ pthread_mutex_unlock(&loc_sync_data.lock);
+ return;
+ }
+
+ loc_sync_call_data_s_type *slot;
+ boolean in_use = FALSE, consumed = FALSE;
+ int i;
+
+ for (i = 0; i < loc_sync_data.size && !consumed; i++)
+ {
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[i];
+ in_use |= loc_sync_data.slot_in_use[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (loc_sync_data.slot_in_use[i] &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload) &&
+ !slot->loc_cb_has_arrived)
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+ consumed = TRUE;
+
+ /* Received a callback while waiting, wake up thread to check it */
+ if (slot->loc_cb_is_waiting)
+ {
+ slot->loc_cb_received_event_mask = loc_event;
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ }
+ else {
+ /* If callback arrives before wait, remember it */
+ slot->loc_cb_has_arrived = TRUE;
+ }
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ if (!in_use) {
+ loc_sync_data.in_use = FALSE;
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_alloc_slot
+
+DESCRIPTION
+ Allocates a buffer slot for the synchronous API call
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : buffer full
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_alloc_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ for (i = 0; i < loc_sync_data.size; i++)
+ {
+ if (!loc_sync_data.slot_in_use[i])
+ {
+ select_id = i;
+ loc_sync_data.slot_in_use[i] = 1;
+ loc_sync_data.in_use = TRUE;
+ break;
+ }
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_free_slot
+
+DESCRIPTION
+ Frees a buffer slot after the synchronous API call
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_free_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ loc_sync_data.slot_in_use[select_id] = 0;
+
+ int i;
+ for (i = 0; i < loc_sync_data.size; i++)
+ {
+ if (loc_sync_data.slot_in_use[i]) break;
+ }
+
+ if (i >= loc_sync_data.size)
+ {
+ loc_sync_data.in_use = FALSE;
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_select_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
+
+===========================================================================*/
+int loc_api_select_callback(
+ 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 */
+)
+{
+ int select_id = loc_alloc_slot();
+
+ if (select_id < 0)
+ {
+ LOGE("loc_select_callback: buffer full for this synchronous Loc API call, mask: 0x%x",
+ (unsigned) event_mask);
+ return -1;
+ }
+
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[select_id];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->loc_handle = loc_handle;
+ slot->loc_cb_is_selected = TRUE;
+ slot->loc_cb_is_waiting = FALSE;
+ slot->loc_cb_has_arrived = FALSE;
+
+ 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;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ return select_id;
+}
+
+/*===========================================================================
+
+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
+
+===========================================================================*/
+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 */
+)
+{
+ if (select_id < 0 || select_id >= loc_sync_data.size || !loc_sync_data.slot_in_use[select_id])
+ {
+ LOGE("loc_wait_callback: invalid select_id: %d", select_id);
+ return RPC_LOC_API_INVALID_PARAMETER;
+ }
+
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[select_id];
+
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->loc_cb_has_arrived)
+ {
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ pthread_mutex_unlock(&slot->lock);
+ loc_free_slot(select_id);
+ ret_val = RPC_LOC_API_SUCCESS;
+ return ret_val; /* success */
+ }
+
+ if (slot->loc_cb_is_waiting)
+ {
+ pthread_mutex_unlock(&slot->lock);
+ loc_free_slot(select_id);
+ ret_val = RPC_LOC_API_ENGINE_BUSY; /* busy, rejected */
+ return ret_val; /* exit */
+ }
+
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Take new wait request */
+ slot->loc_cb_is_waiting = TRUE;
+
+ /* Waiting */
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+
+ if (rc == ETIMEDOUT)
+ {
+ slot->loc_cb_is_waiting = FALSE;
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ }
+ else {
+ /* Obtained the first awaited callback */
+ slot->loc_cb_is_waiting = FALSE; /* stop waiting */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+
+ loc_free_slot(select_id);
+
+ 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 = RPC_LOC_API_SUCCESS;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ // Select the callback we are waiting for
+ select_id = loc_api_select_callback(handle, 0, ioctl_type);
+
+ if (select_id >= 0)
+ {
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+ LOGV("loc_api_sync_ioctl: select_id = %d, loc_ioctl returned %d\n", select_id, rc);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ loc_free_slot(select_id);
+ }
+ else {
+ // 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
+ LOGE("loc_api_sync_ioctl: loc_api_wait_callback failed, returned %d (select id %d)\n", rc, select_id);
+ }
+ 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;
+ LOGE("loc_api_sync_ioctl: IOCTL result failed, result: %d (select id %d)\n", rc, select_id);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+ } /* select id */
+
+ return rc;
+}
+
+
diff --git a/loc_api/libloc_api-rpc/gen-50000/loc_api_xdr.c b/loc_api/libloc_api-rpc/gen-50000/loc_api_xdr.c
new file mode 100755
index 0000000..835f6b1
--- /dev/null
+++ b/loc_api/libloc_api-rpc/gen-50000/loc_api_xdr.c
@@ -0,0 +1,171 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "loc_api.h"
+
+bool_t
+xdr_rpc_loc_api_api_versions_return_type (XDR *xdrs, rpc_loc_api_api_versions_return_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_array (xdrs, (char **)&objp->rpc_loc_api_api_versions_return_type_val, (u_int *) &objp->rpc_loc_api_api_versions_return_type_len, ~0,
+ sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_event_cb_f_type (XDR *xdrs, rpc_loc_event_cb_f_type *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, objp))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_args (XDR *xdrs, rpc_loc_open_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_event_mask_type (xdrs, &objp->event_reg_mask))
+ return FALSE;
+ if (!xdr_rpc_loc_event_cb_f_type (xdrs, &objp->event_callback))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_args (XDR *xdrs, rpc_loc_close_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_args (XDR *xdrs, rpc_loc_start_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_args (XDR *xdrs, rpc_loc_stop_fix_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_args (XDR *xdrs, rpc_loc_ioctl_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->handle))
+ return FALSE;
+ if (!xdr_rpc_loc_ioctl_e_type (xdrs, &objp->ioctl_type))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->ioctl_data, sizeof (rpc_loc_ioctl_data_u_type), (xdrproc_t) xdr_rpc_loc_ioctl_data_u_type))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_version_s_args (XDR *xdrs, rpc_loc_api_api_version_s_args *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_boolean (xdrs, &objp->len_not_null))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *xdrs, rpc_loc_api_rpc_glue_code_info_remote_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_uint32 (xdrs, &objp->toolvers))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->features))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->proghash))
+ return FALSE;
+ if (!xdr_rpc_uint32 (xdrs, &objp->cbproghash))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_open_rets (XDR *xdrs, rpc_loc_open_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_client_handle_type (xdrs, &objp->loc_open_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_close_rets (XDR *xdrs, rpc_loc_close_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_close_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_start_fix_rets (XDR *xdrs, rpc_loc_start_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_start_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_stop_fix_rets (XDR *xdrs, rpc_loc_stop_fix_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_stop_fix_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_ioctl_rets (XDR *xdrs, rpc_loc_ioctl_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_int32 (xdrs, &objp->loc_ioctl_result))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_rpc_loc_api_api_versions_rets (XDR *xdrs, rpc_loc_api_api_versions_rets *objp)
+{
+ register int32_t *buf;
+
+ if (!xdr_rpc_loc_api_api_versions_return_type (xdrs, &objp->loc_api_api_versions_result))
+ return FALSE;
+ if (!xdr_pointer (xdrs, (char **)&objp->len, sizeof (rpc_uint32), (xdrproc_t) xdr_rpc_uint32))
+ return FALSE;
+ return TRUE;
+}
diff --git a/loc_api/libloc_api-rpc/inc-20000/loc_api.h b/loc_api/libloc_api-rpc/inc-20000/loc_api.h
new file mode 100644
index 0000000..abe0c4c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-20000/loc_api.h
@@ -0,0 +1,198 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00020002
+
+#define LOC_APIPROG 0x3000008c
+#define LOC_APIVERS_0001 0x00020001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00020002(void *, void *, CLIENT *);
+extern bool_t rpc_loc_api_null_0x00020002_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_0x00020002(void *, rpc_loc_api_rpc_glue_code_info_remote_rets *, CLIENT *);
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00020002_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_0x00020002(rpc_loc_open_args *, rpc_loc_open_rets *, CLIENT *);
+extern bool_t rpc_loc_open_0x00020002_svc(rpc_loc_open_args *, rpc_loc_open_rets *, struct svc_req *);
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00020002(rpc_loc_close_args *, rpc_loc_close_rets *, CLIENT *);
+extern bool_t rpc_loc_close_0x00020002_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_0x00020002(rpc_loc_start_fix_args *, rpc_loc_start_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_start_fix_0x00020002_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_0x00020002(rpc_loc_stop_fix_args *, rpc_loc_stop_fix_rets *, CLIENT *);
+extern bool_t rpc_loc_stop_fix_0x00020002_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_0x00020002(rpc_loc_ioctl_args *, rpc_loc_ioctl_rets *, CLIENT *);
+extern bool_t rpc_loc_ioctl_0x00020002_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_0x00020002(void *, rpc_loc_api_api_versions_rets *, CLIENT *);
+extern bool_t rpc_loc_api_api_versions_0x00020002_svc(void *, rpc_loc_api_api_versions_rets *, struct svc_req *);
+extern int loc_apiprog_0x00020002_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define rpc_loc_api_null 0
+extern enum clnt_stat rpc_loc_api_null_0x00020002();
+extern bool_t rpc_loc_api_null_0x00020002_svc();
+#define rpc_loc_api_rpc_glue_code_info_remote 1
+extern enum clnt_stat rpc_loc_api_rpc_glue_code_info_remote_0x00020002();
+extern bool_t rpc_loc_api_rpc_glue_code_info_remote_0x00020002_svc();
+#define rpc_loc_open 2
+extern enum clnt_stat rpc_loc_open_0x00020002();
+extern bool_t rpc_loc_open_0x00020002_svc();
+#define rpc_loc_close 3
+extern enum clnt_stat rpc_loc_close_0x00020002();
+extern bool_t rpc_loc_close_0x00020002_svc();
+#define rpc_loc_start_fix 4
+extern enum clnt_stat rpc_loc_start_fix_0x00020002();
+extern bool_t rpc_loc_start_fix_0x00020002_svc();
+#define rpc_loc_stop_fix 5
+extern enum clnt_stat rpc_loc_stop_fix_0x00020002();
+extern bool_t rpc_loc_stop_fix_0x00020002_svc();
+#define rpc_loc_ioctl 6
+extern enum clnt_stat rpc_loc_ioctl_0x00020002();
+extern bool_t rpc_loc_ioctl_0x00020002_svc();
+#define rpc_loc_api_api_versions 0xFFFFFFFF
+extern enum clnt_stat rpc_loc_api_api_versions_0x00020002();
+extern bool_t rpc_loc_api_api_versions_0x00020002_svc();
+extern int loc_apiprog_0x00020002_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-20000/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-20000/loc_api_cb.h
new file mode 100644
index 0000000..766acf6
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-20000/loc_api_cb.h
@@ -0,0 +1,64 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00020001
+
+#define LOC_APICBPROG 0x3100008c
+#define LOC_APICBVERS_0001 0x00020001
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define rpc_loc_event_cb_f_type 1
+extern enum clnt_stat rpc_loc_event_cb_f_type_0x00020002(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, CLIENT *);
+extern bool_t rpc_loc_event_cb_f_type_0x00020002_svc(rpc_loc_event_cb_f_type_args *, rpc_loc_event_cb_f_type_rets *, struct svc_req *);
+extern int loc_apicbprog_0x00020001_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_0x00020002();
+extern bool_t rpc_loc_event_cb_f_type_0x00020002_svc();
+extern int loc_apicbprog_0x00020001_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-20000/loc_api_common.h b/loc_api/libloc_api-rpc/inc-20000/loc_api_common.h
new file mode 100644
index 0000000..553b6cd
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-20000/loc_api_common.h
@@ -0,0 +1,1043 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_OPEN_VERSION 0x00020001
+#define RPC_LOC_CLOSE_VERSION 0x00020001
+#define RPC_LOC_START_FIX_VERSION 0x00020001
+#define RPC_LOC_STOP_FIX_VERSION 0x00020001
+#define RPC_LOC_IOCTL_VERSION 0x00020001
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00020001
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+#define RPC_LOC_API_API_MAJOR_NUM 0x0001
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ struct {
+ u_int nmea_sentences_len;
+ char *nmea_sentences_val;
+ } nmea_sentences;
+};
+typedef struct rpc_loc_nmea_report_s_type rpc_loc_nmea_report_s_type;
+
+enum rpc_loc_status_event_e_type {
+ RPC_LOC_STATUS_EVENT_ENGINE_STATE = 1,
+ RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE = 2,
+ RPC_LOC_STATUS_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_status_event_e_type rpc_loc_status_event_e_type;
+
+enum rpc_loc_engine_state_e_type {
+ RPC_LOC_ENGINE_STATE_ON = 1,
+ RPC_LOC_ENGINE_STATE_OFF = 2,
+ RPC_LOC_ENGINE_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_engine_state_e_type rpc_loc_engine_state_e_type;
+
+enum rpc_loc_fix_session_state_e_type {
+ RPC_LOC_FIX_SESSION_STATE_BEGIN = 1,
+ RPC_LOC_FIX_SESSION_STATE_END = 2,
+ RPC_LOC_FIX_SESSION_STATE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_session_state_e_type rpc_loc_fix_session_state_e_type;
+
+struct rpc_loc_status_event_payload_u_type {
+ rpc_loc_status_event_e_type disc;
+ union {
+ rpc_loc_engine_state_e_type engine_state;
+ rpc_loc_fix_session_state_e_type fix_session_state;
+ } rpc_loc_status_event_payload_u_type_u;
+};
+typedef struct rpc_loc_status_event_payload_u_type rpc_loc_status_event_payload_u_type;
+
+struct rpc_loc_status_event_s_type {
+ rpc_loc_status_event_e_type event;
+ rpc_loc_status_event_payload_u_type payload;
+};
+typedef struct rpc_loc_status_event_s_type rpc_loc_status_event_s_type;
+
+enum rpc_loc_server_addr_e_type {
+ RPC_LOC_SERVER_ADDR_IPV4 = 1,
+ RPC_LOC_SERVER_ADDR_URL = 2,
+ RPC_LOC_SERVER_ADDR_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ struct {
+ u_int addr_len;
+ char *addr_val;
+ } addr;
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int requestor_id_string_len;
+ char *requestor_id_string_val;
+ } requestor_id_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int client_name_string_len;
+ char *client_name_string_val;
+ } client_name_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ u_char maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ struct {
+ u_int ext_client_address_len;
+ char *ext_client_address_val;
+ } ext_client_address;
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ struct {
+ u_int lcs_codeword_string_len;
+ char *lcs_codeword_string_val;
+ } lcs_codeword_string;
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ struct {
+ u_int notification_text_len;
+ char *notification_text_val;
+ } notification_text;
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char *apn_name;
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+#define RPC_LOC_API_NULL_VERSION 0x00020001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00020001
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-20000/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-20000/loc_api_fixup.h
new file mode 100755
index 0000000..f9be48c
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-20000/loc_api_fixup.h
@@ -0,0 +1,188 @@
+/******************************************************************************
+ @file: loc_api_fixup.h
+ @brief: Loc API Android RPC amendment header
+
+ DESCRIPTION
+ Loc API Android RPC amendment header
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+ ******************************************************************************/
+
+#ifndef LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00002000
+#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 0x00020000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+
+#define RPC_LOC_ASSIST_DATA_ALL 0xFFFFFFFF
+
+#define RPC_LOC_NMEA_MASK_ALL 0xffff
+#define RPC_LOC_NMEA_MASK_GGA 0x0001
+#define RPC_LOC_NMEA_MASK_RMC 0x0002
+#define RPC_LOC_NMEA_MASK_GSV 0x0004
+#define RPC_LOC_NMEA_MASK_GSA 0x0008
+#define RPC_LOC_NMEA_MASK_VTG 0x0010
+
+/* flags for notification */
+#define RPC_LOC_NI_CLIENT_NAME_PRESENT 0x0001
+#define RPC_LOC_NI_CLIENT_EXTADDR_PRESENT 0x0002
+#define RPC_LOC_NI_DEF_LOCATION_TYPE_PRESENT 0x0010
+#define RPC_LOC_NI_REQUESTOR_ID_PRESENT 0x0020
+#define RPC_LOC_NI_CODEWORD_PRESENT 0x0040
+#define RPC_LOC_NI_SERVICE_TYPE_ID_PRESENT 0x0080
+#define RPC_LOC_NI_ENCODING_TYPE_PRESENT 0x0100
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/loc_api/libloc_api-rpc/inc-20000/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-20000/loc_apicb_appinit.h
new file mode 100755
index 0000000..92d4e15
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-20000/loc_apicb_appinit.h
@@ -0,0 +1,34 @@
+/* -------------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -------------------------------------------------------------------------------
+ */
+
+#ifndef LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
index 04be079..5f2a73a 100644
--- a/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
+++ b/loc_api/libloc_api-rpc/inc-3200/loc_api_common.h
@@ -169,6 +169,7 @@ 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;
@@ -180,10 +181,18 @@ enum rpc_loc_engine_state_e_type {
};
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;
@@ -852,6 +861,7 @@ 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*);
@@ -949,6 +959,7 @@ 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 ();
diff --git a/loc_api/libloc_api-rpc/inc-50000/debug.h b/loc_api/libloc_api-rpc/inc-50000/debug.h
new file mode 100644
index 0000000..ec2ce50
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/debug.h
@@ -0,0 +1,69 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DEBUG_H
+#define DEBUG_H
+
+#include <stdio.h>
+
+#define LOG_TAG "libgps-rpc"
+#include <utils/Log.h>
+
+#define PRINT(x...) do { \
+ fprintf(stdout, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stdout, ##x); \
+ LOGD(x); \
+ } while(0)
+
+#ifdef DEBUG
+#define D PRINT
+#else
+#define D(x...) do { } while(0)
+#endif
+
+#ifdef VERBOSE
+#define V PRINT
+#else
+#define V(x...) do { } while(0)
+#endif
+
+#define E(x...) do { \
+ fprintf(stderr, "%s(%d) ", __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##x); \
+ LOGE(x); \
+ } while(0)
+
+#define FAILIF(cond, msg...) do { \
+ if (__builtin_expect (cond, 0)) { \
+ fprintf(stderr, "%s:%s:(%d): ", __FILE__, __FUNCTION__, __LINE__); \
+ fprintf(stderr, ##msg); \
+ LOGE(##msg); \
+ } \
+ } while(0)
+
+#endif/*DEBUG_H*/
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_api.h b/loc_api/libloc_api-rpc/inc-50000/loc_api.h
new file mode 100755
index 0000000..465bb09
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_api.h
@@ -0,0 +1,214 @@
+/*
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+ /*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_H_RPCGEN
+#define _LOC_API_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef struct {
+ u_int rpc_loc_api_api_versions_return_type_len;
+ rpc_uint32 *rpc_loc_api_api_versions_return_type_val;
+} rpc_loc_api_api_versions_return_type;
+
+typedef rpc_uint32 rpc_loc_event_cb_f_type;
+
+struct rpc_loc_open_args {
+ rpc_loc_event_mask_type event_reg_mask;
+ rpc_loc_event_cb_f_type event_callback;
+};
+typedef struct rpc_loc_open_args rpc_loc_open_args;
+
+struct rpc_loc_close_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_close_args rpc_loc_close_args;
+
+struct rpc_loc_start_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_start_fix_args rpc_loc_start_fix_args;
+
+struct rpc_loc_stop_fix_args {
+ rpc_loc_client_handle_type handle;
+};
+typedef struct rpc_loc_stop_fix_args rpc_loc_stop_fix_args;
+
+struct rpc_loc_ioctl_args {
+ rpc_loc_client_handle_type handle;
+ rpc_loc_ioctl_e_type ioctl_type;
+ rpc_loc_ioctl_data_u_type *ioctl_data;
+};
+typedef struct rpc_loc_ioctl_args rpc_loc_ioctl_args;
+
+struct rpc_loc_api_api_version_s_args {
+ rpc_boolean len_not_null;
+};
+typedef struct rpc_loc_api_api_version_s_args rpc_loc_api_api_version_s_args;
+
+struct rpc_loc_api_rpc_glue_code_info_remote_rets {
+ rpc_uint32 toolvers;
+ rpc_uint32 features;
+ rpc_uint32 proghash;
+ rpc_uint32 cbproghash;
+};
+typedef struct rpc_loc_api_rpc_glue_code_info_remote_rets rpc_loc_api_rpc_glue_code_info_remote_rets;
+
+struct rpc_loc_open_rets {
+ rpc_loc_client_handle_type loc_open_result;
+};
+typedef struct rpc_loc_open_rets rpc_loc_open_rets;
+
+struct rpc_loc_close_rets {
+ rpc_int32 loc_close_result;
+};
+typedef struct rpc_loc_close_rets rpc_loc_close_rets;
+
+struct rpc_loc_start_fix_rets {
+ rpc_int32 loc_start_fix_result;
+};
+typedef struct rpc_loc_start_fix_rets rpc_loc_start_fix_rets;
+
+struct rpc_loc_stop_fix_rets {
+ rpc_int32 loc_stop_fix_result;
+};
+typedef struct rpc_loc_stop_fix_rets rpc_loc_stop_fix_rets;
+
+struct rpc_loc_ioctl_rets {
+ rpc_int32 loc_ioctl_result;
+};
+typedef struct rpc_loc_ioctl_rets rpc_loc_ioctl_rets;
+
+struct rpc_loc_api_api_versions_rets {
+ rpc_loc_api_api_versions_return_type loc_api_api_versions_result;
+ rpc_uint32 *len;
+};
+typedef struct rpc_loc_api_api_versions_rets rpc_loc_api_api_versions_rets;
+#define LOC_APIVERS 0x00050001
+
+#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 */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_api_api_versions_return_type (XDR *, rpc_loc_api_api_versions_return_type*);
+extern bool_t xdr_rpc_loc_event_cb_f_type (XDR *, rpc_loc_event_cb_f_type*);
+extern bool_t xdr_rpc_loc_open_args (XDR *, rpc_loc_open_args*);
+extern bool_t xdr_rpc_loc_close_args (XDR *, rpc_loc_close_args*);
+extern bool_t xdr_rpc_loc_start_fix_args (XDR *, rpc_loc_start_fix_args*);
+extern bool_t xdr_rpc_loc_stop_fix_args (XDR *, rpc_loc_stop_fix_args*);
+extern bool_t xdr_rpc_loc_ioctl_args (XDR *, rpc_loc_ioctl_args*);
+extern bool_t xdr_rpc_loc_api_api_version_s_args (XDR *, rpc_loc_api_api_version_s_args*);
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets (XDR *, rpc_loc_api_rpc_glue_code_info_remote_rets*);
+extern bool_t xdr_rpc_loc_open_rets (XDR *, rpc_loc_open_rets*);
+extern bool_t xdr_rpc_loc_close_rets (XDR *, rpc_loc_close_rets*);
+extern bool_t xdr_rpc_loc_start_fix_rets (XDR *, rpc_loc_start_fix_rets*);
+extern bool_t xdr_rpc_loc_stop_fix_rets (XDR *, rpc_loc_stop_fix_rets*);
+extern bool_t xdr_rpc_loc_ioctl_rets (XDR *, rpc_loc_ioctl_rets*);
+extern bool_t xdr_rpc_loc_api_api_versions_rets (XDR *, rpc_loc_api_api_versions_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_api_api_versions_return_type ();
+extern bool_t xdr_rpc_loc_event_cb_f_type ();
+extern bool_t xdr_rpc_loc_open_args ();
+extern bool_t xdr_rpc_loc_close_args ();
+extern bool_t xdr_rpc_loc_start_fix_args ();
+extern bool_t xdr_rpc_loc_stop_fix_args ();
+extern bool_t xdr_rpc_loc_ioctl_args ();
+extern bool_t xdr_rpc_loc_api_api_version_s_args ();
+extern bool_t xdr_rpc_loc_api_rpc_glue_code_info_remote_rets ();
+extern bool_t xdr_rpc_loc_open_rets ();
+extern bool_t xdr_rpc_loc_close_rets ();
+extern bool_t xdr_rpc_loc_start_fix_rets ();
+extern bool_t xdr_rpc_loc_stop_fix_rets ();
+extern bool_t xdr_rpc_loc_ioctl_rets ();
+extern bool_t xdr_rpc_loc_api_api_versions_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_api_cb.h b/loc_api/libloc_api-rpc/inc-50000/loc_api_cb.h
new file mode 100755
index 0000000..0fa9871
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_api_cb.h
@@ -0,0 +1,81 @@
+/*
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ */
+
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_CB_H_RPCGEN
+#define _LOC_API_CB_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct rpc_loc_event_cb_f_type_args {
+ rpc_uint32 cb_id;
+ rpc_loc_client_handle_type loc_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type *loc_event_payload;
+};
+typedef struct rpc_loc_event_cb_f_type_args rpc_loc_event_cb_f_type_args;
+
+struct rpc_loc_event_cb_f_type_rets {
+ rpc_int32 loc_event_cb_f_type_result;
+};
+typedef struct rpc_loc_event_cb_f_type_rets rpc_loc_event_cb_f_type_rets;
+#define LOC_APICBVERS 0x00050001
+
+#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 */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_loc_event_cb_f_type_args (XDR *, rpc_loc_event_cb_f_type_args*);
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets (XDR *, rpc_loc_event_cb_f_type_rets*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_loc_event_cb_f_type_args ();
+extern bool_t xdr_rpc_loc_event_cb_f_type_rets ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_CB_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_api_common.h b/loc_api/libloc_api-rpc/inc-50000/loc_api_common.h
new file mode 100755
index 0000000..cac604e
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_api_common.h
@@ -0,0 +1,1154 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _LOC_API_COMMON_H_RPCGEN
+#define _LOC_API_COMMON_H_RPCGEN
+
+#include <rpc/rpc.h>
+#include "loc_api_fixup.h"
+
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define LOC_API_TOOLVERS 0x00040022
+#define LOC_API_FEATURES 0x00000001
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004
+#define RPC_LOC_EVENT_WPS_NEEDED_REQUEST 0x00000200
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040
+#define RPC_LOC_EVENT_RESERVED 0x8000000000000000
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100
+#define RPC_LOC_EVENT_CB_F_TYPE_VERSION 0x00050001
+#define RPC_LOC_OPEN_VERSION 0x00050001
+#define RPC_LOC_API_RPC_GLUE_CODE_INFO_REMOTE_VERSION 0x00050001
+#define RPC_LOC_API_NULL_VERSION 0x00050001
+#define RPC_LOC_STOP_FIX_VERSION 0x00050001
+#define RPC_LOC_IOCTL_VERSION 0x00050001
+#define RPC_LOC_START_FIX_VERSION 0x00050001
+#define RPC_LOC_CLOSE_VERSION 0x00050001
+#define RPC_LOC_APIAPI_VERSION_IS_HASHKEY 0
+#define RPC_LOC_API_API_MAJOR_NUM 0x0005
+
+typedef bool_t rpc_boolean;
+
+typedef u_long rpc_uint32;
+
+typedef u_short rpc_uint16;
+
+typedef u_char rpc_uint8;
+
+typedef long rpc_int32;
+
+typedef u_char rpc_byte;
+
+typedef u_quad_t rpc_uint64;
+
+typedef rpc_int32 rpc_loc_client_handle_type;
+
+typedef rpc_uint64 rpc_loc_event_mask_type;
+
+typedef rpc_uint64 rpc_loc_position_valid_mask_type;
+
+typedef rpc_uint32 rpc_loc_pos_technology_mask_type;
+
+enum rpc_loc_session_status_e_type {
+ RPC_LOC_SESS_STATUS_SUCCESS = 0,
+ RPC_LOC_SESS_STATUS_IN_PROGESS = 1,
+ RPC_LOC_SESS_STATUS_GENERAL_FAILURE = 2,
+ RPC_LOC_SESS_STATUS_TIMEOUT = 3,
+ RPC_LOC_SESS_STATUS_USER_END = 4,
+ RPC_LOC_SESS_STATUS_BAD_PARAMETER = 5,
+ RPC_LOC_SESS_STATUS_PHONE_OFFLINE = 6,
+ RPC_LOC_SESS_STATUS_ENGINE_LOCKED = 7,
+ RPC_LOC_SESS_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_session_status_e_type rpc_loc_session_status_e_type;
+
+struct rpc_loc_calendar_time_s_type {
+ rpc_uint16 year;
+ u_char month;
+ u_char day_of_week;
+ u_char day;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ rpc_uint16 millisecond;
+};
+typedef struct rpc_loc_calendar_time_s_type rpc_loc_calendar_time_s_type;
+
+struct rpc_loc_parsed_position_s_type {
+ rpc_loc_position_valid_mask_type valid_mask;
+ rpc_loc_session_status_e_type session_status;
+ rpc_loc_calendar_time_s_type timestamp_calendar;
+ rpc_uint64 timestamp_utc;
+ rpc_uint8 leap_seconds;
+ float time_unc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float speed_horizontal;
+ float speed_vertical;
+ float heading;
+ float hor_unc_circular;
+ float hor_unc_ellipse_semi_major;
+ float hor_unc_ellipse_semi_minor;
+ float hor_unc_ellipse_orient_azimuth;
+ float vert_unc;
+ float speed_unc;
+ float heading_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ float magnetic_deviation;
+ rpc_loc_pos_technology_mask_type technology_mask;
+};
+typedef struct rpc_loc_parsed_position_s_type rpc_loc_parsed_position_s_type;
+
+enum rpc_loc_sv_system_e_type {
+ RPC_LOC_SV_SYSTEM_GPS = 1,
+ RPC_LOC_SV_SYSTEM_GALILEO = 2,
+ RPC_LOC_SV_SYSTEM_SBAS = 3,
+ RPC_LOC_SV_SYSTEM_COMPASS = 4,
+ RPC_LOC_SV_SYSTEM_GLONASS = 5,
+ RPC_LOC_SV_SYSTEM_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_system_e_type rpc_loc_sv_system_e_type;
+
+enum rpc_loc_sv_status_e_type {
+ RPC_LOC_SV_STATUS_IDLE = 1,
+ RPC_LOC_SV_STATUS_SEARCH = 2,
+ RPC_LOC_SV_STATUS_TRACK = 3,
+ RPC_LOC_SV_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_sv_status_e_type rpc_loc_sv_status_e_type;
+
+typedef rpc_uint32 rpc_loc_sv_info_valid_mask_type;
+
+struct rpc_loc_sv_info_s_type {
+ rpc_loc_sv_info_valid_mask_type valid_mask;
+ rpc_loc_sv_system_e_type system;
+ rpc_uint8 prn;
+ rpc_uint8 health_status;
+ rpc_loc_sv_status_e_type process_status;
+ rpc_boolean has_eph;
+ rpc_boolean has_alm;
+ float elevation;
+ float azimuth;
+ float snr;
+};
+typedef struct rpc_loc_sv_info_s_type rpc_loc_sv_info_s_type;
+
+typedef rpc_uint32 rpc_loc_gnss_info_valid_mask_type;
+
+struct rpc_loc_gnss_info_s_type {
+ rpc_loc_gnss_info_valid_mask_type valid_mask;
+ float position_dop;
+ float horizontal_dop;
+ float vertical_dop;
+ rpc_boolean altitude_assumed;
+ rpc_uint16 sv_count;
+ struct {
+ u_int sv_list_len;
+ rpc_loc_sv_info_s_type *sv_list_val;
+ } sv_list;
+};
+typedef struct rpc_loc_gnss_info_s_type rpc_loc_gnss_info_s_type;
+
+struct rpc_loc_nmea_report_s_type {
+ rpc_uint16 length;
+ char nmea_sentences[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_MAX = 268435456,
+};
+typedef enum rpc_loc_server_addr_e_type rpc_loc_server_addr_e_type;
+
+struct rpc_loc_server_addr_ipv4_type {
+ rpc_uint32 addr;
+ rpc_uint16 port;
+};
+typedef struct rpc_loc_server_addr_ipv4_type rpc_loc_server_addr_ipv4_type;
+
+struct rpc_loc_server_addr_url_type {
+ rpc_uint16 length;
+ char addr[256];
+};
+typedef struct rpc_loc_server_addr_url_type rpc_loc_server_addr_url_type;
+
+struct rpc_loc_server_addr_u_type {
+ rpc_loc_server_addr_e_type disc;
+ union {
+ rpc_loc_server_addr_ipv4_type ipv4;
+ rpc_loc_server_addr_url_type url;
+ } rpc_loc_server_addr_u_type_u;
+};
+typedef struct rpc_loc_server_addr_u_type rpc_loc_server_addr_u_type;
+
+struct rpc_loc_server_info_s_type {
+ rpc_loc_server_addr_e_type addr_type;
+ rpc_loc_server_addr_u_type addr_info;
+};
+typedef struct rpc_loc_server_info_s_type rpc_loc_server_info_s_type;
+
+enum rpc_loc_ni_notify_verify_e_type {
+ RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY = 1,
+ RPC_LOC_NI_USER_NOTIFY_ONLY = 2,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP = 3,
+ RPC_LOC_NI_USER_NOTIFY_VERIFY_NOT_ALLOW_NO_RESP = 4,
+ RPC_LOC_NI_USER_PRIVACY_OVERRIDE = 5,
+ RPC_LOC_NI_USER_NOTIFY_VERITY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_notify_verify_e_type rpc_loc_ni_notify_verify_e_type;
+
+enum rpc_loc_ni_event_e_type {
+ RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ = 1,
+ RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ = 2,
+ RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ = 3,
+ RPC_LOC_NI_EVENT_VX_SERVICE_INTERACTION_REQ = 4,
+ RPC_LOC_NI_EVENT_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_event_e_type rpc_loc_ni_event_e_type;
+
+enum rpc_loc_ni_datacoding_scheme_e_type {
+ RPC_LOC_NI_PRESUPL_ISO646IRV = 0,
+ RPC_LOC_NI_PRESUPL_ISO8859 = 1,
+ RPC_LOC_NI_PRESUPL_UTF8 = 2,
+ RPC_LOC_NI_PRESUPL_UTF16 = 3,
+ RPC_LOC_NI_PRESUPL_UCS2 = 4,
+ RPC_LOC_NI_PRESUPL_GSM_DEFAULT = 5,
+ RPC_LOC_NI_PRESUPL_SHIFT_JIS = 6,
+ RPC_LOC_NI_PRESUPL_JIS = 7,
+ RPC_LOC_NI_PRESUPL_EUC = 8,
+ RPC_LOC_NI_PRESUPL_GB2312 = 9,
+ RPC_LOC_NI_PRESUPL_CNS11643 = 10,
+ RPC_LOC_NI_PRESUPL_KSC1001 = 11,
+ RPC_LOC_NI_PRESUPL_ENCODING_UNKNOWN = 2147483647,
+ RPC_LOC_NI_SS_GERMAN = 12,
+ RPC_LOC_NI_SS_ENGLISH = 13,
+ RPC_LOC_NI_SS_ITALIAN = 14,
+ RPC_LOC_NI_SS_FRENCH = 15,
+ RPC_LOC_NI_SS_SPANISH = 16,
+ RPC_LOC_NI_SS_DUTCH = 17,
+ RPC_LOC_NI_SS_SWEDISH = 18,
+ RPC_LOC_NI_SS_DANISH = 19,
+ RPC_LOC_NI_SS_PORTUGUESE = 20,
+ RPC_LOC_NI_SS_FINNISH = 21,
+ RPC_LOC_NI_SS_NORWEGIAN = 22,
+ RPC_LOC_NI_SS_GREEK = 23,
+ RPC_LOC_NI_SS_TURKISH = 24,
+ RPC_LOC_NI_SS_HUNGARIAN = 25,
+ RPC_LOC_NI_SS_POLISH = 26,
+ RPC_LOC_NI_SS_LANGUAGE_UNSPEC = 27,
+ RPC_LOC_NI_SUPL_UTF8 = 28,
+ RPC_LOC_NI_SUPL_UCS2 = 29,
+ RPC_LOC_NI_SUPL_GSM_DEFAULT = 30,
+ RPC_LOC_NI_SUPL_ENCODING_UNKNOWN = 2147483647,
+};
+typedef enum rpc_loc_ni_datacoding_scheme_e_type rpc_loc_ni_datacoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type {
+ RPC_LOC_NI_VX_OCTET = 0,
+ RPC_LOC_NI_VX_EXN_PROTOCOL_MSG = 1,
+ RPC_LOC_NI_VX_ASCII = 2,
+ RPC_LOC_NI_VX_IA5 = 3,
+ RPC_LOC_NI_VX_UNICODE = 4,
+ RPC_LOC_NI_VX_SHIFT_JIS = 5,
+ RPC_LOC_NI_VX_KOREAN = 6,
+ RPC_LOC_NI_VX_LATIN_HEBREW = 7,
+ RPC_LOC_NI_VX_LATIN = 8,
+ RPC_LOC_NI_VX_GSM = 9,
+ RPC_LOC_NI_VX_ENCODING_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_requester_id_encoding_scheme_e_type rpc_loc_ni_vx_requester_id_encoding_scheme_e_type;
+
+enum rpc_loc_ni_vx_pos_mode_e_type {
+ RPC_LOC_VX_MS_ASSISTED_ONLY = 1,
+ RPC_LOC_VX_MS_BASED_ONLY = 2,
+ RPC_LOC_VX_MS_ASSISTED_PREF_MSBASED_ALLWD = 3,
+ RPC_LOC_VX_MS_BASED_PREF_ASSISTED_ALLWD = 4,
+ RPC_LOC_VX_POS_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_vx_pos_mode_e_type rpc_loc_ni_vx_pos_mode_e_type;
+
+struct rpc_loc_ni_vx_requester_id_s_type {
+ u_char requester_id_length;
+ char requester_id[200];
+};
+typedef struct rpc_loc_ni_vx_requester_id_s_type rpc_loc_ni_vx_requester_id_s_type;
+
+struct rpc_loc_ni_vx_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char pos_qos_incl;
+ u_char pos_qos;
+ rpc_uint32 num_fixes;
+ rpc_uint32 tbf;
+ rpc_loc_ni_vx_pos_mode_e_type pos_mode;
+ rpc_loc_ni_vx_requester_id_encoding_scheme_e_type encoding_scheme;
+ rpc_loc_ni_vx_requester_id_s_type requester_id;
+ rpc_uint16 user_resp_timer_val;
+};
+typedef struct rpc_loc_ni_vx_notify_verify_req_s_type rpc_loc_ni_vx_notify_verify_req_s_type;
+
+enum rpc_loc_ni_supl_pos_method_e_type {
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED = 1,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED = 2,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETASSISTED_PREF = 3,
+ RPC_LOC_NI_POSMETHOD_AGPS_SETBASED_PREF = 4,
+ RPC_LOC_NI_POSMETHOD_AUTONOMOUS_GPS = 5,
+ RPC_LOC_NI_POSMETHOD_AFLT = 6,
+ RPC_LOC_NI_POSMETHOD_ECID = 7,
+ RPC_LOC_NI_POSMETHOD_EOTD = 8,
+ RPC_LOC_NI_POSMETHOD_OTDOA = 9,
+ RPC_LOC_NI_POSMETHOD_NO_POSITION = 10,
+ RPC_LOC_NI_POSMETHOD_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_supl_pos_method_e_type rpc_loc_ni_supl_pos_method_e_type;
+
+struct rpc_loc_ni_supl_slp_session_id_s_type {
+ u_char presence;
+ char session_id[4];
+ rpc_loc_server_info_s_type slp_address;
+};
+typedef struct rpc_loc_ni_supl_slp_session_id_s_type rpc_loc_ni_supl_slp_session_id_s_type;
+
+struct rpc_loc_ni_requestor_id_s_type {
+ u_char data_coding_scheme;
+ char requestor_id_string[200];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_requestor_id_s_type rpc_loc_ni_requestor_id_s_type;
+
+struct rpc_loc_ni_supl_client_name_s_type {
+ u_char data_coding_scheme;
+ char client_name_string[64];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_supl_client_name_s_type rpc_loc_ni_supl_client_name_s_type;
+
+struct rpc_loc_ni_supl_qop_s_type {
+ u_char bit_mask;
+ u_char horacc;
+ u_char veracc;
+ rpc_uint16 maxLocAge;
+ u_char delay;
+};
+typedef struct rpc_loc_ni_supl_qop_s_type rpc_loc_ni_supl_qop_s_type;
+
+struct rpc_loc_ni_supl_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ rpc_uint16 flags;
+ rpc_loc_ni_supl_slp_session_id_s_type supl_slp_session_id;
+ char supl_hash[8];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_supl_pos_method_e_type pos_method;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_supl_client_name_s_type client_name;
+ rpc_loc_ni_supl_qop_s_type supl_qop;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_supl_notify_verify_req_s_type rpc_loc_ni_supl_notify_verify_req_s_type;
+
+struct rpc_loc_ni_ext_client_address_s_type {
+ u_char ext_client_address_len;
+ char ext_client_address[20];
+};
+typedef struct rpc_loc_ni_ext_client_address_s_type rpc_loc_ni_ext_client_address_s_type;
+
+enum rpc_loc_ni_location_type_e_type {
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_LOCATION = 1,
+ RPC_LOC_NI_LOCATIONTYPE_CURRENT_OR_LAST_KNOWN_LOCATION = 2,
+ RPC_LOC_NI_LOCATIONTYPE_INITIAL_LOCATION = 3,
+ RPC_LOC_NI_LOCATIONTYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_location_type_e_type rpc_loc_ni_location_type_e_type;
+
+struct rpc_loc_ni_deferred_location_s_type {
+ u_char unused_bits;
+ u_char ms_available;
+};
+typedef struct rpc_loc_ni_deferred_location_s_type rpc_loc_ni_deferred_location_s_type;
+
+struct rpc_loc_ni_codeword_string_s_type {
+ u_char data_coding_scheme;
+ char lcs_codeword_string[20];
+ u_char string_len;
+};
+typedef struct rpc_loc_ni_codeword_string_s_type rpc_loc_ni_codeword_string_s_type;
+
+struct rpc_loc_ni_service_type_id_s_type {
+ u_char lcs_service_type_id;
+};
+typedef struct rpc_loc_ni_service_type_id_s_type rpc_loc_ni_service_type_id_s_type;
+
+struct rpc_loc_ni_umts_cp_notify_verify_req_s_type {
+ rpc_loc_ni_notify_verify_e_type notification_priv_type;
+ u_char invoke_id;
+ rpc_uint16 flags;
+ u_char notification_length;
+ char notification_text[64];
+ rpc_loc_ni_datacoding_scheme_e_type datacoding_scheme;
+ rpc_loc_ni_ext_client_address_s_type ext_client_address_data;
+ rpc_loc_ni_location_type_e_type location_type;
+ rpc_loc_ni_deferred_location_s_type deferred_location;
+ rpc_loc_ni_requestor_id_s_type requestor_id;
+ rpc_loc_ni_codeword_string_s_type codeword_string;
+ rpc_loc_ni_service_type_id_s_type service_type_id;
+ rpc_uint16 user_response_timer;
+};
+typedef struct rpc_loc_ni_umts_cp_notify_verify_req_s_type rpc_loc_ni_umts_cp_notify_verify_req_s_type;
+
+enum rpc_loc_ni_service_interaction_e_type {
+ RPC_LOC_NI_SERVICE_INTERACTION_ONGOING_NI_INCOMING_MO = 1,
+ RPC_LOC_NI_SERVICE_INTERACTION_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_service_interaction_e_type rpc_loc_ni_service_interaction_e_type;
+
+struct rpc_loc_ni_vx_service_interaction_req_s_type {
+ rpc_loc_ni_vx_notify_verify_req_s_type ni_vx_req;
+ rpc_loc_ni_service_interaction_e_type service_interation_type;
+};
+typedef struct rpc_loc_ni_vx_service_interaction_req_s_type rpc_loc_ni_vx_service_interaction_req_s_type;
+
+struct rpc_loc_ni_event_payload_u_type {
+ rpc_loc_ni_event_e_type disc;
+ union {
+ rpc_loc_ni_vx_notify_verify_req_s_type vx_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type supl_req;
+ rpc_loc_ni_umts_cp_notify_verify_req_s_type umts_cp_req;
+ rpc_loc_ni_vx_service_interaction_req_s_type service_interaction_req;
+ } rpc_loc_ni_event_payload_u_type_u;
+};
+typedef struct rpc_loc_ni_event_payload_u_type rpc_loc_ni_event_payload_u_type;
+
+struct rpc_loc_ni_event_s_type {
+ rpc_loc_ni_event_e_type event;
+ rpc_loc_ni_event_payload_u_type payload;
+};
+typedef struct rpc_loc_ni_event_s_type rpc_loc_ni_event_s_type;
+
+enum rpc_loc_assist_data_request_e_type {
+ RPC_LOC_ASSIST_DATA_TIME_REQ = 1,
+ RPC_LOC_ASSIST_DATA_PREDICTED_ORBITS_REQ = 2,
+ RPC_LOC_ASSIST_DATA_MAX = 268435456,
+};
+typedef enum rpc_loc_assist_data_request_e_type rpc_loc_assist_data_request_e_type;
+
+typedef char *rpc_struct_loc_time_download_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_time_download_source_s_type_servers_ptr rpc_struct_loc_time_download_source_s_type_servers[3];
+
+struct rpc_loc_time_download_source_s_type {
+ rpc_uint32 delay_threshold;
+ rpc_struct_loc_time_download_source_s_type_servers servers;
+};
+typedef struct rpc_loc_time_download_source_s_type rpc_loc_time_download_source_s_type;
+
+typedef char *rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr;
+
+typedef rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr rpc_struct_loc_predicted_orbits_data_source_s_type_servers[3];
+
+struct rpc_loc_predicted_orbits_data_source_s_type {
+ rpc_uint32 max_file_size;
+ rpc_uint32 max_part_size;
+ rpc_struct_loc_predicted_orbits_data_source_s_type_servers servers;
+};
+typedef struct rpc_loc_predicted_orbits_data_source_s_type rpc_loc_predicted_orbits_data_source_s_type;
+
+struct rpc_loc_assist_data_request_payload_u_type {
+ rpc_loc_assist_data_request_e_type disc;
+ union {
+ rpc_loc_time_download_source_s_type time_download;
+ rpc_loc_predicted_orbits_data_source_s_type data_download;
+ } rpc_loc_assist_data_request_payload_u_type_u;
+};
+typedef struct rpc_loc_assist_data_request_payload_u_type rpc_loc_assist_data_request_payload_u_type;
+
+struct rpc_loc_assist_data_request_s_type {
+ rpc_loc_assist_data_request_e_type event;
+ rpc_loc_assist_data_request_payload_u_type payload;
+};
+typedef struct rpc_loc_assist_data_request_s_type rpc_loc_assist_data_request_s_type;
+
+typedef rpc_uint32 rpc_loc_server_connection_handle;
+
+enum rpc_loc_server_protocol_e_type {
+ RPC_LOC_SERVER_PROTOCOL_DEFAULT = 0,
+ RPC_LOC_SERVER_PROTOCOL_SUPL = 1,
+ RPC_LOC_SERVER_PROTOCOL_VX_MPC = 2,
+ RPC_LOC_SERVER_PROTOCOL_VX_PDE = 3,
+ RPC_LOC_SERVER_PROTOCOL_MAX = 16777216,
+};
+typedef enum rpc_loc_server_protocol_e_type rpc_loc_server_protocol_e_type;
+
+enum rpc_loc_server_request_e_type {
+ RPC_LOC_SERVER_REQUEST_OPEN = 1,
+ RPC_LOC_SERVER_REQUEST_CLOSE = 2,
+ RPC_LOC_SERVER_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_server_request_e_type rpc_loc_server_request_e_type;
+
+struct rpc_loc_server_open_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_protocol_e_type protocol;
+};
+typedef struct rpc_loc_server_open_req_s_type rpc_loc_server_open_req_s_type;
+
+struct rpc_loc_server_close_req_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+};
+typedef struct rpc_loc_server_close_req_s_type rpc_loc_server_close_req_s_type;
+
+struct rpc_loc_server_request_u_type {
+ rpc_loc_server_request_e_type disc;
+ union {
+ rpc_loc_server_open_req_s_type open_req;
+ rpc_loc_server_close_req_s_type close_req;
+ } rpc_loc_server_request_u_type_u;
+};
+typedef struct rpc_loc_server_request_u_type rpc_loc_server_request_u_type;
+
+struct rpc_loc_server_request_s_type {
+ rpc_loc_server_request_e_type event;
+ rpc_loc_server_request_u_type payload;
+};
+typedef struct rpc_loc_server_request_s_type rpc_loc_server_request_s_type;
+
+enum rpc_loc_qwip_request_e_type {
+ RPC_LOC_QWIP_START_PERIODIC_HI_FREQ_FIXES = 0,
+ RPC_LOC_QWIP_START_PERIODIC_KEEP_WARM = 0 + 1,
+ RPC_LOC_QWIP_STOP_PERIODIC_FIXES = 0 + 2,
+ RPC_LOC_QWIP_SUSPEND = 0 + 3,
+ RPC_LOC_QWIP_REQUEST_MAX = 268435456,
+};
+typedef enum rpc_loc_qwip_request_e_type rpc_loc_qwip_request_e_type;
+
+struct rpc_loc_qwip_request_s_type {
+ rpc_loc_qwip_request_e_type request_type;
+ rpc_uint16 tbf_ms;
+};
+typedef struct rpc_loc_qwip_request_s_type rpc_loc_qwip_request_s_type;
+
+struct rpc_loc_reserved_payload_s_type {
+ rpc_uint16 data_size;
+ struct {
+ u_int data_len;
+ char *data_val;
+ } data;
+};
+typedef struct rpc_loc_reserved_payload_s_type rpc_loc_reserved_payload_s_type;
+
+enum rpc_loc_ioctl_e_type {
+ RPC_LOC_IOCTL_GET_API_VERSION = 1,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA = 2,
+ RPC_LOC_IOCTL_GET_FIX_CRITERIA = 3,
+ RPC_LOC_IOCTL_SERVICE_START_INDEX = 400,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE = 400,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA = 401,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_VALIDITY = 402,
+ RPC_LOC_IOCTL_QUERY_PREDICTED_ORBITS_DATA_SOURCE = 403,
+ RPC_LOC_IOCTL_SET_PREDICTED_ORBITS_DATA_AUTO_DOWNLOAD = 404,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME = 405,
+ RPC_LOC_IOCTL_INJECT_RTC_VALUE = 406,
+ RPC_LOC_IOCTL_INJECT_POSITION = 407,
+ RPC_LOC_IOCTL_QUERY_ENGINE_STATE = 408,
+ RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS = 409,
+ RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS = 410,
+ RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT = 411,
+ RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS = 412,
+ RPC_LOC_IOCTL_ACCESS_EFS_DATA = 413,
+ RPC_LOC_IOCTL_NV_SETTINGS_START_INDEX = 800,
+ RPC_LOC_IOCTL_SET_ENGINE_LOCK = 800,
+ RPC_LOC_IOCTL_GET_ENGINE_LOCK = 801,
+ RPC_LOC_IOCTL_SET_SBAS_CONFIG = 802,
+ RPC_LOC_IOCTL_GET_SBAS_CONFIG = 803,
+ RPC_LOC_IOCTL_SET_NMEA_TYPES = 804,
+ RPC_LOC_IOCTL_GET_NMEA_TYPES = 805,
+ RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR = 806,
+ RPC_LOC_IOCTL_GET_CDMA_PDE_SERVER_ADDR = 807,
+ RPC_LOC_IOCTL_SET_CDMA_MPC_SERVER_ADDR = 808,
+ RPC_LOC_IOCTL_GET_CDMA_MPC_SERVER_ADDR = 809,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR = 810,
+ RPC_LOC_IOCTL_GET_UMTS_SLP_SERVER_ADDR = 811,
+ RPC_LOC_IOCTL_SET_ON_DEMAND_LPM = 812,
+ RPC_LOC_IOCTL_GET_ON_DEMAND_LPM = 813,
+ RPC_LOC_IOCTL_PROPRIETARY_START_INDEX = 1000,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA = 1000,
+ RPC_LOC_IOCTL_SET_CUSTOM_PDE_SERVER_ADDR = 1001,
+ RPC_LOC_IOCTL_GET_CUSTOM_PDE_SERVER_ADDR = 1002,
+ RPC_LOC_IOCTL_THIRD_PARTY_START_INDEX = 1073741824,
+};
+typedef enum rpc_loc_ioctl_e_type rpc_loc_ioctl_e_type;
+
+struct rpc_loc_api_version_s_type {
+ u_char major;
+ u_char minor;
+};
+typedef struct rpc_loc_api_version_s_type rpc_loc_api_version_s_type;
+
+enum rpc_loc_fix_recurrence_e_type {
+ RPC_LOC_PERIODIC_FIX = 1,
+ RPC_LOC_SINGLE_FIX = 2,
+ RPC_LOC_FIX_SESSION_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_fix_recurrence_e_type rpc_loc_fix_recurrence_e_type;
+
+enum rpc_loc_operation_mode_e_type {
+ RPC_LOC_OPER_MODE_DEFAULT = 1,
+ RPC_LOC_OPER_MODE_MSB = 2,
+ RPC_LOC_OPER_MODE_MSA = 3,
+ RPC_LOC_OPER_MODE_STANDALONE = 4,
+ RPC_LOC_OPER_MODE_SPEED_OPTIMAL = 5,
+ RPC_LOC_OPER_MODE_ACCURACY_OPTIMAL = 6,
+ RPC_LOC_OPER_MODE_DATA_OPTIMAL = 7,
+ RPC_LOC_OPER_MODE_CELL_ID = 8,
+ RPC_LOC_OPER_MODE_MAX = 268435456,
+};
+typedef enum rpc_loc_operation_mode_e_type rpc_loc_operation_mode_e_type;
+
+enum rpc_loc_notify_e_type {
+ RPC_LOC_NOTIFY_ON_INTERVAL = 1,
+ RPC_LOC_NOTIFY_ON_DISTANCE = 2,
+ RPC_LOC_NOTIFY_ON_ANY = 3,
+ RPC_LOC_NOTIFY_ON_ALL = 4,
+ RPC_LOC_NOTIFY_TYPE_MAX = 268435456,
+};
+typedef enum rpc_loc_notify_e_type rpc_loc_notify_e_type;
+
+struct rpc_loc_fix_criteria_s_type {
+ rpc_uint32 valid_mask;
+ rpc_loc_fix_recurrence_e_type recurrence_type;
+ rpc_loc_operation_mode_e_type preferred_operation_mode;
+ rpc_uint32 preferred_accuracy;
+ rpc_uint32 preferred_response_time;
+ rpc_boolean intermediate_pos_report_enabled;
+ rpc_loc_notify_e_type notify_type;
+ rpc_uint32 min_interval;
+ float min_distance;
+ rpc_uint32 min_dist_sample_interval;
+};
+typedef struct rpc_loc_fix_criteria_s_type rpc_loc_fix_criteria_s_type;
+
+enum rpc_loc_ni_user_resp_e_type {
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT = 1,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY = 2,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP = 3,
+ RPC_LOC_NI_LCS_NOTIFY_VERIFY_MAX = 268435456,
+};
+typedef enum rpc_loc_ni_user_resp_e_type rpc_loc_ni_user_resp_e_type;
+
+struct rpc_loc_user_verify_s_type {
+ rpc_loc_ni_user_resp_e_type user_resp;
+ rpc_loc_ni_event_s_type ni_event_pass_back;
+};
+typedef struct rpc_loc_user_verify_s_type rpc_loc_user_verify_s_type;
+
+enum rpc_loc_predicted_orbits_data_format_e_type {
+ RPC_LOC_PREDICTED_ORBITS_XTRA = 0,
+ RPC_LOC_PREDICTED_ORBITS_FORMAT_MAX = 268435456,
+};
+typedef enum rpc_loc_predicted_orbits_data_format_e_type rpc_loc_predicted_orbits_data_format_e_type;
+
+struct rpc_loc_predicted_orbits_data_s_type {
+ rpc_loc_predicted_orbits_data_format_e_type format_type;
+ rpc_uint32 total_size;
+ rpc_uint8 total_parts;
+ rpc_uint8 part;
+ rpc_uint16 part_len;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+};
+typedef struct rpc_loc_predicted_orbits_data_s_type rpc_loc_predicted_orbits_data_s_type;
+
+struct rpc_loc_predicted_orbits_data_validity_report_s_type {
+ rpc_uint64 start_time_utc;
+ rpc_uint16 valid_duration_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_data_validity_report_s_type rpc_loc_predicted_orbits_data_validity_report_s_type;
+
+struct rpc_loc_predicted_orbits_auto_download_config_s_type {
+ rpc_boolean enable;
+ u_char auto_check_every_hrs;
+};
+typedef struct rpc_loc_predicted_orbits_auto_download_config_s_type rpc_loc_predicted_orbits_auto_download_config_s_type;
+
+struct rpc_loc_assist_data_time_s_type {
+ rpc_uint64 time_utc;
+ rpc_uint32 uncertainty;
+};
+typedef struct rpc_loc_assist_data_time_s_type rpc_loc_assist_data_time_s_type;
+
+typedef rpc_uint64 rpc_loc_assist_pos_valid_mask_type;
+
+struct rpc_loc_assist_data_pos_s_type {
+ rpc_loc_assist_pos_valid_mask_type valid_mask;
+ rpc_uint64 timestamp_utc;
+ double latitude;
+ double longitude;
+ float altitude_wrt_ellipsoid;
+ float altitude_wrt_mean_sea_level;
+ float hor_unc_circular;
+ float vert_unc;
+ u_char confidence_horizontal;
+ u_char confidence_vertical;
+ rpc_int32 timestamp_age;
+};
+typedef struct rpc_loc_assist_data_pos_s_type rpc_loc_assist_data_pos_s_type;
+
+enum rpc_loc_server_open_status_e_type {
+ RPC_LOC_SERVER_OPEN_SUCCESS = 1,
+ RPC_LOC_SERVER_OPEN_FAIL = 2,
+ RPC_LOC_SERVER_OPEN_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_open_status_e_type rpc_loc_server_open_status_e_type;
+
+struct rpc_loc_server_open_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_open_status_e_type open_status;
+ char apn_name[100];
+};
+typedef struct rpc_loc_server_open_status_s_type rpc_loc_server_open_status_s_type;
+
+enum rpc_loc_server_close_status_e_type {
+ RPC_LOC_SERVER_CLOSE_SUCCESS = 1,
+ RPC_LOC_SERVER_CLOSE_FAIL = 2,
+ RPC_LOC_SERVER_CLOSE_STATUS_MAX = 268435456,
+};
+typedef enum rpc_loc_server_close_status_e_type rpc_loc_server_close_status_e_type;
+
+struct rpc_loc_server_close_status_s_type {
+ rpc_loc_server_connection_handle conn_handle;
+ rpc_loc_server_close_status_e_type close_status;
+};
+typedef struct rpc_loc_server_close_status_s_type rpc_loc_server_close_status_s_type;
+
+struct rpc_loc_wiper_fix_time_s_type {
+ rpc_uint32 slow_clock_count;
+};
+typedef struct rpc_loc_wiper_fix_time_s_type rpc_loc_wiper_fix_time_s_type;
+
+struct rpc_loc_wiper_fix_pos_s_type {
+ rpc_int32 lat;
+ rpc_int32 lon;
+ rpc_uint16 HEPE;
+ rpc_uint8 num_of_aps_used;
+ rpc_uint8 fix_error_code;
+};
+typedef struct rpc_loc_wiper_fix_pos_s_type rpc_loc_wiper_fix_pos_s_type;
+
+struct rpc_loc_wiper_ap_info_s_type {
+ char mac_addr[6];
+ rpc_int32 rssi;
+ rpc_uint16 channel;
+ rpc_uint8 ap_qualifier;
+};
+typedef struct rpc_loc_wiper_ap_info_s_type rpc_loc_wiper_ap_info_s_type;
+
+struct rpc_loc_wiper_ap_set_s_type {
+ rpc_uint8 num_of_aps;
+ rpc_loc_wiper_ap_info_s_type ap_info[50];
+};
+typedef struct rpc_loc_wiper_ap_set_s_type rpc_loc_wiper_ap_set_s_type;
+
+struct rpc_loc_wiper_position_report_s_type {
+ rpc_uint8 wiper_valid_info_flag;
+ rpc_loc_wiper_fix_time_s_type wiper_fix_time;
+ rpc_loc_wiper_fix_pos_s_type wiper_fix_position;
+ rpc_loc_wiper_ap_set_s_type wiper_ap_set;
+};
+typedef struct rpc_loc_wiper_position_report_s_type rpc_loc_wiper_position_report_s_type;
+
+enum rpc_loc_wiper_status_e_type {
+ RPC_LOC_WIPER_STATUS_AVAILABLE = 1,
+ RPC_LOC_WIPER_STATUS_UNAVAILABLE = 2,
+ RPC_LOC_WIPER_STATUS_E_SIZE = 268435456,
+};
+typedef enum rpc_loc_wiper_status_e_type rpc_loc_wiper_status_e_type;
+
+enum rpc_loc_fs_operation_e_type {
+ RPC_LOC_FS_CREATE_WRITE_FILE = 1,
+ RPC_LOC_FS_APPEND_FILE = 2,
+ RPC_LOC_FS_DELETE_FILE = 3,
+ RPC_LOC_FS_READ_FILE = 4,
+ RPC_LOC_FS_MAX = 268435456,
+};
+typedef enum rpc_loc_fs_operation_e_type rpc_loc_fs_operation_e_type;
+
+struct rpc_loc_efs_data_s_type {
+ char filename[64];
+ rpc_loc_fs_operation_e_type operation;
+ rpc_uint32 total_size;
+ struct {
+ u_int data_ptr_len;
+ char *data_ptr_val;
+ } data_ptr;
+ rpc_uint32 part_len;
+ rpc_uint8 part;
+ rpc_uint8 total_parts;
+ rpc_uint32 reserved;
+};
+typedef struct rpc_loc_efs_data_s_type rpc_loc_efs_data_s_type;
+
+enum rpc_loc_lock_e_type {
+ RPC_LOC_LOCK_NONE = 1,
+ RPC_LOC_LOCK_MI = 2,
+ RPC_LOC_LOCK_MT = 3,
+ RPC_LOC_LOCK_ALL = 4,
+ RPC_LOC_LOCK_MAX = 268435456,
+};
+typedef enum rpc_loc_lock_e_type rpc_loc_lock_e_type;
+
+typedef rpc_uint32 rpc_loc_nmea_sentence_type;
+
+typedef rpc_uint32 rpc_loc_assist_data_type;
+
+struct rpc_loc_assist_data_delete_s_type {
+ rpc_loc_assist_data_type type;
+ rpc_uint32 reserved[8];
+};
+typedef struct rpc_loc_assist_data_delete_s_type rpc_loc_assist_data_delete_s_type;
+
+struct rpc_loc_ioctl_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_user_verify_s_type user_verify_resp;
+ rpc_loc_predicted_orbits_data_s_type predicted_orbits_data;
+ rpc_loc_predicted_orbits_auto_download_config_s_type predicted_orbits_auto_download;
+ rpc_loc_assist_data_time_s_type assistance_data_time;
+ rpc_loc_assist_data_pos_s_type assistance_data_position;
+ rpc_loc_server_open_status_s_type conn_open_status;
+ rpc_loc_server_close_status_s_type conn_close_status;
+ rpc_loc_wiper_position_report_s_type wiper_pos;
+ rpc_loc_wiper_status_e_type wiper_status;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_assist_data_delete_s_type assist_data_delete;
+ rpc_loc_efs_data_s_type efs_data;
+ } rpc_loc_ioctl_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_data_u_type rpc_loc_ioctl_data_u_type;
+
+struct rpc_loc_ioctl_callback_data_u_type {
+ rpc_loc_ioctl_e_type disc;
+ union {
+ rpc_loc_api_version_s_type api_version;
+ rpc_loc_fix_criteria_s_type fix_criteria;
+ rpc_loc_lock_e_type engine_lock;
+ rpc_boolean sbas_mode;
+ rpc_loc_nmea_sentence_type nmea_types;
+ rpc_boolean on_demand_lpm;
+ rpc_loc_server_info_s_type server_addr;
+ rpc_loc_predicted_orbits_data_source_s_type predicted_orbits_data_source;
+ rpc_loc_predicted_orbits_data_validity_report_s_type predicted_orbits_data_validity;
+ } rpc_loc_ioctl_callback_data_u_type_u;
+};
+typedef struct rpc_loc_ioctl_callback_data_u_type rpc_loc_ioctl_callback_data_u_type;
+
+struct rpc_loc_ioctl_callback_s_type {
+ rpc_loc_ioctl_e_type type;
+ rpc_int32 status;
+ rpc_loc_ioctl_callback_data_u_type data;
+};
+typedef struct rpc_loc_ioctl_callback_s_type rpc_loc_ioctl_callback_s_type;
+
+struct rpc_loc_event_payload_u_type {
+ u_quad_t disc;
+ union {
+ rpc_loc_parsed_position_s_type parsed_location_report;
+ rpc_loc_gnss_info_s_type gnss_report;
+ rpc_loc_nmea_report_s_type nmea_report;
+ rpc_loc_ni_event_s_type ni_request;
+ rpc_loc_assist_data_request_s_type assist_data_request;
+ rpc_loc_server_request_s_type loc_server_request;
+ rpc_loc_ioctl_callback_s_type ioctl_report;
+ rpc_loc_status_event_s_type status_report;
+ rpc_loc_qwip_request_s_type qwip_request;
+ rpc_loc_reserved_payload_s_type reserved;
+ } rpc_loc_event_payload_u_type_u;
+};
+typedef struct rpc_loc_event_payload_u_type rpc_loc_event_payload_u_type;
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_rpc_boolean (XDR *, rpc_boolean*);
+extern bool_t xdr_rpc_uint32 (XDR *, rpc_uint32*);
+extern bool_t xdr_rpc_uint16 (XDR *, rpc_uint16*);
+extern bool_t xdr_rpc_uint8 (XDR *, rpc_uint8*);
+extern bool_t xdr_rpc_int32 (XDR *, rpc_int32*);
+extern bool_t xdr_rpc_byte (XDR *, rpc_byte*);
+extern bool_t xdr_rpc_uint64 (XDR *, rpc_uint64*);
+extern bool_t xdr_rpc_loc_client_handle_type (XDR *, rpc_loc_client_handle_type*);
+extern bool_t xdr_rpc_loc_event_mask_type (XDR *, rpc_loc_event_mask_type*);
+extern bool_t xdr_rpc_loc_position_valid_mask_type (XDR *, rpc_loc_position_valid_mask_type*);
+extern bool_t xdr_rpc_loc_pos_technology_mask_type (XDR *, rpc_loc_pos_technology_mask_type*);
+extern bool_t xdr_rpc_loc_session_status_e_type (XDR *, rpc_loc_session_status_e_type*);
+extern bool_t xdr_rpc_loc_calendar_time_s_type (XDR *, rpc_loc_calendar_time_s_type*);
+extern bool_t xdr_rpc_loc_parsed_position_s_type (XDR *, rpc_loc_parsed_position_s_type*);
+extern bool_t xdr_rpc_loc_sv_system_e_type (XDR *, rpc_loc_sv_system_e_type*);
+extern bool_t xdr_rpc_loc_sv_status_e_type (XDR *, rpc_loc_sv_status_e_type*);
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type (XDR *, rpc_loc_sv_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_sv_info_s_type (XDR *, rpc_loc_sv_info_s_type*);
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type (XDR *, rpc_loc_gnss_info_valid_mask_type*);
+extern bool_t xdr_rpc_loc_gnss_info_s_type (XDR *, rpc_loc_gnss_info_s_type*);
+extern bool_t xdr_rpc_loc_nmea_report_s_type (XDR *, rpc_loc_nmea_report_s_type*);
+extern bool_t xdr_rpc_loc_status_event_e_type (XDR *, rpc_loc_status_event_e_type*);
+extern bool_t xdr_rpc_loc_engine_state_e_type (XDR *, rpc_loc_engine_state_e_type*);
+extern bool_t xdr_rpc_loc_fix_session_state_e_type (XDR *, rpc_loc_fix_session_state_e_type*);
+extern bool_t xdr_rpc_loc_status_event_payload_u_type (XDR *, rpc_loc_status_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_status_event_s_type (XDR *, rpc_loc_status_event_s_type*);
+extern bool_t xdr_rpc_loc_server_addr_e_type (XDR *, rpc_loc_server_addr_e_type*);
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type (XDR *, rpc_loc_server_addr_ipv4_type*);
+extern bool_t xdr_rpc_loc_server_addr_url_type (XDR *, rpc_loc_server_addr_url_type*);
+extern bool_t xdr_rpc_loc_server_addr_u_type (XDR *, rpc_loc_server_addr_u_type*);
+extern bool_t xdr_rpc_loc_server_info_s_type (XDR *, rpc_loc_server_info_s_type*);
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type (XDR *, rpc_loc_ni_notify_verify_e_type*);
+extern bool_t xdr_rpc_loc_ni_event_e_type (XDR *, rpc_loc_ni_event_e_type*);
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type (XDR *, rpc_loc_ni_datacoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type (XDR *, rpc_loc_ni_vx_requester_id_encoding_scheme_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type (XDR *, rpc_loc_ni_vx_pos_mode_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type (XDR *, rpc_loc_ni_vx_requester_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type (XDR *, rpc_loc_ni_vx_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type (XDR *, rpc_loc_ni_supl_pos_method_e_type*);
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type (XDR *, rpc_loc_ni_supl_slp_session_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type (XDR *, rpc_loc_ni_requestor_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type (XDR *, rpc_loc_ni_supl_client_name_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type (XDR *, rpc_loc_ni_supl_qop_s_type*);
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type (XDR *, rpc_loc_ni_supl_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type (XDR *, rpc_loc_ni_ext_client_address_s_type*);
+extern bool_t xdr_rpc_loc_ni_location_type_e_type (XDR *, rpc_loc_ni_location_type_e_type*);
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type (XDR *, rpc_loc_ni_deferred_location_s_type*);
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type (XDR *, rpc_loc_ni_codeword_string_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type (XDR *, rpc_loc_ni_service_type_id_s_type*);
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type (XDR *, rpc_loc_ni_umts_cp_notify_verify_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type (XDR *, rpc_loc_ni_service_interaction_e_type*);
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type (XDR *, rpc_loc_ni_vx_service_interaction_req_s_type*);
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type (XDR *, rpc_loc_ni_event_payload_u_type*);
+extern bool_t xdr_rpc_loc_ni_event_s_type (XDR *, rpc_loc_ni_event_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_e_type (XDR *, rpc_loc_assist_data_request_e_type*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr (XDR *, rpc_struct_loc_time_download_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers (XDR *, rpc_struct_loc_time_download_source_s_type_servers);
+extern bool_t xdr_rpc_loc_time_download_source_s_type (XDR *, rpc_loc_time_download_source_s_type*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr*);
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers (XDR *, rpc_struct_loc_predicted_orbits_data_source_s_type_servers);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type (XDR *, rpc_loc_predicted_orbits_data_source_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type (XDR *, rpc_loc_assist_data_request_payload_u_type*);
+extern bool_t xdr_rpc_loc_assist_data_request_s_type (XDR *, rpc_loc_assist_data_request_s_type*);
+extern bool_t xdr_rpc_loc_server_connection_handle (XDR *, rpc_loc_server_connection_handle*);
+extern bool_t xdr_rpc_loc_server_protocol_e_type (XDR *, rpc_loc_server_protocol_e_type*);
+extern bool_t xdr_rpc_loc_server_request_e_type (XDR *, rpc_loc_server_request_e_type*);
+extern bool_t xdr_rpc_loc_server_open_req_s_type (XDR *, rpc_loc_server_open_req_s_type*);
+extern bool_t xdr_rpc_loc_server_close_req_s_type (XDR *, rpc_loc_server_close_req_s_type*);
+extern bool_t xdr_rpc_loc_server_request_u_type (XDR *, rpc_loc_server_request_u_type*);
+extern bool_t xdr_rpc_loc_server_request_s_type (XDR *, rpc_loc_server_request_s_type*);
+extern bool_t xdr_rpc_loc_qwip_request_e_type (XDR *, rpc_loc_qwip_request_e_type*);
+extern bool_t xdr_rpc_loc_qwip_request_s_type (XDR *, rpc_loc_qwip_request_s_type*);
+extern bool_t xdr_rpc_loc_reserved_payload_s_type (XDR *, rpc_loc_reserved_payload_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_e_type (XDR *, rpc_loc_ioctl_e_type*);
+extern bool_t xdr_rpc_loc_api_version_s_type (XDR *, rpc_loc_api_version_s_type*);
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type (XDR *, rpc_loc_fix_recurrence_e_type*);
+extern bool_t xdr_rpc_loc_operation_mode_e_type (XDR *, rpc_loc_operation_mode_e_type*);
+extern bool_t xdr_rpc_loc_notify_e_type (XDR *, rpc_loc_notify_e_type*);
+extern bool_t xdr_rpc_loc_fix_criteria_s_type (XDR *, rpc_loc_fix_criteria_s_type*);
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type (XDR *, rpc_loc_ni_user_resp_e_type*);
+extern bool_t xdr_rpc_loc_user_verify_s_type (XDR *, rpc_loc_user_verify_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type (XDR *, rpc_loc_predicted_orbits_data_format_e_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type (XDR *, rpc_loc_predicted_orbits_data_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type (XDR *, rpc_loc_predicted_orbits_data_validity_report_s_type*);
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type (XDR *, rpc_loc_predicted_orbits_auto_download_config_s_type*);
+extern bool_t xdr_rpc_loc_assist_data_time_s_type (XDR *, rpc_loc_assist_data_time_s_type*);
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type (XDR *, rpc_loc_assist_pos_valid_mask_type*);
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type (XDR *, rpc_loc_assist_data_pos_s_type*);
+extern bool_t xdr_rpc_loc_server_open_status_e_type (XDR *, rpc_loc_server_open_status_e_type*);
+extern bool_t xdr_rpc_loc_server_open_status_s_type (XDR *, rpc_loc_server_open_status_s_type*);
+extern bool_t xdr_rpc_loc_server_close_status_e_type (XDR *, rpc_loc_server_close_status_e_type*);
+extern bool_t xdr_rpc_loc_server_close_status_s_type (XDR *, rpc_loc_server_close_status_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type (XDR *, rpc_loc_wiper_fix_time_s_type*);
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type (XDR *, rpc_loc_wiper_fix_pos_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type (XDR *, rpc_loc_wiper_ap_info_s_type*);
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type (XDR *, rpc_loc_wiper_ap_set_s_type*);
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type (XDR *, rpc_loc_wiper_position_report_s_type*);
+extern bool_t xdr_rpc_loc_wiper_status_e_type (XDR *, rpc_loc_wiper_status_e_type*);
+extern bool_t xdr_rpc_loc_fs_operation_e_type (XDR *, rpc_loc_fs_operation_e_type*);
+extern bool_t xdr_rpc_loc_efs_data_s_type (XDR *, rpc_loc_efs_data_s_type*);
+extern bool_t xdr_rpc_loc_lock_e_type (XDR *, rpc_loc_lock_e_type*);
+extern bool_t xdr_rpc_loc_nmea_sentence_type (XDR *, rpc_loc_nmea_sentence_type*);
+extern bool_t xdr_rpc_loc_assist_data_type (XDR *, rpc_loc_assist_data_type*);
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type (XDR *, rpc_loc_assist_data_delete_s_type*);
+extern bool_t xdr_rpc_loc_ioctl_data_u_type (XDR *, rpc_loc_ioctl_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type (XDR *, rpc_loc_ioctl_callback_data_u_type*);
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type (XDR *, rpc_loc_ioctl_callback_s_type*);
+extern bool_t xdr_rpc_loc_event_payload_u_type (XDR *, rpc_loc_event_payload_u_type*);
+
+#else /* K&R C */
+extern bool_t xdr_rpc_boolean ();
+extern bool_t xdr_rpc_uint32 ();
+extern bool_t xdr_rpc_uint16 ();
+extern bool_t xdr_rpc_uint8 ();
+extern bool_t xdr_rpc_int32 ();
+extern bool_t xdr_rpc_byte ();
+extern bool_t xdr_rpc_uint64 ();
+extern bool_t xdr_rpc_loc_client_handle_type ();
+extern bool_t xdr_rpc_loc_event_mask_type ();
+extern bool_t xdr_rpc_loc_position_valid_mask_type ();
+extern bool_t xdr_rpc_loc_pos_technology_mask_type ();
+extern bool_t xdr_rpc_loc_session_status_e_type ();
+extern bool_t xdr_rpc_loc_calendar_time_s_type ();
+extern bool_t xdr_rpc_loc_parsed_position_s_type ();
+extern bool_t xdr_rpc_loc_sv_system_e_type ();
+extern bool_t xdr_rpc_loc_sv_status_e_type ();
+extern bool_t xdr_rpc_loc_sv_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_sv_info_s_type ();
+extern bool_t xdr_rpc_loc_gnss_info_valid_mask_type ();
+extern bool_t xdr_rpc_loc_gnss_info_s_type ();
+extern bool_t xdr_rpc_loc_nmea_report_s_type ();
+extern bool_t xdr_rpc_loc_status_event_e_type ();
+extern bool_t xdr_rpc_loc_engine_state_e_type ();
+extern bool_t xdr_rpc_loc_fix_session_state_e_type ();
+extern bool_t xdr_rpc_loc_status_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_status_event_s_type ();
+extern bool_t xdr_rpc_loc_server_addr_e_type ();
+extern bool_t xdr_rpc_loc_server_addr_ipv4_type ();
+extern bool_t xdr_rpc_loc_server_addr_url_type ();
+extern bool_t xdr_rpc_loc_server_addr_u_type ();
+extern bool_t xdr_rpc_loc_server_info_s_type ();
+extern bool_t xdr_rpc_loc_ni_notify_verify_e_type ();
+extern bool_t xdr_rpc_loc_ni_event_e_type ();
+extern bool_t xdr_rpc_loc_ni_datacoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_encoding_scheme_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_pos_mode_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_requester_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_vx_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_pos_method_e_type ();
+extern bool_t xdr_rpc_loc_ni_supl_slp_session_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_requestor_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_client_name_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_qop_s_type ();
+extern bool_t xdr_rpc_loc_ni_supl_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_ext_client_address_s_type ();
+extern bool_t xdr_rpc_loc_ni_location_type_e_type ();
+extern bool_t xdr_rpc_loc_ni_deferred_location_s_type ();
+extern bool_t xdr_rpc_loc_ni_codeword_string_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_type_id_s_type ();
+extern bool_t xdr_rpc_loc_ni_umts_cp_notify_verify_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_service_interaction_e_type ();
+extern bool_t xdr_rpc_loc_ni_vx_service_interaction_req_s_type ();
+extern bool_t xdr_rpc_loc_ni_event_payload_u_type ();
+extern bool_t xdr_rpc_loc_ni_event_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_e_type ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_time_download_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_time_download_source_s_type ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers_ptr ();
+extern bool_t xdr_rpc_struct_loc_predicted_orbits_data_source_s_type_servers ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_source_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_payload_u_type ();
+extern bool_t xdr_rpc_loc_assist_data_request_s_type ();
+extern bool_t xdr_rpc_loc_server_connection_handle ();
+extern bool_t xdr_rpc_loc_server_protocol_e_type ();
+extern bool_t xdr_rpc_loc_server_request_e_type ();
+extern bool_t xdr_rpc_loc_server_open_req_s_type ();
+extern bool_t xdr_rpc_loc_server_close_req_s_type ();
+extern bool_t xdr_rpc_loc_server_request_u_type ();
+extern bool_t xdr_rpc_loc_server_request_s_type ();
+extern bool_t xdr_rpc_loc_qwip_request_e_type ();
+extern bool_t xdr_rpc_loc_qwip_request_s_type ();
+extern bool_t xdr_rpc_loc_reserved_payload_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_e_type ();
+extern bool_t xdr_rpc_loc_api_version_s_type ();
+extern bool_t xdr_rpc_loc_fix_recurrence_e_type ();
+extern bool_t xdr_rpc_loc_operation_mode_e_type ();
+extern bool_t xdr_rpc_loc_notify_e_type ();
+extern bool_t xdr_rpc_loc_fix_criteria_s_type ();
+extern bool_t xdr_rpc_loc_ni_user_resp_e_type ();
+extern bool_t xdr_rpc_loc_user_verify_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_format_e_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_data_validity_report_s_type ();
+extern bool_t xdr_rpc_loc_predicted_orbits_auto_download_config_s_type ();
+extern bool_t xdr_rpc_loc_assist_data_time_s_type ();
+extern bool_t xdr_rpc_loc_assist_pos_valid_mask_type ();
+extern bool_t xdr_rpc_loc_assist_data_pos_s_type ();
+extern bool_t xdr_rpc_loc_server_open_status_e_type ();
+extern bool_t xdr_rpc_loc_server_open_status_s_type ();
+extern bool_t xdr_rpc_loc_server_close_status_e_type ();
+extern bool_t xdr_rpc_loc_server_close_status_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_time_s_type ();
+extern bool_t xdr_rpc_loc_wiper_fix_pos_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_info_s_type ();
+extern bool_t xdr_rpc_loc_wiper_ap_set_s_type ();
+extern bool_t xdr_rpc_loc_wiper_position_report_s_type ();
+extern bool_t xdr_rpc_loc_wiper_status_e_type ();
+extern bool_t xdr_rpc_loc_fs_operation_e_type ();
+extern bool_t xdr_rpc_loc_efs_data_s_type ();
+extern bool_t xdr_rpc_loc_lock_e_type ();
+extern bool_t xdr_rpc_loc_nmea_sentence_type ();
+extern bool_t xdr_rpc_loc_assist_data_type ();
+extern bool_t xdr_rpc_loc_assist_data_delete_s_type ();
+extern bool_t xdr_rpc_loc_ioctl_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_data_u_type ();
+extern bool_t xdr_rpc_loc_ioctl_callback_s_type ();
+extern bool_t xdr_rpc_loc_event_payload_u_type ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_LOC_API_COMMON_H_RPCGEN */
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_api_fixup.h b/loc_api/libloc_api-rpc/inc-50000/loc_api_fixup.h
new file mode 100644
index 0000000..fab559b
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_api_fixup.h
@@ -0,0 +1,209 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LOC_API_FIXUP_H
+#define LOC_API_FIXUP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef NULLPROC
+#define NULLPROC 0
+#endif /* NULLPROC */
+
+#ifdef ADD_XDR_FLOAT
+
+extern bool_t xdr_float (XDR *__xdrs, float *__fp);
+extern bool_t xdr_double (XDR *__xdrs, double *__dp);
+
+#endif /* ADD_XDR_FLOAT */
+
+#ifdef ADD_XDR_BOOL
+extern bool_t xdr_bool(XDR *__xdrs, int *__bp);
+#endif /* ADD_XDR_BOOL */
+
+#define RPC_LOC_API_MAJOR_VERSION_NUMBER 1
+#define RPC_LOC_API_MINOR_VERSION_NUMBER 0
+
+// Return value for loc_open in case of failure.
+#define RPC_LOC_CLIENT_HANDLE_INVALID -1
+
+// Return value of loc api calls for loc_close, loc_start_fix, loc_stop_fix and loc_ioctl
+// These are also the status for the ioctl callback
+#define RPC_LOC_API_SUCCESS 0
+#define RPC_LOC_API_GENERAL_FAILURE 1
+#define RPC_LOC_API_UNSUPPORTED 2
+#define RPC_LOC_API_INVALID_HANDLE 4
+#define RPC_LOC_API_INVALID_PARAMETER 5
+#define RPC_LOC_API_ENGINE_BUSY 6
+#define RPC_LOC_API_PHONE_OFFLINE 7
+#define RPC_LOC_API_TIMEOUT 8
+
+// Special return value for loc api calls in case of RCP failure
+#define RPC_LOC_API_RPC_FAILURE (-1234)
+
+#define RPC_LOC_API_MAX_SV_COUNT 80
+#define RPC_LOC_API_MAX_NMEA_STRING_LENGTH 1200
+
+// Maximum server address that will be used in location API
+#define RPC_LOC_API_MAX_SERVER_ADDR_LENGTH 256
+#define RPC_LOC_API_MAX_NUM_PREDICTED_ORBITS_SERVERS 3
+#define RPC_LOC_API_MAX_NUM_NTP_SERVERS 3
+
+#define RPC_LOC_EVENT_PARSED_POSITION_REPORT 0x00000001 // Position report comes in loc_parsed_position_s_type
+#define RPC_LOC_EVENT_SATELLITE_REPORT 0x00000002 // Satellite in view report
+#define RPC_LOC_EVENT_NMEA_1HZ_REPORT 0x00000004 // NMEA report at 1HZ rate
+#define RPC_LOC_EVENT_NMEA_POSITION_REPORT 0x00000008 // NMEA report at position report rate
+#define RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST 0x00000010 // NI notification/verification request
+#define RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST 0x00000020 // Assistance data, eg: time, predicted orbits request
+#define RPC_LOC_EVENT_LOCATION_SERVER_REQUEST 0x00000040 // Request for location server
+#define RPC_LOC_EVENT_IOCTL_REPORT 0x00000080 // Callback report for loc_ioctl
+#define RPC_LOC_EVENT_STATUS_REPORT 0x00000100 // Misc status report: eg, engine state
+
+#define RPC_LOC_POS_VALID_SESSION_STATUS 0x00000001
+#define RPC_LOC_POS_VALID_TIMESTAMP_CALENDAR 0x00000002
+#define RPC_LOC_POS_VALID_TIMESTAMP_UTC 0x00000004
+#define RPC_LOC_POS_VALID_LEAP_SECONDS 0x00000008
+#define RPC_LOC_POS_VALID_TIME_UNC 0x00000010
+#define RPC_LOC_POS_VALID_LATITUDE 0x00000020
+#define RPC_LOC_POS_VALID_LONGITUDE 0x00000040
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000080
+#define RPC_LOC_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000100
+#define RPC_LOC_POS_VALID_SPEED_HORIZONTAL 0x00000200
+#define RPC_LOC_POS_VALID_SPEED_VERTICAL 0x00000400
+#define RPC_LOC_POS_VALID_HEADING 0x00000800
+#define RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR 0x00001000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MAJ 0x00002000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_SEMI_MIN 0x00004000
+#define RPC_LOC_POS_VALID_HOR_UNC_ELLI_ORIENT_AZIMUTH 0x00008000
+#define RPC_LOC_POS_VALID_VERTICAL_UNC 0x00010000
+#define RPC_LOC_POS_VALID_SPEED_UNC 0x00020000
+#define RPC_LOC_POS_VALID_HEADING_UNC 0x00040000
+#define RPC_LOC_POS_VALID_CONFIDENCE_HORIZONTAL 0x00080000
+#define RPC_LOC_POS_VALID_CONFIDENCE_VERTICAL 0x00100000
+#define RPC_LOC_POS_VALID_MAGNETIC_VARIATION 0x00200000
+#define RPC_LOC_POS_VALID_TECHNOLOGY_MASK 0x00400000
+
+#define RPC_LOC_POS_TECH_SATELLITE 0x00000001
+#define RPC_LOC_POS_TECH_CELLID 0x00000002
+#define RPC_LOC_POS_TECH_WIFI 0x00000004
+
+#define RPC_LOC_SV_INFO_VALID_SYSTEM 0x00000001
+#define RPC_LOC_SV_INFO_VALID_PRN 0x00000002
+#define RPC_LOC_SV_INFO_VALID_HEALTH_STATUS 0x00000004
+#define RPC_LOC_SV_INFO_VALID_PROCESS_STATUS 0x00000008
+#define RPC_LOC_SV_INFO_VALID_HAS_EPH 0x00000010
+#define RPC_LOC_SV_INFO_VALID_HAS_ALM 0x00000020
+#define RPC_LOC_SV_INFO_VALID_ELEVATION 0x00000040
+#define RPC_LOC_SV_INFO_VALID_AZIMUTH 0x00000080
+#define RPC_LOC_SV_INFO_VALID_SNR 0x00000100
+
+#define RPC_LOC_GNSS_INFO_VALID_POS_DOP 0x00000001
+#define RPC_LOC_GNSS_INFO_VALID_HOR_DOP 0x00000002
+#define RPC_LOC_GNSS_INFO_VALID_VERT_DOP 0x00000004
+#define RPC_LOC_GNSS_INFO_VALID_ALTITUDE_ASSUMED 0x00000008
+#define RPC_LOC_GNSS_INFO_VALID_SV_COUNT 0x00000010
+#define RPC_LOC_GNSS_INFO_VALID_SV_LIST 0x00000020
+
+#define RPC_LOC_NI_MAX_REQUESTOR_ID_LENGTH 200
+#define RPC_LOC_NI_SUPL_HASH_LENGTH 8
+#define RPC_LOC_NI_SUPL_SLP_SESSION_ID_BYTE_LENGTH 4
+#define RPC_LOC_NI_MAX_CLIENT_NAME_LENGTH 64
+#define RPC_LOC_NI_MAX_EXT_CLIENT_ADDRESS 20
+#define RPC_LOC_NI_CODEWORD_LENGTH 20
+
+#define RPC_LOC_NI_SUPL_QOP_VALID 0x01
+#define RPC_LOC_NI_SUPL_QOP_VERACC_VALID 0x02
+#define RPC_LOC_NI_SUPL_QOP_MAXAGE_VALID 0x04
+#define RPC_LOC_NI_SUPL_QOP_DELAY_VALID 0x08
+
+#define RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE 0x00000001
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 0x00000002
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY 0x00000004
+#define RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME 0x00000008
+#define RPC_LOC_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED 0x00000010
+#define RPC_LOC_FIX_CRIT_VALID_NOTIFY_TYPE 0x00000020
+#define RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL 0x00000040
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DISTANCE 0x00000080
+#define RPC_LOC_FIX_CRIT_VALID_MIN_DIST_SAMPLE_INTERVAL 0x00000100
+
+#define RPC_LOC_ASSIST_POS_VALID_TIMESTAMP_UTC 0x00000001
+#define RPC_LOC_ASSIST_POS_VALID_LATITUDE 0x00000002
+#define RPC_LOC_ASSIST_POS_VALID_LONGITUDE 0x00000004
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_ELLIPSOID 0x00000008
+#define RPC_LOC_ASSIST_POS_VALID_ALTITUDE_WRT_MEAN_SEA_LEVEL 0x00000010
+#define RPC_LOC_ASSIST_POS_VALID_HOR_UNC_CIRCULAR 0x00000020
+#define RPC_LOC_ASSIST_POS_VALID_VERT_UNC 0x00000040
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_HORIZONTAL 0x00000080
+#define RPC_LOC_ASSIST_POS_VALID_CONFIDENCE_VERTICAL 0x00000100
+#define RPC_LOC_ASSIST_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
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_FIXUP_H */
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_api_rpc_glue.h b/loc_api/libloc_api-rpc/inc-50000/loc_api_rpc_glue.h
new file mode 100644
index 0000000..3a7bfff
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_api_rpc_glue.h
@@ -0,0 +1,99 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * 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 "rpc_inc/loc_api_fixup.h"
+#include "rpc_inc/loc_api_sync_call.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)(
+ rpc_loc_client_handle_type loc_handle, /* handle of the client */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern rpc_loc_client_handle_type loc_open(
+ rpc_loc_event_mask_type event_reg_mask,
+ loc_event_cb_f_type *event_callback
+);
+
+extern int32 loc_close
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_start_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_stop_fix
+(
+ rpc_loc_client_handle_type handle
+);
+
+extern int32 loc_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_RPC_GLUE_H */
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_api_sync_call.h b/loc_api/libloc_api-rpc/inc-50000/loc_api_sync_call.h
new file mode 100644
index 0000000..582b95b
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_api_sync_call.h
@@ -0,0 +1,105 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * 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_BUFFER_SIZE 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 loc_cb_is_selected; /* is cb selected? */
+ boolean loc_cb_is_waiting; /* is waiting? */
+ boolean loc_cb_has_arrived; /* callback has arrived */
+ 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_data_s_type;
+
+typedef struct {
+ pthread_mutex_t lock;
+ int size;
+ boolean in_use; /* at least one sync call is active */
+ boolean slot_in_use[LOC_SYNC_CALL_BUFFER_SIZE];
+ loc_sync_call_data_s_type slots[LOC_SYNC_CALL_BUFFER_SIZE];
+} loc_sync_call_data_array_s_type;
+
+/* Init function */
+extern void loc_api_sync_call_init();
+
+/* Select the callback to wait for, e.g., IOCTL REPORT */
+extern int loc_api_select_callback(
+ 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 */
+);
+
+/* Wait for the call back after an API call, returns 0 if successful */
+extern 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 */
+);
+
+/* Process Loc API callbacks to wake up blocked user threads */
+extern 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 */
+extern int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/loc_api/libloc_api-rpc/inc-50000/loc_apicb_appinit.h b/loc_api/libloc_api-rpc/inc-50000/loc_apicb_appinit.h
new file mode 100644
index 0000000..8dbcb9a
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc-50000/loc_apicb_appinit.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef LOC_APICB_APPINIT_H
+#define LOC_APICB_APPINIT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /* Initialization function for callbacks */
+extern int loc_apicb_app_init();
+extern void loc_apicb_app_deinit();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_APICB_APPINIT_H */
diff --git a/loc_api/libloc_api-rpc/inc/loc_api_sync_call.h b/loc_api/libloc_api-rpc/inc/loc_api_sync_call.h
new file mode 100644
index 0000000..adec248
--- /dev/null
+++ b/loc_api/libloc_api-rpc/inc/loc_api_sync_call.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * 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_BUFFER_SIZE 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 loc_cb_is_selected; /* is cb selected? */
+ boolean loc_cb_is_waiting; /* is waiting? */
+ boolean loc_cb_has_arrived; /* callback has arrived */
+ 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_data_s_type;
+
+typedef struct {
+ pthread_mutex_t lock;
+ pthread_cond_t loc_cb_arrived_cond;
+ int size;
+ boolean in_use; /* at least one sync call is active */
+ boolean slot_in_use[LOC_SYNC_CALL_BUFFER_SIZE];
+ loc_sync_call_data_s_type slots[LOC_SYNC_CALL_BUFFER_SIZE];
+} loc_sync_call_data_array_s_type;
+
+/* Init function */
+extern void loc_api_sync_call_init();
+
+/* Select the callback to wait for, e.g., IOCTL REPORT */
+extern int loc_api_select_callback(
+ 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 */
+);
+
+/* Wait for the call back after an API call, returns 0 if successful */
+extern 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 */
+);
+
+/* Process Loc API callbacks to wake up blocked user threads */
+extern 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 */
+extern int loc_api_sync_ioctl
+(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type,
+ rpc_loc_ioctl_data_u_type* ioctl_data_ptr,
+ uint32 timeout_msec,
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LOC_API_CB_SYNC_H */
diff --git a/loc_api/libloc_api-rpc/src/loc_api_sync_call.c b/loc_api/libloc_api-rpc/src/loc_api_sync_call.c
new file mode 100644
index 0000000..e8e28a5
--- /dev/null
+++ b/loc_api/libloc_api-rpc/src/loc_api_sync_call.c
@@ -0,0 +1,532 @@
+/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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 "loc_api_rpc_glue"
+// #define LOG_NDDEBUG 0
+#include <utils/Log.h>
+
+/***************************************************************************
+ * DATA FOR ASYNCHRONOUS RPC PROCESSING
+ **************************************************************************/
+loc_sync_call_data_array_s_type loc_sync_data;
+
+/*===========================================================================
+
+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_init(&loc_sync_data.lock, NULL);
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ pthread_cond_init(&loc_sync_data.loc_cb_arrived_cond, NULL);
+
+ loc_sync_data.size = LOC_SYNC_CALL_BUFFER_SIZE;
+ loc_sync_data.in_use = FALSE;
+
+ memset(loc_sync_data.slot_in_use, 0, sizeof loc_sync_data.slot_in_use);
+
+ int i;
+ for (i = 0; i < loc_sync_data.size; i++)
+ {
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[i];
+
+ pthread_mutex_init(&slot->lock, NULL);
+ pthread_cond_init(&slot->loc_cb_arrived_cond, NULL);
+
+ slot->loc_handle = -1;
+ slot->loc_cb_is_selected = FALSE; /* is cb selected? */
+ slot->loc_cb_is_waiting = FALSE; /* is waiting? */
+ slot->loc_cb_has_arrived = FALSE; /* callback has arrived */
+ slot->loc_cb_wait_event_mask = 0; /* event to wait */
+ slot->loc_cb_received_event_mask = 0; /* received event */
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+}
+
+/*===========================================================================
+
+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->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 */
+)
+{
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ if (!loc_sync_data.in_use)
+ {
+ pthread_mutex_unlock(&loc_sync_data.lock);
+ return;
+ }
+
+ loc_sync_call_data_s_type *slot;
+ boolean in_use = FALSE, consumed = FALSE;
+ int i;
+
+ for (i = 0; i < loc_sync_data.size && !consumed; i++)
+ {
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[i];
+ in_use |= loc_sync_data.slot_in_use[i];
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (loc_sync_data.slot_in_use[i] &&
+ slot->loc_handle == loc_handle &&
+ loc_match_callback(slot->loc_cb_wait_event_mask, slot->ioctl_type, loc_event, loc_event_payload) &&
+ !slot->loc_cb_has_arrived)
+ {
+ memcpy(&slot->loc_cb_received_payload, loc_event_payload, sizeof (rpc_loc_event_payload_u_type));
+ consumed = TRUE;
+
+ /* Received a callback while waiting, wake up thread to check it */
+ if (slot->loc_cb_is_waiting)
+ {
+ slot->loc_cb_received_event_mask = loc_event;
+ pthread_cond_signal(&slot->loc_cb_arrived_cond);
+ }
+ else {
+ /* If callback arrives before wait, remember it */
+ slot->loc_cb_has_arrived = TRUE;
+ }
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+ }
+
+ if (!in_use) {
+ loc_sync_data.in_use = FALSE;
+ }
+
+ pthread_cond_signal(&loc_sync_data.loc_cb_arrived_cond);
+ pthread_mutex_unlock(&loc_sync_data.lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_alloc_slot
+
+DESCRIPTION
+ Allocates a buffer slot for the synchronous API call
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ Select ID (>=0) : successful
+ -1 : buffer full
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_alloc_slot()
+{
+ int i, select_id = -1; /* no free buffer */
+
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ for (i = 0; i < loc_sync_data.size; i++)
+ {
+ if (!loc_sync_data.slot_in_use[i])
+ {
+ select_id = i;
+ loc_sync_data.slot_in_use[i] = 1;
+ loc_sync_data.in_use = TRUE;
+ break;
+ }
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+
+ return select_id;
+}
+
+/*===========================================================================
+
+FUNCTION loc_free_slot
+
+DESCRIPTION
+ Frees a buffer slot after the synchronous API call
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_free_slot(int select_id)
+{
+ pthread_mutex_lock(&loc_sync_data.lock);
+
+ loc_sync_data.slot_in_use[select_id] = 0;
+
+ int i;
+ for (i = 0; i < loc_sync_data.size; i++)
+ {
+ if (loc_sync_data.slot_in_use[i]) break;
+ }
+
+ if (i >= loc_sync_data.size)
+ {
+ loc_sync_data.in_use = FALSE;
+ }
+
+ pthread_mutex_unlock(&loc_sync_data.lock);
+}
+
+/*===========================================================================
+
+FUNCTION loc_api_select_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
+
+===========================================================================*/
+int loc_api_select_callback(
+ 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 */
+)
+{
+ int select_id = loc_alloc_slot();
+
+ if (select_id < 0)
+ {
+ LOGE("loc_select_callback: buffer full for this synchronous Loc API call, mask: 0x%x",
+ (unsigned) event_mask);
+ return -1;
+ }
+
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[select_id];
+
+ pthread_mutex_lock(&slot->lock);
+
+ slot->loc_handle = loc_handle;
+ slot->loc_cb_is_selected = TRUE;
+ slot->loc_cb_is_waiting = FALSE;
+ slot->loc_cb_has_arrived = FALSE;
+
+ 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;
+
+ pthread_mutex_unlock(&slot->lock);
+
+ return select_id;
+}
+
+/*===========================================================================
+
+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
+
+===========================================================================*/
+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 */
+)
+{
+ if (select_id < 0 || select_id >= loc_sync_data.size || !loc_sync_data.slot_in_use[select_id])
+ {
+ LOGE("loc_wait_callback: invalid select_id: %d", select_id);
+ return RPC_LOC_API_INVALID_PARAMETER;
+ }
+
+ loc_sync_call_data_s_type *slot = &loc_sync_data.slots[select_id];
+
+ int ret_val = RPC_LOC_API_SUCCESS; /* the return value of this function: 0 = no error */
+ int rc; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ pthread_mutex_lock(&slot->lock);
+
+ if (slot->loc_cb_has_arrived)
+ {
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ pthread_mutex_unlock(&slot->lock);
+ loc_free_slot(select_id);
+ ret_val = RPC_LOC_API_SUCCESS;
+ return ret_val; /* success */
+ }
+
+ if (slot->loc_cb_is_waiting)
+ {
+ pthread_mutex_unlock(&slot->lock);
+ loc_free_slot(select_id);
+ ret_val = RPC_LOC_API_ENGINE_BUSY; /* busy, rejected */
+ LOGE("loc_wait_callback: already waiting on select_id: %d\n", select_id);
+ return ret_val; /* exit */
+ }
+
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ expire_time.tv_sec += timeout_seconds;
+
+ /* Take new wait request */
+ slot->loc_cb_is_waiting = TRUE;
+
+ /* Waiting */
+ rc = pthread_cond_timedwait(&slot->loc_cb_arrived_cond,
+ &slot->lock, &expire_time);
+
+ if (rc == ETIMEDOUT)
+ {
+ slot->loc_cb_is_waiting = FALSE;
+ ret_val = RPC_LOC_API_TIMEOUT; /* Timed out */
+ }
+ else {
+ /* Obtained the first awaited callback */
+ slot->loc_cb_is_waiting = FALSE; /* stop waiting */
+ ret_val = RPC_LOC_API_SUCCESS; /* Successful */
+ loc_save_user_payload(callback_payload, ioctl_payload, &slot->loc_cb_received_payload);
+ }
+
+ pthread_mutex_unlock(&slot->lock);
+
+ loc_free_slot(select_id);
+
+ 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 = RPC_LOC_API_ENGINE_BUSY;
+ int select_id;
+ rpc_loc_ioctl_callback_s_type callback_data;
+
+ // Select the callback we are waiting for
+ select_id = loc_api_select_callback(handle, 0, ioctl_type);
+
+ if (select_id >= 0)
+ {
+ pthread_mutex_lock(&loc_sync_data.lock);
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+ while (rc == RPC_LOC_API_ENGINE_BUSY)
+ {
+ /* TODO: Use timeout? */
+ LOGD("loc_api_sync_ioctl: select_id = %d, engine busy, waiting...\n", select_id);
+ pthread_cond_wait(&loc_sync_data.loc_cb_arrived_cond, &loc_sync_data.lock);
+ rc = loc_ioctl(handle, ioctl_type, ioctl_data_ptr);
+ }
+ pthread_mutex_unlock(&loc_sync_data.lock);
+ LOGV("loc_api_sync_ioctl: select_id = %d, loc_ioctl returned %d\n", select_id, rc);
+
+ if (rc != RPC_LOC_API_SUCCESS)
+ {
+ LOGE("loc_api_sync_ioctl: select_id = %d, loc_ioctl returned %d\n", select_id, rc);
+ loc_free_slot(select_id);
+ }
+ else {
+ // 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
+ LOGE("loc_api_sync_ioctl: loc_api_wait_callback failed, returned %d (select id %d)\n", rc, select_id);
+ }
+ 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;
+ LOGE("loc_api_sync_ioctl: IOCTL result failed, result: %d (select id %d)\n", rc, select_id);
+ }
+ } /* wait callback */
+ } /* loc_ioctl */
+ } /* select id */
+
+ return rc;
+}
+
+
diff --git a/loc_api/libloc_api/Android.mk b/loc_api/libloc_api/Android.mk
index 4ef09e0..b1f3dfb 100755..100644
--- a/loc_api/libloc_api/Android.mk
+++ b/loc_api/libloc_api/Android.mk
@@ -6,9 +6,12 @@
#· Neither the name of the QUALCOMM USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ifeq ($(BOARD_USES_QCOM_GPS),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_MODULE_TAGS := optional
+
LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_LIBRARIES:= \
@@ -24,12 +27,25 @@ LOCAL_SRC_FILES += \
loc_eng_ioctl.cpp \
loc_eng_xtra.cpp \
loc_eng_ni.cpp \
+ loc_eng_log.cpp \
+ loc_eng_cfg.cpp \
gps.c
LOCAL_CFLAGS += \
-fno-short-enums \
-DAMSS_VERSION=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION)
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),50000)
+ LOCAL_CFLAGS += -DLIBLOC_USE_GPS_PRIVACY_LOCK=1
+endif
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),20000)
+ LOCAL_CFLAGS += -DLIBLOC_USE_GPS_PRIVACY_LOCK=1
+endif
+ifeq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION),1240)
+ LOCAL_CFLAGS += -DLIBLOC_USE_GPS_PRIVACY_LOCK=1
+ LOCAL_CFLAGS += -DLIBLOC_USE_DEFAULT_RESPONSE_TIME_AND_ACCURACY=1
+endif
+
LOCAL_C_INCLUDES:= \
$(TARGET_OUT_HEADERS)/libloc_api-rpc \
$(TARGET_OUT_HEADERS)/libloc_api-rpc/inc \
@@ -39,5 +55,7 @@ LOCAL_C_INCLUDES:= \
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-include $(BUILD_SHARED_LIBRARY)
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_SHARED_LIBRARY)
+endif
diff --git a/loc_api/libloc_api/loc_eng.cpp b/loc_api/libloc_api/loc_eng.cpp
index 8a3d412..1f3c33a 100755
--- a/loc_api/libloc_api/loc_eng.cpp
+++ b/loc_api/libloc_api/loc_eng.cpp
@@ -1,35 +1,31 @@
-/******************************************************************************
- @file: loc_eng.cpp
- @brief:
-
- DESCRIPTION
- This file defines the implemenation for GPS hardware abstraction layer.
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
-Copyright (c) 2009, QUALCOMM USA, INC.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -----------------------------------------------------------------------------
-
-******************************************************************************/
-
-/*=====================================================================
-$Header: $
-$DateTime: $
-$Author: $
-======================================================================*/
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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
@@ -40,7 +36,10 @@ $Author: $
#include <math.h>
#include <pthread.h>
#include <arpa/inet.h>
+#include <netinet/in.h> /* struct sockaddr_in */
+#include <sys/socket.h>
#include <netdb.h>
+#include <time.h>
#include <rpc/rpc.h>
#include "loc_api_rpc_glue.h"
@@ -49,18 +48,18 @@ $Author: $
#include <cutils/properties.h>
#include <cutils/sched_policy.h>
#include <utils/SystemClock.h>
+#include <string.h>
#include <loc_eng.h>
-#include <loc_eng_ni.h>
-#define LOG_TAG "lib_locapi"
+#define LOG_TAG "libloc"
#include <utils/Log.h>
-// comment this out to enable logging
-// #undef LOGD
-// #define LOGD(...) {}
+#define DEBUG_NI_REQUEST_EMU 0
-#define DEBUG_MOCK_NI 0
+#define LOC_DATA_DEFAULT FALSE // Default data connection status (1=ON, 0=OFF)
+#define SUCCESS TRUE
+#define FAILURE FALSE
// Function declarations for sLocEngInterface
static int loc_eng_init(GpsCallbacks* callbacks);
@@ -70,60 +69,96 @@ static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrenc
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
static void loc_eng_cleanup();
static int loc_eng_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
-static int loc_eng_inject_location(double latitude, double longitude, float accuracy);
-static void loc_eng_delete_aiding_data (GpsAidingData f);
+static int loc_eng_inject_location(double latitude, double longitude, float accuracy);
+static void loc_eng_delete_aiding_data(GpsAidingData f);
static const void* loc_eng_get_extension(const char* name);
// Function declarations for sLocEngAGpsInterface
static void loc_eng_agps_init(AGpsCallbacks* callbacks);
-static int loc_eng_agps_data_conn_open(const char* apn);
-static int loc_eng_agps_data_conn_closed();
-static int loc_eng_agps_data_conn_failed();
-static int loc_eng_agps_set_server(AGpsType type, const char* hostname, int port);
-
-
-static int32 loc_event_cb (rpc_loc_client_handle_type client_handle,
- rpc_loc_event_mask_type loc_event,
- const rpc_loc_event_payload_u_type* loc_event_payload);
-static void loc_eng_report_position (const rpc_loc_parsed_position_s_type *location_report_ptr);
-static void loc_eng_report_sv (const rpc_loc_gnss_info_s_type *gnss_report_ptr);
-static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_report_ptr);
-static void loc_eng_report_nmea (const rpc_loc_nmea_report_s_type *nmea_report_ptr);
-static void loc_eng_process_conn_request (const rpc_loc_server_request_s_type *server_request_ptr);
-
-static void loc_eng_process_deferred_action (void* arg);
-static void loc_eng_process_atl_deferred_action (int flags);
-static void loc_eng_delete_aiding_data_deferred_action (void);
-
-static int set_agps_server();
+static int loc_eng_data_conn_open(const char* apn);
+static int loc_eng_data_conn_closed();
+static int loc_eng_data_conn_failed();
+static int loc_eng_set_server(AGpsType type, const char *hostname, int port);
+static int loc_eng_set_server_proxy(AGpsType type, const char *hostname, int port);
+
+// Internal functions
+static int loc_eng_deinit();
+static int loc_eng_set_apn(const char* apn);
+static int32 loc_event_cb(rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+static void loc_eng_report_position(const rpc_loc_parsed_position_s_type *location_report_ptr);
+static void loc_eng_report_sv(const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+static void loc_inform_gps_status(GpsStatusValue status);
+static void loc_eng_report_status(const rpc_loc_status_event_s_type *status_report_ptr);
+static void loc_eng_report_nmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+static void loc_eng_process_conn_request(const rpc_loc_server_request_s_type *server_request_ptr);
+
+static void loc_eng_deferred_action_thread(void* arg);
+static void loc_eng_process_atl_action(AGpsStatusValue status);
+
+static void loc_eng_delete_aiding_data_action(void);
+static void loc_eng_ioctl_data_close_status(int is_succ);
// Defines the GpsInterface in gps.h
static const GpsInterface sLocEngInterface =
{
- sizeof(GpsInterface),
- loc_eng_init,
- loc_eng_start,
- loc_eng_stop,
- loc_eng_cleanup,
- loc_eng_inject_time,
- loc_eng_inject_location,
- loc_eng_delete_aiding_data,
- loc_eng_set_position_mode,
- loc_eng_get_extension,
+ sizeof(GpsInterface),
+ loc_eng_init,
+ loc_eng_start,
+ loc_eng_stop,
+ loc_eng_cleanup,
+ loc_eng_inject_time,
+ loc_eng_inject_location,
+ loc_eng_delete_aiding_data,
+ loc_eng_set_position_mode,
+ loc_eng_get_extension,
};
static const AGpsInterface sLocEngAGpsInterface =
{
- sizeof(AGpsInterface),
- loc_eng_agps_init,
- loc_eng_agps_data_conn_open,
- loc_eng_agps_data_conn_closed,
- loc_eng_agps_data_conn_failed,
- loc_eng_agps_set_server,
+ sizeof(AGpsInterface),
+ loc_eng_agps_init,
+ loc_eng_data_conn_open,
+ loc_eng_data_conn_closed,
+ loc_eng_data_conn_failed,
+ loc_eng_set_server_proxy
};
// Global data structure for location engine
loc_eng_data_s_type loc_eng_data;
+int loc_eng_inited = 0; /* not initialized */
+
+// Address buffers, for addressing setting before init
+int supl_host_set = 0;
+char supl_host_buf[100];
+int supl_port_buf;
+int c2k_host_set = 0;
+char c2k_host_buf[100];
+int c2k_port_buf;
+
+/*********************************************************************
+ * C2K support for Donut before Eclair supports on-demand bring up
+ *********************************************************************/
+
+/* Force always-on data support for all technologies if set to 1 */
+int loc_force_always_on = 0;
+
+/* Flag for availability of C2K PDE address */
+int loc_c2k_addr_is_set = 0;
+
+/*********************************************************************
+ * Initialization checking macros
+ *********************************************************************/
+#define INIT_CHECK_RET(x, c) \
+ if (!loc_eng_inited) \
+ { \
+ /* Not intialized, abort */ \
+ LOC_LOGE("%s: GPS not initialized.", x); \
+ return c; \
+ }
+#define INIT_CHECK(x) INIT_CHECK_RET(x, RPC_LOC_API_INVALID_HANDLE)
+#define INIT_CHECK_VOID(x) INIT_CHECK_RET(x, )
/*===========================================================================
FUNCTION gps_get_hardware_interface
@@ -144,17 +179,17 @@ SIDE EFFECTS
===========================================================================*/
const GpsInterface* gps_get_hardware_interface ()
{
- char propBuf[PROPERTY_VALUE_MAX];
+ char propBuf[PROPERTY_VALUE_MAX];
- // check to see if GPS should be disabled
- property_get("gps.disable", propBuf, "");
- if (propBuf[0] == '1')
- {
- LOGD("gps_get_interface returning NULL because gps.disable=1\n");
- return NULL;
- }
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOC_LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ return NULL;
+ }
- return &sLocEngInterface;
+ return &sLocEngInterface;
}
/*===========================================================================
@@ -174,74 +209,129 @@ SIDE EFFECTS
N/A
===========================================================================*/
+static int loc_eng_init(GpsCallbacks* callbacks)
+{
+ LOC_LOGD("loc_eng_init entering");
+
+ // Start the LOC api RPC service (if not started yet)
+ loc_api_glue_init();
+ callbacks->set_capabilities_cb(GPS_CAPABILITY_SCHEDULING | GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+ // Avoid repeated initialization. Call de-init to clean up first.
+ if (loc_eng_inited == 1)
+ {
+ loc_eng_deinit(); /* stop the active client */
+#ifdef FEATURE_GNSS_BIT_API
+ gpsone_loc_api_server_unblock();
+ gpsone_loc_api_server_join();
+#endif /* FEATURE_GNSS_BIT_API */
+ loc_eng_inited = 0;
+ }
+
+ // Process gps.conf
+ loc_read_gps_conf();
+
+ // Save callbacks
+ memset(&loc_eng_data, 0, sizeof (loc_eng_data_s_type));
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+
+ // Loc engine module data initialization
+ loc_eng_data.engine_status = GPS_STATUS_NONE;
+ loc_eng_data.fix_session_status = GPS_STATUS_NONE;
+
+ loc_eng_data.loc_event = 0;
+ loc_eng_data.deferred_action_flags = 0;
+ // Mute session
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+
+ // Data connection for AGPS
+ loc_eng_data.data_connection_is_on = LOC_DATA_DEFAULT;
+ memset(loc_eng_data.apn_name, 0, sizeof loc_eng_data.apn_name);
+ loc_eng_data.aiding_data_for_deletion = 0;
+
+ pthread_mutex_init(&loc_eng_data.mute_session_lock, NULL);
+ pthread_mutex_init(&loc_eng_data.deferred_action_mutex, NULL);
+ pthread_cond_init(&loc_eng_data.deferred_action_cond, NULL);
+ pthread_mutex_init (&(loc_eng_data.deferred_stop_mutex), NULL);
+
+ // Open client
+ rpc_loc_event_mask_type event = RPC_LOC_EVENT_PARSED_POSITION_REPORT |
+ RPC_LOC_EVENT_SATELLITE_REPORT |
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST |
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST |
+ RPC_LOC_EVENT_IOCTL_REPORT |
+ RPC_LOC_EVENT_STATUS_REPORT |
+ RPC_LOC_EVENT_NMEA_1HZ_REPORT |
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST;
+ loc_eng_data.client_handle = loc_open(event, loc_event_cb);
+ loc_eng_data.client_opened = (loc_eng_data.client_handle >= 0);
+
+ // Create threads (if not yet created)
+ if (!loc_eng_inited)
+ {
+ loc_eng_data.deferred_action_thread = NULL;
+ loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",loc_eng_deferred_action_thread, NULL);
+#ifdef FEATURE_GNSS_BIT_API
+ gpsone_loc_api_server_launch(NULL, NULL);
+#endif /* FEATURE_GNSS_BIT_API */
+ }
+
+ // XTRA module data initialization
+ pthread_mutex_init(&loc_eng_data.xtra_module_data.lock, NULL);
+ loc_eng_data.xtra_module_data.download_request_cb = NULL;
+ loc_eng_data.xtra_module_data.request_pending = FALSE;
+
+ loc_eng_inited = 1;
+ LOC_LOGD("loc_eng_init created client, id = %d\n", (int32) loc_eng_data.client_handle);
+
+ return 0;
+}
-// fully shutting down the GPS is temporarily disabled to avoid intermittent BP crash
-#define DISABLE_CLEANUP 1
+/*===========================================================================
+FUNCTION loc_eng_deinit
-static int loc_eng_init(GpsCallbacks* callbacks)
+DESCRIPTION
+ De-initialize the location engine. This includes stopping fixes and
+ closing the client.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_deinit()
{
-#if DISABLE_CLEANUP
- if (loc_eng_data.deferred_action_thread) {
- // already initialized
- return 0;
- }
-#endif
- // Start the LOC api RPC service
- loc_api_glue_init ();
-
- callbacks->set_capabilities_cb(GPS_CAPABILITY_SCHEDULING | GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
-
- memset (&loc_eng_data, 0, sizeof (loc_eng_data_s_type));
-
- // LOC ENG module data initialization
- loc_eng_data.location_cb = callbacks->location_cb;
- loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
- loc_eng_data.status_cb = callbacks->status_cb;
- loc_eng_data.nmea_cb = callbacks->nmea_cb;
- loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
- loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
-
- rpc_loc_event_mask_type event = RPC_LOC_EVENT_PARSED_POSITION_REPORT |
- RPC_LOC_EVENT_SATELLITE_REPORT |
- RPC_LOC_EVENT_LOCATION_SERVER_REQUEST |
- RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST |
- RPC_LOC_EVENT_IOCTL_REPORT |
- RPC_LOC_EVENT_STATUS_REPORT |
- RPC_LOC_EVENT_NMEA_POSITION_REPORT |
- RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST;
-
- loc_eng_data.client_handle = loc_open (event, loc_event_cb);
-
- pthread_mutex_init (&(loc_eng_data.deferred_action_mutex), NULL);
- pthread_cond_init (&(loc_eng_data.deferred_action_cond) , NULL);
- pthread_mutex_init (&(loc_eng_data.deferred_stop_mutex), NULL);
-
- loc_eng_data.loc_event = 0;
- loc_eng_data.deferred_action_flags = 0;
- memset (loc_eng_data.apn_name, 0, sizeof (loc_eng_data.apn_name));
-
- loc_eng_data.aiding_data_for_deletion = 0;
- loc_eng_data.engine_status = GPS_STATUS_NONE;
-
- // XTRA module data initialization
- loc_eng_data.xtra_module_data.download_request_cb = NULL;
-
- // IOCTL module data initialization
- loc_eng_data.ioctl_data.cb_is_selected = FALSE;
- loc_eng_data.ioctl_data.cb_is_waiting = FALSE;
- loc_eng_data.ioctl_data.client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
- memset (&(loc_eng_data.ioctl_data.cb_payload),
- 0,
- sizeof (rpc_loc_ioctl_callback_s_type));
-
- pthread_mutex_init (&(loc_eng_data.ioctl_data.cb_data_mutex), NULL);
- pthread_cond_init(&loc_eng_data.ioctl_data.cb_arrived_cond, NULL);
-
- loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",
- loc_eng_process_deferred_action, NULL);
-
- LOGD ("loc_eng_init called, client id = %d\n", (int32) loc_eng_data.client_handle);
- return 0;
+ LOC_LOGD("loc_eng_deinit called");
+
+ if (loc_eng_inited == 1)
+ {
+ if (loc_eng_data.navigating)
+ {
+ LOC_LOGD("loc_eng_init: fix not stopped. stop it now.");
+ loc_eng_stop();
+ loc_eng_data.navigating = FALSE;
+ }
+
+ if (loc_eng_data.client_opened)
+ {
+ LOC_LOGD("loc_eng_init: client opened. close it now.");
+ loc_close(loc_eng_data.client_handle);
+ loc_eng_data.client_opened = FALSE;
+ }
+
+ loc_eng_inited = 0;
+ }
+
+ return 0;
}
/*===========================================================================
@@ -262,36 +352,29 @@ SIDE EFFECTS
===========================================================================*/
static void loc_eng_cleanup()
{
-#if DISABLE_CLEANUP
- return;
-#else
- if (loc_eng_data.deferred_action_thread)
- {
- /* Terminate deferred action working thread */
- pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_QUIT;
- pthread_cond_signal(&loc_eng_data.deferred_action_cond);
- pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
-
- void* ignoredValue;
- pthread_join(loc_eng_data.deferred_action_thread, &ignoredValue);
- loc_eng_data.deferred_action_thread = NULL;
- }
-
- // clean up
- (void) loc_close (loc_eng_data.client_handle);
-
- pthread_mutex_destroy (&loc_eng_data.deferred_action_mutex);
- pthread_cond_destroy (&loc_eng_data.deferred_action_cond);
-
- pthread_mutex_destroy (&loc_eng_data.ioctl_data.cb_data_mutex);
- pthread_cond_destroy (&loc_eng_data.ioctl_data.cb_arrived_cond);
-
-// Do not call this as it can result in the ARM9 crashing if it sends events while we are disabled
-// loc_apicb_app_deinit();
-#endif
+ // clean up
+ loc_eng_deinit();
+
+ if (loc_eng_data.deferred_action_thread)
+ {
+ /* Terminate deferred action working thread */
+ pthread_mutex_lock (&loc_eng_data.deferred_action_mutex);
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_QUIT;
+ pthread_cond_signal (&loc_eng_data.deferred_action_cond);
+ pthread_mutex_unlock (&loc_eng_data.deferred_action_mutex);
+
+ void* ignoredValue;
+ pthread_join(loc_eng_data.deferred_action_thread, &ignoredValue);
+ loc_eng_data.deferred_action_thread = NULL;
+ }
+
+ pthread_mutex_destroy (&loc_eng_data.xtra_module_data.lock);
+ pthread_mutex_destroy (&loc_eng_data.deferred_stop_mutex);
+ pthread_cond_destroy (&loc_eng_data.deferred_action_cond);
+ pthread_mutex_destroy (&loc_eng_data.deferred_action_mutex);
+ pthread_mutex_destroy (&loc_eng_data.mute_session_lock);
}
@@ -313,26 +396,23 @@ SIDE EFFECTS
===========================================================================*/
static int loc_eng_start()
{
- int ret_val;
- LOGD ("loc_eng_start\n");
-
- if (loc_eng_data.position_mode != GPS_POSITION_MODE_STANDALONE &&
- loc_eng_data.agps_server_host[0] != 0 &&
- loc_eng_data.agps_server_port != 0) {
- int result = set_agps_server();
- LOGD ("set_agps_server returned = %d\n", result);
- }
+ INIT_CHECK("loc_eng_start");
- ret_val = loc_start_fix (loc_eng_data.client_handle);
+ int ret_val;
+ LOC_LOGD("loc_eng_start called");
- if (ret_val != RPC_LOC_API_SUCCESS)
- {
- LOGD ("loc_eng_start returned error = %d\n", ret_val);
- }
+ ret_val = loc_start_fix(loc_eng_data.client_handle);
- return 0;
-}
+ if (ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_eng_start error, rc = %d\n", ret_val);
+ }
+ else {
+ loc_eng_data.navigating = TRUE;
+ }
+ return 0;
+}
/*===========================================================================
FUNCTION loc_eng_stop
@@ -352,54 +432,69 @@ SIDE EFFECTS
===========================================================================*/
static int loc_eng_stop()
{
- int ret_val;
+ INIT_CHECK("loc_eng_stop");
- LOGD ("loc_eng_stop\n");
-
- pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
+ int ret_val;
+ LOC_LOGD("loc_eng_stop called");
+ pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
// work around problem with loc_eng_stop when AGPS requests are pending
// we defer stopping the engine until the AGPS request is done
if (loc_eng_data.agps_request_pending)
{
loc_eng_data.stop_request_pending = true;
- LOGD ("deferring stop until AGPS data call is finished\n");
+ LOC_LOGD("loc_eng_stop - deferring stop until AGPS data call is finished\n");
pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
return 0;
}
- pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
-
- ret_val = loc_stop_fix (loc_eng_data.client_handle);
- if (ret_val != RPC_LOC_API_SUCCESS)
- {
- LOGD ("loc_eng_stop returned error = %d\n", ret_val);
- }
-
- return 0;
+ pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
+
+ ret_val = loc_stop_fix(loc_eng_data.client_handle);
+ if (ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGE("loc_eng_stop error, rc = %d\n", ret_val);
+ }
+ else {
+ // end fix session (rpc reported sessions happen every interval w/ fix)
+ if (loc_eng_data.fix_session_status != GPS_STATUS_SESSION_END)
+ {
+ loc_eng_data.fix_session_status = GPS_STATUS_SESSION_END;
+
+ // ENGINE_OFF imples FIX_SESSION_END
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_OFF)
+ loc_inform_gps_status(loc_eng_data.fix_session_status);
+ }
+
+ loc_eng_data.navigating = FALSE;
+ }
+
+ return 0;
}
-static int loc_eng_set_gps_lock(rpc_loc_lock_e_type lock_type)
-{
- rpc_loc_ioctl_data_u_type ioctl_data;
- boolean ret_val;
+/*===========================================================================
+FUNCTION loc_eng_mute_one_session
- LOGD ("loc_eng_set_gps_lock mode, client = %d, lock_type = %d\n",
- (int32) loc_eng_data.client_handle, lock_type);
+DESCRIPTION
+ Mutes one session
- ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = lock_type;
- ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
+DEPENDENCIES
+ None
- 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*/);
+RETURN VALUE
+ 0: Success
- if (ret_val != TRUE)
- {
- LOGD ("loc_eng_set_gps_lock mode failed\n");
- }
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_mute_one_session()
+{
+ INIT_CHECK_VOID("loc_eng_mute_one_session");
+ LOC_LOGD("loc_eng_mute_one_session");
- return 0;
+ pthread_mutex_lock(&loc_eng_data.mute_session_lock);
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_WAIT;
+ LOC_LOGV("loc_eng_report_status: mute_session_state changed to WAIT");
+ pthread_mutex_unlock(&loc_eng_data.mute_session_lock);
}
/*===========================================================================
@@ -418,38 +513,62 @@ SIDE EFFECTS
N/A
===========================================================================*/
-static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time)
{
- rpc_loc_ioctl_data_u_type ioctl_data;
- rpc_loc_fix_criteria_s_type *fix_criteria_ptr;
- boolean ret_val;
+ INIT_CHECK("loc_eng_set_position_mode");
+
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ boolean ret_val;
- LOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ LOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
(int32) loc_eng_data.client_handle, min_interval, mode);
- loc_eng_data.position_mode = mode;
- ioctl_data.disc = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+ fix_criteria_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria;
- fix_criteria_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria);
- fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
- RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
- switch (mode) {
- case GPS_POSITION_MODE_MS_BASED:
- fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSB;
- break;
- case GPS_POSITION_MODE_MS_ASSISTED:
- fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSA;
- break;
- case GPS_POSITION_MODE_STANDALONE:
- default:
- fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_STANDALONE;
- break;
+#ifdef LIBLOC_USE_DEFAULT_RESPONSE_TIME_AND_ACCURACY
+ // 1240 requires the preferred response time and accuracy to be specified,
+ // or it is very inaccurate.
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME |
+ RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+#endif
+
+ fix_criteria_ptr->min_interval = min_interval;
+ fix_criteria_ptr->preferred_accuracy = 50;
+
+ if (!(supl_host_set || c2k_host_set)) {
+ mode = GPS_POSITION_MODE_STANDALONE;
}
- if (min_interval > 0) {
+
+ switch (mode)
+ {
+ case GPS_POSITION_MODE_MS_BASED:
+ fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSB;
+ fix_criteria_ptr->preferred_response_time = 89;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSA;
+ fix_criteria_ptr->preferred_response_time = 89;
+ break;
+ default:
+ fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ fix_criteria_ptr->preferred_response_time = 60;
+ break;
+ }
+
+ if (min_interval > 0) {
fix_criteria_ptr->min_interval = min_interval;
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+ }else if(min_interval == 0)
+ {
+ /*If the framework passes in 0 transalate it into the maximum frequency we can report positions
+ which is 1 Hz or once very second */
+ fix_criteria_ptr->min_interval = MIN_POSSIBLE_FIX_INTERVAL;
}
if (preferred_accuracy > 0) {
fix_criteria_ptr->preferred_accuracy = preferred_accuracy;
@@ -460,7 +579,7 @@ static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence
fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
}
- switch (recurrence) {
+ switch (recurrence) {
case GPS_POSITION_RECURRENCE_SINGLE:
fix_criteria_ptr->recurrence_type = RPC_LOC_SINGLE_FIX;
break;
@@ -469,19 +588,19 @@ static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence
fix_criteria_ptr->recurrence_type = RPC_LOC_PERIODIC_FIX;
break;
}
-
- ret_val = loc_eng_ioctl(loc_eng_data.client_handle,
- RPC_LOC_IOCTL_SET_FIX_CRITERIA,
+ ioctl_data.disc = ioctl_type;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ ioctl_type,
&ioctl_data,
LOC_IOCTL_DEFAULT_TIMEOUT,
NULL /* No output information is expected*/);
- if (ret_val != TRUE)
- {
- LOGD ("loc_eng_set_position mode failed\n");
- }
+ if (ret_val != TRUE)
+ {
+ LOC_LOGE("loc_eng_set_position mode failed\n");
+ }
- return 0;
+ return 0;
}
/*===========================================================================
@@ -500,39 +619,97 @@ SIDE EFFECTS
N/A
===========================================================================*/
-static int loc_eng_inject_time (GpsUtcTime time, int64_t timeReference, int uncertainty)
+static int loc_eng_inject_time(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;
- boolean ret_val;
+ INIT_CHECK("loc_eng_inject_time");
- LOGD ("loc_eng_inject_time, uncertainty = %d\n", 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;
+ boolean ret_val;
- ioctl_data.disc = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+ 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)(android::elapsedRealtime() - timeReference);
- time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+ 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)(android::elapsedRealtime() - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
- ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
- RPC_LOC_IOCTL_INJECT_UTC_TIME,
- &ioctl_data,
- LOC_IOCTL_DEFAULT_TIMEOUT,
- NULL /* No output information is expected*/);
+ ioctl_data.disc = ioctl_type;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
- if (ret_val != TRUE)
- {
- LOGD ("loc_eng_inject_time failed\n");
- }
+ if (ret_val != TRUE)
+ {
+ LOC_LOGE ("loc_eng_inject_time failed\n");
+ }
- return 0;
+ return RPC_LOC_API_SUCCESS;
}
-static int loc_eng_inject_location (double latitude, double longitude, float accuracy)
+/*===========================================================================
+FUNCTION loc_eng_inject_location
+
+DESCRIPTION
+ This is used by Java native function to do location injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0 : Successful
+ error code : Failure
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+static int loc_eng_inject_location(double latitude, double longitude, float accuracy)
{
- /* not yet implemented */
- return 0;
+ INIT_CHECK("loc_eng_inject_location");
+
+ /* 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;
+
+ /************************************************
+ * 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);
+
+ /* Make the API call */
+ if (TRUE != loc_eng_ioctl(
+ loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_INJECT_POSITION,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/))
+ {
+ LOC_LOGE("loc_eng_inject_injection failed.\n");
+ return RPC_LOC_API_GENERAL_FAILURE;
+ }
+
+ return RPC_LOC_API_SUCCESS; /* 0 */
}
/*===========================================================================
@@ -549,32 +726,34 @@ DEPENDENCIES
LOC API specification.
RETURN VALUE
- RPC_LOC_API_SUCCESS
+ None
SIDE EFFECTS
N/A
===========================================================================*/
-static void loc_eng_delete_aiding_data (GpsAidingData f)
+static void loc_eng_delete_aiding_data(GpsAidingData f)
{
- pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+ INIT_CHECK_VOID("loc_eng_delete_aiding_data");
+
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
// Currently, LOC API only support deletion of all aiding data,
if (f)
loc_eng_data.aiding_data_for_deletion = GPS_DELETE_ALL;
- if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) &&
- (loc_eng_data.aiding_data_for_deletion != 0))
- {
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
- pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.aiding_data_for_deletion != 0)
+ {
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
- // In case gps engine is ON, the assistance data will be deleted when the engine is OFF
- }
+ // In case gps engine is ON, the assistance data will be deleted when the engine is OFF
+ }
- pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
}
/*===========================================================================
@@ -595,25 +774,70 @@ SIDE EFFECTS
===========================================================================*/
static const void* loc_eng_get_extension(const char* name)
{
- if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
- {
- return &sLocEngXTRAInterface;
- }
- else if (strcmp(name, AGPS_INTERFACE) == 0)
- {
- return &sLocEngAGpsInterface;
- }
- else if (strcmp(name, GPS_NI_INTERFACE) == 0)
- {
- return &sLocEngNiInterface;
- }
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+#if (AMSS_VERSION!=20000)
+ return &sLocEngXTRAInterface;
+#else
+ return NULL;
+#endif
+ }
+
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ return &sLocEngAGpsInterface;
+ }
+
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ return &sLocEngNiInterface;
+ }
+
+ return NULL;
+}
+
+/*===========================================================================
+FUNCTION loc_inform_gps_state
+
+DESCRIPTION
+ Informs the GPS Provider about the GPS status
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_inform_gps_status(GpsStatusValue status)
+{
+ static GpsStatusValue last_status = GPS_STATUS_NONE;
+
+ GpsStatus gs = { sizeof(gs),status };
+
+ LOC_LOGD("loc_inform_gps_status, status: %s", loc_get_gps_status_name(status));
- return NULL;
+ if (loc_eng_data.status_cb)
+ {
+ loc_eng_data.status_cb(&gs);
+
+ // Restore session begin if needed
+ if (status == GPS_STATUS_ENGINE_ON && last_status == GPS_STATUS_SESSION_BEGIN)
+ {
+ GpsStatus gs_sess_begin = { sizeof(gs_sess_begin),GPS_STATUS_SESSION_BEGIN };
+ loc_eng_data.status_cb(&gs_sess_begin);
+ }
+ }
+
+ last_status = status;
}
-#if DEBUG_MOCK_NI == 1
+#if DEBUG_NI_REQUEST_EMU == 1
/*===========================================================================
-FUNCTION mock_ni
+FUNCTION emulate_ni_request
DESCRIPTION
DEBUG tool: simulate an NI request
@@ -628,63 +852,63 @@ SIDE EFFECTS
N/A
===========================================================================*/
-static void* mock_ni(void* arg)
+static void* emulate_ni_request(void* arg)
{
- static int busy = 0;
+ static int busy = 0;
- if (busy) return NULL;
+ if (busy) return NULL;
- busy = 1;
+ busy = 1;
- sleep(5);
+ sleep(5);
- rpc_loc_client_handle_type client_handle;
- rpc_loc_event_mask_type loc_event;
- rpc_loc_event_payload_u_type payload;
- rpc_loc_ni_event_s_type *ni_req;
- rpc_loc_ni_supl_notify_verify_req_s_type *supl_req;
+ rpc_loc_client_handle_type client_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type payload;
+ rpc_loc_ni_event_s_type *ni_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type *supl_req;
- client_handle = (rpc_loc_client_handle_type) arg;
+ client_handle = (rpc_loc_client_handle_type) arg;
- loc_event = RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST;
- payload.disc = loc_event;
+ loc_event = RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST;
+ payload.disc = loc_event;
- ni_req = &payload.rpc_loc_event_payload_u_type_u.ni_request;
- ni_req->event = RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ;
- supl_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ ni_req = &payload.rpc_loc_event_payload_u_type_u.ni_request;
+ ni_req->event = RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ;
+ supl_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
- // Encodings for Spirent Communications
- char client_name[80] = {0x53,0x78,0x5A,0x5E,0x76,0xD3,0x41,0xC3,0x77,
- 0xBB,0x5D,0x77,0xA7,0xC7,0x61,0x7A,0xFA,0xED,0x9E,0x03};
- char requestor_id[80] = {0x53,0x78,0x5A,0x5E,0x76,0xD3,0x41,0xC3,0x77,
- 0xBB,0x5D,0x77,0xA7,0xC7,0x61,0x7A,0xFA,0xED,0x9E,0x03};
+ // Encodings for Spirent Communications
+ char client_name[80] = {0x53,0x78,0x5A,0x5E,0x76,0xD3,0x41,0xC3,0x77,
+ 0xBB,0x5D,0x77,0xA7,0xC7,0x61,0x7A,0xFA,0xED,0x9E,0x03};
+ char requestor_id[80] = {0x53,0x78,0x5A,0x5E,0x76,0xD3,0x41,0xC3,0x77,
+ 0xBB,0x5D,0x77,0xA7,0xC7,0x61,0x7A,0xFA,0xED,0x9E,0x03};
- supl_req->flags = RPC_LOC_NI_CLIENT_NAME_PRESENT |
- RPC_LOC_NI_REQUESTOR_ID_PRESENT |
- RPC_LOC_NI_ENCODING_TYPE_PRESENT;
+ supl_req->flags = RPC_LOC_NI_CLIENT_NAME_PRESENT |
+ RPC_LOC_NI_REQUESTOR_ID_PRESENT |
+ RPC_LOC_NI_ENCODING_TYPE_PRESENT;
- supl_req->datacoding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT;
+ supl_req->datacoding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT;
- supl_req->client_name.data_coding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT; // no coding
- supl_req->client_name.client_name_string.client_name_string_len = strlen(client_name);
- supl_req->client_name.client_name_string.client_name_string_val = client_name;
- supl_req->client_name.string_len = strlen(client_name);
+ supl_req->client_name.data_coding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT; // no coding
+ supl_req->client_name.client_name_string.client_name_string_len = strlen(client_name);
+ supl_req->client_name.client_name_string.client_name_string_val = client_name;
+ supl_req->client_name.string_len = strlen(client_name);
- supl_req->requestor_id.data_coding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT;
- supl_req->requestor_id.requestor_id_string.requestor_id_string_len = strlen(requestor_id);
- supl_req->requestor_id.requestor_id_string.requestor_id_string_val = requestor_id;
- supl_req->requestor_id.string_len = strlen(requestor_id);
+ supl_req->requestor_id.data_coding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT;
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_len = strlen(requestor_id);
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val = requestor_id;
+ supl_req->requestor_id.string_len = strlen(requestor_id);
- supl_req->notification_priv_type = RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP;
- supl_req->user_response_timer = 10;
+ supl_req->notification_priv_type = RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP;
+ supl_req->user_response_timer = 10;
- loc_event_cb(client_handle, loc_event, &payload);
+ loc_event_cb(client_handle, loc_event, &payload);
- busy = 0;
+ busy = 0;
- return NULL;
+ return NULL;
}
-#endif // DEBUG_MOCK_NI
+#endif /* DEBUG_NI_REQUEST_EMU */
/*===========================================================================
FUNCTION loc_event_cb
@@ -702,31 +926,38 @@ SIDE EFFECTS
N/A
===========================================================================*/
-static int32 loc_event_cb(
- rpc_loc_client_handle_type client_handle,
- rpc_loc_event_mask_type loc_event,
- const rpc_loc_event_payload_u_type* loc_event_payload
- )
+static int32 loc_event_cb
+(
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+)
{
- LOGV ("loc_event_cb, client = %d, loc_event = 0x%x", (int32) client_handle, (uint32) loc_event);
- if (client_handle == loc_eng_data.client_handle)
- {
- pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
- loc_eng_data.loc_event = loc_event;
- memcpy(&loc_eng_data.loc_event_payload, loc_event_payload, sizeof(*loc_event_payload));
-
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_EVENT;
- pthread_cond_signal(&loc_eng_data.deferred_action_cond);
- pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
- }
- else
- {
- LOGD ("loc client mismatch: received = %d, expected = %d \n", (int32) client_handle, (int32) loc_eng_data.client_handle);
- }
-
- return RPC_LOC_API_SUCCESS;
+ if(loc_event == RPC_LOC_EVENT_IOCTL_REPORT)
+ return RPC_LOC_API_SUCCESS;
+
+ INIT_CHECK("loc_event_cb");
+ loc_eng_callback_log_header(client_handle, loc_event, loc_event_payload);
+
+ if (client_handle != loc_eng_data.client_handle)
+ {
+ LOC_LOGE("loc client mismatch: received = %d, expected = %d \n",
+ (int32) client_handle, (int32) loc_eng_data.client_handle);
+ return RPC_LOC_API_SUCCESS; /* Exit with OK */
+ }
+
+ loc_eng_callback_log(loc_event, loc_event_payload);
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+ loc_eng_data.loc_event = loc_event;
+ memcpy(&loc_eng_data.loc_event_payload, loc_event_payload, sizeof(*loc_event_payload));
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_EVENT;
+ pthread_cond_signal (&loc_eng_data.deferred_action_cond);
+ pthread_mutex_unlock (&loc_eng_data.deferred_action_mutex);
+
+ 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
}
/*===========================================================================
@@ -745,74 +976,104 @@ SIDE EFFECTS
N/A
===========================================================================*/
-static void loc_eng_report_position (const rpc_loc_parsed_position_s_type *location_report_ptr)
+static void loc_eng_report_position(const rpc_loc_parsed_position_s_type *location_report_ptr)
{
- GpsLocation location;
-
- LOGV ("loc_eng_report_position: location report, valid mask = 0x%x, sess status = %d\n",
- (uint32) location_report_ptr->valid_mask, location_report_ptr->session_status);
-
- memset (&location, 0, sizeof(location));
- location.size = sizeof(location);
- if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
- {
- // Not a position report, return
- if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS)
- {
- if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
- {
- location.timestamp = location_report_ptr->timestamp_utc;
- }
-
- if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
- (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE))
- {
- location.flags |= GPS_LOCATION_HAS_LAT_LONG;
- location.latitude = location_report_ptr->latitude;
- location.longitude = location_report_ptr->longitude;
- }
-
- if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
- {
- location.flags |= GPS_LOCATION_HAS_ALTITUDE;
- location.altitude = location_report_ptr->altitude_wrt_ellipsoid;
- }
-
- if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) &&
- (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL))
- {
- location.flags |= GPS_LOCATION_HAS_SPEED;
- location.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal +
- location_report_ptr->speed_vertical * location_report_ptr->speed_vertical);
- }
-
- if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
- {
- location.flags |= GPS_LOCATION_HAS_BEARING;
- location.bearing = location_report_ptr->heading;
- }
-
- if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR)
- {
- location.flags |= GPS_LOCATION_HAS_ACCURACY;
- location.accuracy = location_report_ptr->hor_unc_circular;
- }
-
- if (loc_eng_data.location_cb != NULL)
- {
- LOGV ("loc_eng_report_position: fire callback\n");
- loc_eng_data.location_cb (&location);
- }
- }
- else
- {
- LOGV ("loc_eng_report_position: ignore position report when session status = %d\n", location_report_ptr->session_status);
- }
- }
- else
- {
- LOGV ("loc_eng_report_position: ignore position report when session status is not set\n");
- }
+ GpsLocation location;
+
+ memset(&location, 0, sizeof (GpsLocation));
+ location.size = sizeof(location);
+ 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 &&
+ gps_conf.INTERMEDIATE_POS))
+ {
+ // Time stamp (UTC)
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ // Latitude & Longitude
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE) )
+ {
+ location.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.latitude = location_report_ptr->latitude;
+ location.longitude = location_report_ptr->longitude;
+ }
+
+ // Altitude
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ // Speed
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL))
+ {
+ location.flags |= GPS_LOCATION_HAS_SPEED;
+ location.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal +
+ location_report_ptr->speed_vertical * location_report_ptr->speed_vertical);
+ }
+
+ // Heading
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.flags |= GPS_LOCATION_HAS_BEARING;
+#if (AMSS_VERSION==20000)
+ // convert 10 bit value to degrees
+ location.bearing = location_report_ptr->heading * 10 * 360 / 1024;
+#else
+ location.bearing = location_report_ptr->heading;
+#endif
+ }
+
+ // Uncertainty (circular)
+ if ( (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) )
+ {
+ location.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ // Filtering
+ boolean filter_out = FALSE;
+
+ // Filter any 0,0 positions
+ if (location.latitude == 0.0 && location.longitude == 0.0)
+ {
+ filter_out = TRUE;
+ }
+
+ // Turn-off intermediate positions outside required accuracy
+ if (gps_conf.ACCURACY_THRES != 0 &&
+ location_report_ptr->session_status == RPC_LOC_SESS_STATUS_IN_PROGESS &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR) &&
+ location_report_ptr->hor_unc_circular > gps_conf.ACCURACY_THRES)
+ {
+ LOC_LOGW("loc_eng_report_position: ignore intermediate position with error %.2f > %ld meters\n",
+ location_report_ptr->hor_unc_circular, gps_conf.ACCURACY_THRES);
+ filter_out = TRUE;
+ }
+
+ if (loc_eng_data.location_cb != NULL && !filter_out)
+ {
+ LOC_LOGV("loc_eng_report_position: fire callback\n");
+ loc_eng_data.location_cb(&location);
+ }
+ }
+ else
+ {
+ 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");
+ }
}
/*===========================================================================
@@ -833,101 +1094,101 @@ SIDE EFFECTS
===========================================================================*/
static void loc_eng_report_sv (const rpc_loc_gnss_info_s_type *gnss_report_ptr)
{
- GpsSvStatus SvStatus;
- int num_svs_max, i;
- const rpc_loc_sv_info_s_type *sv_info_ptr;
-
- LOGV ("loc_eng_report_sv: valid_mask = 0x%x, num of sv = %d\n",
- (uint32) gnss_report_ptr->valid_mask,
- gnss_report_ptr->sv_count);
-
- num_svs_max = 0;
- memset (&SvStatus, 0, sizeof (GpsSvStatus));
- 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 (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)
+ GpsSvStatus SvStatus;
+ int num_svs_max, i;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ // LOC_LOGD ("loc_eng_report_sv: valid_mask = 0x%x, num of sv = %d\n",
+ // (uint32) gnss_report_ptr->valid_mask,
+ // gnss_report_ptr->sv_count);
+
+ num_svs_max = 0;
+ memset (&SvStatus, 0, sizeof (GpsSvStatus));
+ 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 (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)
{
- if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
- {
- SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus);
- SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
-
- // We only have the data field to report gps eph and alm mask
- if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
- (sv_info_ptr->has_eph == 1))
- {
- SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
- }
-
- if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
- (sv_info_ptr->has_alm == 1))
- {
- SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
- }
-
- if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
- (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
- {
- SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
- }
- }
- // SBAS: GPS RPN: 120-151,
- // In exteneded measurement report, we follow nmea standard, which is from 33-64.
- else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
- {
- SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
- }
- // Gloness: Slot id: 1-32
- // In extended measurement report, we follow nmea standard, which is 65-96
- else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
- {
- SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
- }
- // Unsupported SV system
- else
- {
- continue;
- }
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
}
-
- if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ // 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].snr = sv_info_ptr->snr;
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
}
-
- if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
{
- SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
}
-
- if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ // Unsupported SV system
+ else
{
- SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ continue;
}
-
- SvStatus.num_svs++;
- }
- }
-
- LOGV ("num_svs = %d, eph mask = %d, alm mask = %d\n", SvStatus.num_svs, SvStatus.ephemeris_mask, SvStatus.almanac_mask );
- if ((SvStatus.num_svs != 0) && (loc_eng_data.sv_status_cb != NULL))
- {
- loc_eng_data.sv_status_cb(&SvStatus);
- }
+ }
+
+ 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++;
+ }
+ }
+
+ // LOC_LOGD ("num_svs = %d, eph mask = %d, alm mask = %d\n", SvStatus.num_svs, SvStatus.ephemeris_mask, SvStatus.almanac_mask );
+ if ((SvStatus.num_svs != 0) && (loc_eng_data.sv_status_cb != NULL))
+ {
+ loc_eng_data.sv_status_cb(&SvStatus);
+ }
}
/*===========================================================================
@@ -948,62 +1209,126 @@ SIDE EFFECTS
===========================================================================*/
static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_report_ptr)
{
- GpsStatus status;
+ GpsStatusValue engine_status = loc_eng_data.engine_status;
+ GpsStatusValue fix_session_status = loc_eng_data.fix_session_status;
+
+// LOC_LOGD("loc_eng_report_status: event = %d\n", status_report_ptr->event);
+ if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_ENGINE_STATE)
+ {
+ rpc_loc_engine_state_e_type state =
+ status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state;
+ if (state == RPC_LOC_ENGINE_STATE_ON)
+ {
+ loc_eng_data.engine_status = GPS_STATUS_ENGINE_ON;
+ }
+ else
+ {
+ // engine off implies fix session end
+ loc_eng_data.engine_status = GPS_STATUS_ENGINE_OFF;
+ loc_eng_data.fix_session_status = GPS_STATUS_SESSION_END;
+ }
+ }
+ else if (status_report_ptr->event == RPC_LOC_STATUS_EVENT_FIX_SESSION_STATE)
+ {
+ rpc_loc_fix_session_state_e_type state =
+ status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.fix_session_state;
+ if (state == RPC_LOC_FIX_SESSION_STATE_BEGIN)
+ {
+ // fix session begin implies engine on
+ loc_eng_data.engine_status = GPS_STATUS_ENGINE_ON;
+ loc_eng_data.fix_session_status = GPS_STATUS_SESSION_BEGIN;
+ }
+
+ // ignore FIX_SESSION_STATE_END; there is a begin/end pair for
+ // every location report, and we only want the overall session.
+ }
+
+ // report changed status
+
+ // FIX_SESSION_BEGIN implies ENGINE_ON
+ if (loc_eng_data.fix_session_status != GPS_STATUS_SESSION_BEGIN
+ && engine_status != loc_eng_data.engine_status)
+ loc_inform_gps_status(loc_eng_data.engine_status);
+
+ // ENGINE_OFF implies FIX_SESSION_END
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_OFF
+ && fix_session_status != loc_eng_data.fix_session_status)
+ loc_inform_gps_status(loc_eng_data.fix_session_status);
+
+ pthread_mutex_lock(&loc_eng_data.mute_session_lock);
+ // Switch from WAIT to MUTE, for "engine on" event
+ if (loc_eng_data.engine_status == GPS_STATUS_ENGINE_ON)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_WAIT)
+ {
+ LOC_LOGV("loc_eng_report_status: mute_session_state changed from WAIT to IN SESSION");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_IN_SESSION;
+ }
+ }
+ // Switch off MUTE session
+ else if (loc_eng_data.engine_status == GPS_STATUS_ENGINE_OFF)
+ {
+ if (loc_eng_data.mute_session_state == LOC_MUTE_SESS_IN_SESSION)
+ {
+ LOC_LOGV("loc_eng_report_status: mute_session_state changed from IN SESSION to NONE");
+ loc_eng_data.mute_session_state = LOC_MUTE_SESS_NONE;
+ }
+ }
+ pthread_mutex_unlock(&loc_eng_data.mute_session_lock);
+
+
+ pthread_mutex_lock (&loc_eng_data.deferred_action_mutex);
+
+ // Wake up the thread for aiding data deletion, XTRA injection, etc.
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ (loc_eng_data.aiding_data_for_deletion != 0 ||
+ loc_eng_data.xtra_module_data.xtra_data_for_injection != NULL))
+ {
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
+ // In case gps engine is ON, the assistance data will be deleted when the engine is OFF
+ }
+ pthread_mutex_unlock (&loc_eng_data.deferred_action_mutex);
+}
- LOGV ("loc_eng_report_status: event = %d\n", status_report_ptr->event);
+/*===========================================================================
+FUNCTION loc_eng_report_nmea
- memset (&status, 0, sizeof(status));
- status.size = sizeof(status);
- status.status = GPS_STATUS_NONE;
- 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)
- {
- // GPS_STATUS_SESSION_BEGIN implies GPS_STATUS_ENGINE_ON
- status.status = GPS_STATUS_SESSION_BEGIN;
- loc_eng_data.status_cb(&status);
- }
- else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
- {
- // GPS_STATUS_SESSION_END implies GPS_STATUS_ENGINE_OFF
- status.status = GPS_STATUS_ENGINE_OFF;
- loc_eng_data.status_cb(&status);
- }
- }
+DESCRIPTION
+ Reports NMEA string to GPS HAL
- pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
- loc_eng_data.engine_status = status.status;
+DEPENDENCIES
+ N/A
- // Wake up the thread for aiding data deletion.
- if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) &&
- (loc_eng_data.aiding_data_for_deletion != 0))
- {
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
- pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
- // In case gps engine is ON, the assistance data will be deleted when the engine is OFF
- }
+RETURN VALUE
+ N/A
- pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
-}
+SIDE EFFECTS
+ N/A
-static void loc_eng_report_nmea (const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+===========================================================================*/
+static void loc_eng_report_nmea(const rpc_loc_nmea_report_s_type *nmea_report_ptr)
{
- if (loc_eng_data.nmea_cb != NULL)
- {
- struct timeval tv;
+ if (loc_eng_data.nmea_cb != NULL)
+ {
+ struct timeval tv;
- gettimeofday(&tv, (struct timezone *) NULL);
- long long now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+ gettimeofday(&tv, (struct timezone *) NULL);
+ long long now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
-#if (AMSS_VERSION==3200)
- loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences.nmea_sentences_val,
- nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#if (AMSS_VERSION==3200||AMSS_VERSION==20000)
+ loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
#else
- loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences, nmea_report_ptr->length);
-#endif
- }
+ loc_eng_data.nmea_cb(now, 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||AMSS_VERSION==20000) */
+ }
}
/*===========================================================================
@@ -1024,37 +1349,123 @@ SIDE EFFECTS
===========================================================================*/
static void loc_eng_process_conn_request (const rpc_loc_server_request_s_type *server_request_ptr)
{
- LOGD ("loc_event_cb: get loc event location server request, event = %d\n", server_request_ptr->event);
+ LOC_LOGD("loc_event_cb: get loc event location server request, event = %d\n", server_request_ptr->event);
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+
+ if (server_request_ptr->event == RPC_LOC_SERVER_REQUEST_OPEN)
+ {
+ loc_eng_data.agps_status = GPS_REQUEST_AGPS_DATA_CONN;
+ loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ loc_eng_data.agps_request_pending = true;
+ }
+ else
+ {
+ loc_eng_data.agps_status = GPS_RELEASE_AGPS_DATA_CONN;
+ loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ loc_eng_data.agps_request_pending = false;
+ }
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_STATUS;
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
- // Signal DeferredActionThread to send the APN name
- pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+}
- // This implemenation is based on the fact that modem now at any time has only one data connection for AGPS at any given time
- if (server_request_ptr->event == RPC_LOC_SERVER_REQUEST_OPEN)
- {
- loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
- loc_eng_data.agps_status = GPS_REQUEST_AGPS_DATA_CONN;
- loc_eng_data.agps_request_pending = true;
- }
- else
- {
- loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
- loc_eng_data.agps_status = GPS_RELEASE_AGPS_DATA_CONN;
- loc_eng_data.agps_request_pending = false;
- }
+/*===========================================================================
+FUNCTION loc_eng_process_loc_event
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_STATUS;
- pthread_cond_signal(&loc_eng_data.deferred_action_cond);
- pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
-}
+DESCRIPTION
+ This is used to process events received from the location engine.
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_process_loc_event (rpc_loc_event_mask_type loc_event,
+ rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ LOC_LOGD("loc_eng_process_loc_event: %llx\n", (unsigned long long)loc_event);
+ // Parsed report
+ if ( (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT) &&
+ loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ loc_eng_report_position(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ parsed_location_report);
+ }
+
+ // Satellite report
+ if ( (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT) &&
+ loc_eng_data.mute_session_state != LOC_MUTE_SESS_IN_SESSION)
+ {
+ loc_eng_report_sv(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ gnss_report);
+ }
+
+ // Status report
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ loc_eng_report_status(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ status_report);
+ }
+
+ // NMEA
+ if (loc_event & RPC_LOC_EVENT_NMEA_1HZ_REPORT)
+ {
+ loc_eng_report_nmea(&(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)
+ {
+ LOC_LOGD("loc_event_cb: XTRA download request");
+ loc_eng_data.xtra_module_data.request_pending = TRUE;
+ }
+ if (loc_event_payload->rpc_loc_event_payload_u_type_u.assist_data_request.event ==
+ RPC_LOC_ASSIST_DATA_TIME_REQ)
+ {
+ LOC_LOGD("loc_event_cb: XTRA time download request... not supported");
+ }
+ }
+
+ if (loc_eng_data.xtra_module_data.request_pending)
+ {
+ // Call Registered callback
+ if (loc_eng_data.xtra_module_data.download_request_cb != NULL)
+ {
+ loc_eng_data.xtra_module_data.request_pending = FALSE;
+ loc_eng_data.xtra_module_data.download_request_cb();
+ }
+ }
+
+ // IOCTL status report
+ if (loc_event & RPC_LOC_EVENT_IOCTL_REPORT)
+ {
+ // Process the received RPC_LOC_EVENT_IOCTL_REPORT
+ }
+
+ // AGPS data request
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ loc_eng_process_conn_request(&loc_event_payload->rpc_loc_event_payload_u_type_u.
+ loc_server_request);
+ }
+
+ loc_eng_ni_callback(loc_event, loc_event_payload);
+}
/*===========================================================================
FUNCTION loc_eng_agps_init
DESCRIPTION
-
+ Initialize the AGps interface.
DEPENDENCIES
NONE
@@ -1068,466 +1479,779 @@ SIDE EFFECTS
===========================================================================*/
static void loc_eng_agps_init(AGpsCallbacks* callbacks)
{
- LOGV("loc_eng_agps_init\n");
- loc_eng_data.agps_status_cb = callbacks->status_cb;
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+
+ loc_c2k_addr_is_set = 0;
+
+ // Set server addresses which came before init
+ if (supl_host_set)
+ {
+ loc_eng_set_server(AGPS_TYPE_SUPL, supl_host_buf, supl_port_buf);
+ }
+
+ if (c2k_host_set)
+ {
+ // loc_c2k_addr_is_set will be set in here
+ loc_eng_set_server(AGPS_TYPE_C2K, c2k_host_buf, c2k_port_buf);
+ }
}
-static int loc_eng_agps_data_conn_open(const char* apn)
-{
- int apn_len;
- LOGD("loc_eng_agps_data_conn_open: %s\n", apn);
+/*===========================================================================
+FUNCTION loc_eng_ioctl_data_status
- pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+DESCRIPTION
+ This function makes an IOCTL call to return data call status to modem
- if (apn != NULL)
- {
- apn_len = strlen (apn);
+DEPENDENCIES
+ Requires loc_eng_data.apn_name
- if (apn_len >= sizeof(loc_eng_data.apn_name))
- {
- LOGD ("loc_eng_set_apn: error, apn name exceeds maximum lenght of 100 chars\n");
- apn_len = sizeof(loc_eng_data.apn_name) - 1;
- }
+RETURN VALUE
+ None
- memcpy (loc_eng_data.apn_name, apn, apn_len);
- loc_eng_data.apn_name[apn_len] = '\0';
- }
+SIDE EFFECTS
+ N/A
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_SUCCESS;
- pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
- pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
- return 0;
+===========================================================================*/
+static void loc_eng_ioctl_data_open_status(int is_succ)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+ time_t time_now;
+ boolean ret_val;
+
+ /**
+ * In case data connection is already open (most of the time), delay 1s so
+ * PDSM ATL module will behave properly
+ */
+ time(&time_now);
+ if ((long) time_now - (long) loc_eng_data.data_conn_open_time <=
+ DATA_OPEN_MIN_TIME + 1)
+ {
+ sleep(DATA_OPEN_MIN_TIME);
+ }
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr->conn_handle = loc_eng_data.conn_handle;
+#if (AMSS_VERSION==3200||AMSS_VERSION==20000)
+ conn_open_status_ptr->apn_name = loc_eng_data.apn_name; /* requires APN */
+#else
+ strlcpy(conn_open_status_ptr->apn_name, loc_eng_data.apn_name,
+ sizeof conn_open_status_ptr->apn_name);
+#endif /* #if (AMSS_VERSION==3200||AMSS_VERSION==20000) */
+ conn_open_status_ptr->open_status = is_succ ? RPC_LOC_SERVER_OPEN_SUCCESS : RPC_LOC_SERVER_OPEN_FAIL;
+
+ LOC_LOGD("loc_eng_ioctl for ATL open %s, APN name = [%s]\n",
+ log_succ_fail_string(is_succ),
+ loc_eng_data.apn_name);
+
+ // Make the IOCTL call
+ ret_val = loc_eng_ioctl(loc_eng_data.client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL);
+
+ loc_eng_data.data_connection_is_on = is_succ;
}
-static int loc_eng_agps_data_conn_closed()
+/*===========================================================================
+FUNCTION loc_eng_ioctl_data_close_status
+
+DESCRIPTION
+ This function makes an IOCTL call to return data call close status to modem
+
+DEPENDENCIES
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_ioctl_data_close_status(int is_succ)
{
- LOGD("loc_eng_agps_data_conn_closed\n");
- pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_CLOSED;
- pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
- pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
- return 0;
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ time_t time_now;
+ boolean ret_val;
+
+ // Fill in data
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+ conn_close_status_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status;
+ conn_close_status_ptr->conn_handle = loc_eng_data.conn_handle;
+ conn_close_status_ptr->close_status = is_succ ? RPC_LOC_SERVER_CLOSE_SUCCESS : RPC_LOC_SERVER_CLOSE_FAIL;
+
+ // Make the IOCTL call
+ ret_val = loc_eng_ioctl(loc_eng_data.client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL);
+ LOC_LOGD("loc_eng_ioctl for ATL close. rc = %d\n",ret_val);
}
-static int loc_eng_agps_data_conn_failed()
+/*===========================================================================
+FUNCTION loc_eng_data_conn_open
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_data_conn_open(const char* apn)
{
- LOGD("loc_eng_agps_data_conn_failed\n");
-
- pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
- /* hold a wake lock while events are pending for deferred_action_thread */
- loc_eng_data.acquire_wakelock_cb();
- loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_FAILED;
- pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
- pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
- return 0;
+ INIT_CHECK("loc_eng_data_conn_open");
+
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr =
+ &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+ boolean ret_val;
+
+ LOC_LOGD("loc_eng_data_conn_open APN name = [%s]", apn);
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+ loc_eng_set_apn(apn);
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_SUCCESS;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ return 0;
}
-static int set_agps_server()
-{
- rpc_loc_ioctl_data_u_type ioctl_data;
- rpc_loc_server_info_s_type *server_info_ptr;
- boolean ret_val;
- uint16 port_temp;
- unsigned char *b_ptr;
-
- if (loc_eng_data.agps_server_host[0] == 0 || loc_eng_data.agps_server_port == 0)
- return -1;
-
- if (loc_eng_data.agps_server_address == 0) {
- struct hostent* he = gethostbyname(loc_eng_data.agps_server_host);
- if (he)
- loc_eng_data.agps_server_address = *(uint32_t *)he->h_addr_list[0];
- }
- if (loc_eng_data.agps_server_address == 0)
- return -1;
+/*===========================================================================
+FUNCTION loc_eng_data_conn_closed
- b_ptr = (unsigned char*) (&loc_eng_data.agps_server_address);
+DESCRIPTION
+ This function is called when on-demand data connection closing is done.
+It should inform ARM 9 about the data close result.
+DEPENDENCIES
+ NONE
- server_info_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr);
- ioctl_data.disc = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
- server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
- server_info_ptr->addr_info.disc = RPC_LOC_SERVER_ADDR_URL;
+RETURN VALUE
+ 0
-#if (AMSS_VERSION==3200)
- char url[24];
- memset(url, 0, sizeof(url));
- snprintf(url, sizeof(url) - 1, "%d.%d.%d.%d:%d",
- (*(b_ptr + 0) & 0x000000ff), (*(b_ptr+1) & 0x000000ff),
- (*(b_ptr + 2) & 0x000000ff), (*(b_ptr+3) & 0x000000ff),
- (loc_eng_data.agps_server_port & (0x0000ffff)));
+SIDE EFFECTS
+ N/A
- server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = url;
- server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len = strlen(url);
- LOGD ("set_agps_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val);
-#else
- char* buf = server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr;
- int buf_len = sizeof(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
- memset(buf, 0, buf_len);
- snprintf(buf, buf_len - 1, "%d.%d.%d.%d:%d",
- (*(b_ptr + 0) & 0x000000ff), (*(b_ptr+1) & 0x000000ff),
- (*(b_ptr + 2) & 0x000000ff), (*(b_ptr+3) & 0x000000ff),
- (loc_eng_data.agps_server_port & (0x0000ffff)));
-
- server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = buf_len;
- LOGD ("set_agps_server, addr = %s\n", buf);
-#endif
+===========================================================================*/
+static int loc_eng_data_conn_closed()
+{
+ INIT_CHECK("loc_eng_data_conn_closed");
+
+ LOC_LOGD("loc_eng_data_conn_closed");
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_CLOSED;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ return 0;
+}
- ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
- RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR,
- &ioctl_data,
- LOC_IOCTL_DEFAULT_TIMEOUT,
- NULL /* No output information is expected*/);
+/*===========================================================================
+FUNCTION loc_eng_data_conn_failed
- if (ret_val != TRUE)
- {
- LOGD ("set_agps_server failed\n");
- return -1;
- }
- else
- {
- LOGV ("set_agps_server successful\n");
- return 0;
- }
-}
+DESCRIPTION
+ This function is called when on-demand data connection opening has failed.
+It should inform ARM 9 about the data open result.
-static int loc_eng_agps_set_server(AGpsType type, const char* hostname, int port)
-{
- LOGD ("loc_eng_set_default_agps_server, type = %d, hostname = %s, port = %d\n", type, hostname, port);
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
- if (type != AGPS_TYPE_SUPL)
- return -1;
+SIDE EFFECTS
+ N/A
- strncpy(loc_eng_data.agps_server_host, hostname, sizeof(loc_eng_data.agps_server_host) - 1);
- loc_eng_data.agps_server_port = port;
- return 0;
+===========================================================================*/
+int loc_eng_data_conn_failed()
+{
+ INIT_CHECK("loc_eng_data_conn_failed");
+ LOC_LOGD("loc_eng_data_conn_failed");
+
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_FAILED;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ return 0;
}
/*===========================================================================
-FUNCTION loc_eng_delete_aiding_data_deferred_action
+FUNCTION loc_eng_set_apn
DESCRIPTION
- This is used to remove the aiding data when GPS engine is off.
+ This is used to inform the location engine of the apn name for the active
+ data connection. If there is no data connection, an empty apn name will
+ be used.
DEPENDENCIES
- Assumes the aiding data type specified in GpsAidingData matches with
- LOC API specification.
+ NONE
RETURN VALUE
- RPC_LOC_API_SUCCESS
+ 0
SIDE EFFECTS
N/A
===========================================================================*/
-static void loc_eng_delete_aiding_data_deferred_action (void)
+static int loc_eng_set_apn (const char* apn)
{
- // Currently, we only support deletion of all aiding data,
- // since the Android defined aiding data mask matches with modem,
- // so just pass them down without any translation
- rpc_loc_ioctl_data_u_type ioctl_data;
- rpc_loc_assist_data_delete_s_type *assist_data_ptr;
- boolean ret_val;
+ INIT_CHECK("loc_eng_set_apn");
- ioctl_data.disc = RPC_LOC_IOCTL_DELETE_ASSIST_DATA;
- assist_data_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete);
- assist_data_ptr->type = loc_eng_data.aiding_data_for_deletion;
- loc_eng_data.aiding_data_for_deletion = 0;
+ int apn_len;
- memset (&(assist_data_ptr->reserved), 0, sizeof (assist_data_ptr->reserved));
+ LOC_LOGD("loc_eng_set_apn: APN Name = [%s]\n", apn);
- ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
- RPC_LOC_IOCTL_DELETE_ASSIST_DATA ,
- &ioctl_data,
- LOC_IOCTL_DEFAULT_TIMEOUT,
- NULL);
+ if (apn != NULL)
+ {
+ apn_len = strlen (apn);
+
+#if 0 /* hack: temporarily allow NULL apn name */
+ if (apn_len == 0)
+ {
+ loc_eng_data.data_connection_is_on = FALSE;
+ }
+ else
+#endif
+
+ {
+ loc_eng_data.data_connection_is_on = TRUE;
- LOGD("loc_eng_ioctl for aiding data deletion returned %d, 1 for success\n", ret_val);
+ if (apn_len >= 100)
+ {
+ LOC_LOGE("loc_eng_set_apn: error, apn name exceeds maximum lenght of 100 chars\n");
+ apn_len = 100-1;
+ }
+
+ memcpy(loc_eng_data.apn_name, apn, apn_len);
+ loc_eng_data.apn_name[apn_len] = '\0';
+ }
+ }
+
+ return 0;
}
/*===========================================================================
-FUNCTION loc_eng_process_atl_deferred_action
+
+FUNCTION resolve_in_addr
DESCRIPTION
- This is used to inform the location engine of the processing status for
- data connection open/close request.
+ Translates a hostname to in_addr struct
DEPENDENCIES
- None
+ n/a
RETURN VALUE
- RPC_LOC_API_SUCCESS
+ TRUE if successful
SIDE EFFECTS
- N/A
+ n/a
===========================================================================*/
-static void loc_eng_process_atl_deferred_action (int flags)
+static boolean resolve_in_addr(const char *host_addr, struct in_addr *in_addr_ptr)
{
- rpc_loc_server_open_status_s_type *conn_open_status_ptr;
- rpc_loc_server_close_status_s_type *conn_close_status_ptr;
- rpc_loc_ioctl_data_u_type ioctl_data;
- boolean ret_val;
- int agps_status = -1;
+ struct hostent *hp;
+ hp = gethostbyname(host_addr);
+ if (hp != NULL) /* DNS OK */
+ {
+ memcpy(in_addr_ptr, hp->h_addr_list[0], hp->h_length);
+ }
+ else
+ {
+ /* Try IP representation */
+ if (inet_aton(host_addr, in_addr_ptr) == 0)
+ {
+ /* IP not valid */
+ LOC_LOGE("DNS query on '%s' failed\n", host_addr);
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
- LOGV("loc_eng_process_atl_deferred_action, agps_status = %d\n", loc_eng_data.agps_status);
+/*===========================================================================
+FUNCTION loc_eng_set_server
- memset (&ioctl_data, 0, sizeof (rpc_loc_ioctl_data_u_type));
-
- if (flags & DEFERRED_ACTION_AGPS_DATA_CLOSED)
- {
- ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
- conn_close_status_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status);
- conn_close_status_ptr->conn_handle = loc_eng_data.conn_handle;
- conn_close_status_ptr->close_status = RPC_LOC_SERVER_CLOSE_SUCCESS;
- }
- else
- {
- ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
- conn_open_status_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
- conn_open_status_ptr->conn_handle = loc_eng_data.conn_handle;
- if (flags & DEFERRED_ACTION_AGPS_DATA_SUCCESS)
- {
- conn_open_status_ptr->open_status = RPC_LOC_SERVER_OPEN_SUCCESS;
- // Both buffer are of the same maximum size, and the source is null terminated
- // strcpy (&(ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status.apn_name), &(loc_eng_data.apn_name));
-#if (AMSS_VERSION==3200)
- conn_open_status_ptr->apn_name = loc_eng_data.apn_name;
+DESCRIPTION
+ This is used to set the default AGPS server. Server address is obtained
+ from gps.conf.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_server(AGpsType type, const char* hostname, int port)
+{
+ unsigned 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;
+ struct in_addr addr;
+ boolean ret_val;
+ char url[256];
+
+ LOC_LOGD("loc_eng_set_server, type = %d, hostname = %s, port = %d\n", (int) type, hostname, port);
+
+ // Needed length
+ len = snprintf(url, sizeof url, "%s:%u", hostname, (unsigned) port);
+ if (len >= sizeof url)
+ {
+ LOC_LOGE("loc_eng_set_server, URL too long (len=%d).\n", len);
+ return -1;
+ }
+
+ // Actual length
+ len = strlen(url);
+
+ server_info_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr;
+
+ switch (type) {
+ case AGPS_TYPE_SUPL:
+ ioctl_cmd = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ 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||AMSS_VERSION==20000)
+ 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;
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val);
#else
- memset(conn_open_status_ptr->apn_name, 0, sizeof(conn_open_status_ptr->apn_name));
- strncpy(conn_open_status_ptr->apn_name, loc_eng_data.apn_name,
- sizeof(conn_open_status_ptr->apn_name) - 1);
-#endif
- // Delay this so that PDSM ATL module will behave properly
- sleep (1);
- LOGD("loc_eng_ioctl for ATL with apn_name = %s\n", conn_open_status_ptr->apn_name);
- }
- else // data_connection_failed
- {
- conn_open_status_ptr->open_status = RPC_LOC_SERVER_OPEN_FAIL;
- }
- // Delay this so that PDSM ATL module will behave properly
- sleep (1);
- }
+ 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);
+ LOC_LOGD ("loc_eng_set_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+#endif /* #if (AMSS_VERSION==3200||AMSS_VERSION==20000) */
+ break;
+
+ case AGPS_TYPE_C2K:
+ if (!resolve_in_addr(hostname, &addr))
+ {
+ LOC_LOGE("loc_eng_set_server, hostname %s cannot be resolved.\n", hostname);
+ return -2;
+ }
+
+ ioctl_cmd = RPC_LOC_IOCTL_SET_CDMA_PDE_SERVER_ADDR;
+ ioctl_data.disc = ioctl_cmd;
+ 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 = (uint32_t) htonl(addr.s_addr);
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.port = port;
+ LOC_LOGD ("loc_eng_set_server, addr = %X:%d\n",
+ (unsigned int) server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.ipv4.addr,
+ (unsigned int) port);
+
+ // Set C2K flag for Donut. In Eclair, C2K and UMTS will be identical
+ // at the HAL layer, and this will be obsolete.
+ loc_c2k_addr_is_set = 1;
+
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server, unknown server type = %d", (int) type);
+ return 0; /* note: error not indicated, since JNI doesn't check */
+ }
+
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ ioctl_cmd,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
- ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
- ioctl_data.disc,
- &ioctl_data,
- LOC_IOCTL_DEFAULT_TIMEOUT,
- NULL);
+ if (ret_val != TRUE)
+ {
+ LOC_LOGE("loc_eng_set_server failed\n");
+ }
+ else
+ {
+ LOC_LOGV("loc_eng_set_server successful\n");
+ }
- LOGD("loc_eng_ioctl for ATL returned %d (1 for success)\n", ret_val);
+ return 0;
}
/*===========================================================================
-FUNCTION loc_eng_process_loc_event
+FUNCTION loc_eng_set_server_proxy
DESCRIPTION
- This is used to process events received from the location engine.
+ If loc_eng_set_server is called before loc_eng_init, it doesn't work. This
+ proxy buffers server settings and calls loc_eng_set_server when the client is
+ open.
DEPENDENCIES
- None
+ NONE
RETURN VALUE
+ 0
+
+SIDE EFFECTS
N/A
+===========================================================================*/
+static int loc_eng_set_server_proxy(AGpsType type, const char* hostname, int port)
+{
+ if (loc_eng_inited)
+ {
+ loc_eng_set_server(type, hostname, port);
+ }
+ else {
+ LOC_LOGW("set_server called before init. save the address, type: %d, hostname: %s, port: %d",
+ (int) type, hostname, port);
+ switch (type)
+ {
+ case AGPS_TYPE_SUPL:
+ strlcpy(supl_host_buf, hostname, sizeof supl_host_buf);
+ supl_port_buf = port;
+ supl_host_set = 1;
+ break;
+ case AGPS_TYPE_C2K:
+ strlcpy(c2k_host_buf, hostname, sizeof c2k_host_buf);
+ c2k_port_buf = port;
+ c2k_host_set = 1;
+ break;
+ default:
+ LOC_LOGE("loc_eng_set_server_proxy, unknown server type = %d", (int) type);
+ }
+ }
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data_action
+
+DESCRIPTION
+ This is used to remove the aiding data when GPS engine is off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ None
+
SIDE EFFECTS
N/A
===========================================================================*/
-static void loc_eng_process_loc_event (rpc_loc_event_mask_type loc_event,
- rpc_loc_event_payload_u_type* loc_event_payload)
+static void loc_eng_delete_aiding_data_action(void)
{
- if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
- {
- loc_eng_report_position (&(loc_event_payload->rpc_loc_event_payload_u_type_u.parsed_location_report));
- }
+ // Currently, we only support deletion of all aiding data,
+ // since the Android defined aiding data mask matches with modem,
+ // so just pass them down without any translation
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_ioctl_e_type ioctl_type = RPC_LOC_IOCTL_DELETE_ASSIST_DATA;
+ rpc_loc_assist_data_delete_s_type *assist_data_ptr;
+ boolean ret_val;
+
+ assist_data_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete;
+ assist_data_ptr->type = loc_eng_data.aiding_data_for_deletion == GPS_DELETE_ALL ?
+ RPC_LOC_ASSIST_DATA_ALL : loc_eng_data.aiding_data_for_deletion;
+ loc_eng_data.aiding_data_for_deletion = 0;
+ memset(&assist_data_ptr->reserved, 0, sizeof assist_data_ptr->reserved);
+
+ ioctl_data.disc = ioctl_type;
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ ioctl_type,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL);
- if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
- {
- loc_eng_report_sv (&(loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report));
- }
+ LOC_LOGV("loc_eng_delete_aiding_data_action: %s\n", log_succ_fail_string(ret_val));
+}
- if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
- {
- loc_eng_report_status (&(loc_event_payload->rpc_loc_event_payload_u_type_u.status_report));
- }
+/*===========================================================================
+FUNCTION loc_eng_report_agps_status
- if (loc_event & RPC_LOC_EVENT_NMEA_POSITION_REPORT)
- {
- loc_eng_report_nmea (&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
- }
+DESCRIPTION
+ This functions calls the native callback function for GpsLocationProvider
+to update AGPS status. The expected behavior from GpsLocationProvider is the following.
- // Android XTRA interface 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)
- {
- LOGD ("loc_event_cb: xtra download requst");
+ For status GPS_REQUEST_AGPS_DATA_CONN, GpsLocationProvider will inform the open
+ status of the data connection if it is already open, or try to bring up a data
+ connection when it is not.
- // Call Registered callback
- if (loc_eng_data.xtra_module_data.download_request_cb != NULL)
- {
- loc_eng_data.xtra_module_data.download_request_cb ();
- }
- }
- }
+ For status GPS_RELEASE_AGPS_DATA_CONN, GpsLocationProvider will try to bring down
+ the data connection when it is open. (use this carefully)
- if (loc_event & RPC_LOC_EVENT_IOCTL_REPORT)
- {
- // Process the received RPC_LOC_EVENT_IOCTL_REPORT
- (void) loc_eng_ioctl_process_cb (loc_eng_data.client_handle,
- &(loc_event_payload->rpc_loc_event_payload_u_type_u.ioctl_report));
- }
+ Currently, no actions are taken for other status, such as GPS_AGPS_DATA_CONNECTED,
+ GPS_AGPS_DATA_CONN_DONE or GPS_AGPS_DATA_CONN_FAILED.
- if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
- {
- loc_eng_process_conn_request (&(loc_event_payload->rpc_loc_event_payload_u_type_u.loc_server_request));
- }
+DEPENDENCIES
+ None
- loc_eng_ni_callback(loc_event, loc_event_payload);
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_agps_status(AGpsType type, AGpsStatusValue status)
+{
+ if (loc_eng_data.agps_status_cb == NULL)
+ {
+ LOC_LOGE("loc_eng_report_agps_status, callback not initialized.\n");
+ return;
+ }
+
+ LOC_LOGD("loc_eng_report_agps_status, type = %d, status = %d\n",
+ (int) type, (int) status);
+
+ AGpsStatus agpsStatus = {sizeof(agpsStatus),type, status};
+ switch (status)
+ {
+ case GPS_REQUEST_AGPS_DATA_CONN:
+ loc_eng_data.agps_status_cb(&agpsStatus);
+ break;
+ case GPS_RELEASE_AGPS_DATA_CONN:
+ // This will not close always-on connection. Comment out if it does.
+ loc_eng_data.agps_status_cb(&agpsStatus);
+ break;
+ }
-#if DEBUG_MOCK_NI == 1
- // DEBUG only
- if ((loc_event & RPC_LOC_EVENT_STATUS_REPORT) &&
- loc_event_payload->rpc_loc_event_payload_u_type_u.status_report.
- payload.rpc_loc_status_event_payload_u_type_u.engine_state
- == RPC_LOC_ENGINE_STATE_OFF)
- {
- // Mock an NI request
- pthread_t th;
- pthread_create (&th, NULL, mock_ni, (void*) client_handle);
- }
-#endif /* DEBUG_MOCK_NI == 1 */
}
+
/*===========================================================================
-FUNCTION loc_eng_process_deferred_action
+FUNCTION loc_eng_process_atl_action
DESCRIPTION
- Main routine for the thread to execute certain commands
- that are not safe to be done from within an RPC callback.
+ This is used to inform the location engine of the processing status for
+ data connection open/close request.
DEPENDENCIES
None
RETURN VALUE
- None
+ RPC_LOC_API_SUCCESS
SIDE EFFECTS
N/A
===========================================================================*/
-static void loc_eng_process_deferred_action (void* arg)
+static void loc_eng_process_atl_action(AGpsStatusValue status)
+
{
- AGpsStatus status;
- status.size = sizeof(status);
- status.type = AGPS_TYPE_SUPL;
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr;
+ AGpsType agps_type;
+ boolean ret_val;
+
+ LOC_LOGD("loc_eng_process_atl_action, AGpsStatusValue = %d,data on = %d, APN = [%s]\n",
+ status,loc_eng_data.data_connection_is_on, loc_eng_data.apn_name);
+
+ // Pass a dont care as the AGPS type as it is in any case discarded by GpsLocationProvider
+ agps_type = DONT_CARE;
+
+ if (status == GPS_RELEASE_AGPS_DATA_CONN)
+ {
+ // Inform GpsLocationProvider (subject to cancellation if data call should not be bring down)
+ loc_eng_report_agps_status(
+ agps_type,
+ GPS_RELEASE_AGPS_DATA_CONN
+ );
+ }
+ else if (status == GPS_REQUEST_AGPS_DATA_CONN)
+ {
+ // Use GpsLocationProvider to bring up the data call if not yet open
+ loc_eng_report_agps_status(
+ agps_type,
+ GPS_REQUEST_AGPS_DATA_CONN
+ );
+ }
+}
- LOGD("loc_eng_process_deferred_action started\n");
+#ifdef LIBLOC_USE_GPS_PRIVACY_LOCK
+static int loc_eng_set_gps_lock(rpc_loc_lock_e_type lock_type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
- // make sure we do not run in background scheduling group
- set_sched_policy(gettid(), SP_FOREGROUND);
+ LOGD ("loc_eng_set_gps_lock mode, client = %d, lock_type = %d\n",
+ (int32) loc_eng_data.client_handle, lock_type);
- // disable the GPS lock
- LOGD("Setting GPS privacy lock to RPC_LOC_LOCK_NONE\n");
- loc_eng_set_gps_lock(RPC_LOC_LOCK_NONE);
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = lock_type;
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_ENGINE_LOCK;
- while (1)
- {
- GpsAidingData aiding_data_for_deletion;
- GpsStatusValue engine_status;
+ 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*/);
- rpc_loc_event_mask_type loc_event;
- rpc_loc_event_payload_u_type loc_event_payload;
+ return ret_val;
+}
+#endif
- // Wait until we are signalled to do a deferred action, or exit
- pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+/*===========================================================================
+FUNCTION loc_eng_deferred_action_thread
- // If we have an event we should process it immediately,
- // otherwise wait until we are signalled
- if (loc_eng_data.deferred_action_flags == 0) {
+DESCRIPTION
+ Main routine for the thread to execute certain commands
+ that are not safe to be done from within an RPC callback.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_deferred_action_thread(void* arg)
+{
+ AGpsStatusValue status;
+ LOC_LOGD("loc_eng_deferred_action_thread started\n");
+
+#ifdef LIBLOC_USE_GPS_PRIVACY_LOCK
+ loc_eng_set_gps_lock(RPC_LOC_LOCK_NONE);
+#endif
+
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+ while (1)
+ {
+ GpsAidingData aiding_data_for_deletion;
+ GpsStatusValue engine_status;
+ boolean data_connection_succeeded;
+ boolean data_connection_closed;
+ boolean data_connection_failed;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type loc_event_payload;
+
+ // Wait until we are signalled to do a deferred action, or exit
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+
+ // If we have an event we should process it immediately,
+ // otherwise wait until we are signalled
+ if (loc_eng_data.deferred_action_flags == 0) {
// do not hold a wake lock while waiting for an event...
loc_eng_data.release_wakelock_cb();
+ LOC_LOGD("loc_eng_deferred_action_thread. waiting for events\n");
pthread_cond_wait(&loc_eng_data.deferred_action_cond,
&loc_eng_data.deferred_action_mutex);
+ LOC_LOGD("loc_eng_deferred_action_thread signalled\n");
// but after we are signalled reacquire the wake lock
// until we are done processing the event.
loc_eng_data.acquire_wakelock_cb();
- }
-
- if (loc_eng_data.deferred_action_flags & DEFERRED_ACTION_QUIT)
- {
- pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
- break;
- }
-
- // copy anything we need before releasing the mutex
- loc_event = loc_eng_data.loc_event;
- if (loc_event != 0) {
- memcpy(&loc_event_payload, &loc_eng_data.loc_event_payload, sizeof(loc_event_payload));
- loc_eng_data.loc_event = 0;
- }
-
- int flags = loc_eng_data.deferred_action_flags;
- loc_eng_data.deferred_action_flags = 0;
- engine_status = loc_eng_data.agps_status;
- aiding_data_for_deletion = loc_eng_data.aiding_data_for_deletion;
- status.status = loc_eng_data.agps_status;
- loc_eng_data.agps_status = 0;
-
- // perform all actions after releasing the mutex to avoid blocking RPCs from the ARM9
- pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
-
- if (loc_event != 0) {
- loc_eng_process_loc_event(loc_event, &loc_event_payload);
- }
-
- // send_delete_aiding_data must be done when GPS engine is off
- if ((engine_status != GPS_STATUS_SESSION_BEGIN) && (aiding_data_for_deletion != 0))
- {
- loc_eng_delete_aiding_data_deferred_action ();
- }
-
- if (flags & (DEFERRED_ACTION_AGPS_DATA_SUCCESS |
- DEFERRED_ACTION_AGPS_DATA_CLOSED |
- DEFERRED_ACTION_AGPS_DATA_FAILED))
- {
- loc_eng_process_atl_deferred_action(flags);
-
- pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
- // work around problem with loc_eng_stop when AGPS requests are pending
- // we defer stopping the engine until the AGPS request is done
- loc_eng_data.agps_request_pending = false;
- if (loc_eng_data.stop_request_pending)
- {
- LOGD ("handling deferred stop\n");
- if (loc_stop_fix(loc_eng_data.client_handle) != RPC_LOC_API_SUCCESS)
- {
- LOGD ("loc_stop_fix failed!\n");
- }
- }
- pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
- }
-
- if (status.status != 0 && loc_eng_data.agps_status_cb) {
- loc_eng_data.agps_status_cb(&status);
- }
- }
-
- // reenable the GPS lock
- LOGD("Setting GPS privacy lock to RPC_LOC_LOCK_ALL\n");
- loc_eng_set_gps_lock(RPC_LOC_LOCK_ALL);
-
- LOGD("loc_eng_process_deferred_action thread exiting\n");
- loc_eng_data.release_wakelock_cb();
-
- loc_eng_data.deferred_action_thread = 0;
+ }
+ if (loc_eng_data.deferred_action_flags & DEFERRED_ACTION_QUIT)
+ {
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+ break; /* exit thread */
+ }
+ // copy anything we need before releasing the mutex
+ loc_event = loc_eng_data.loc_event;
+ if (loc_event != 0) {
+ LOC_LOGD("loc_eng_deferred_action_thread event %llu\n",loc_event);
+ memcpy(&loc_event_payload, &loc_eng_data.loc_event_payload, sizeof(loc_event_payload));
+ loc_eng_data.loc_event = 0;
+ }
+ int flags = loc_eng_data.deferred_action_flags;
+ loc_eng_data.deferred_action_flags = 0;
+ engine_status = loc_eng_data.engine_status;
+ aiding_data_for_deletion = loc_eng_data.aiding_data_for_deletion;
+ status = loc_eng_data.agps_status;
+ loc_eng_data.agps_status = 0;
+
+ // perform all actions after releasing the mutex to avoid blocking RPCs from the ARM9
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+
+ if (loc_event != 0) {
+ loc_eng_process_loc_event(loc_event, &loc_event_payload);
+ }
+
+ // Send_delete_aiding_data must be done when GPS engine is off
+ if ((engine_status != GPS_STATUS_ENGINE_ON) && (aiding_data_for_deletion != 0))
+ {
+ loc_eng_delete_aiding_data_action();
+ loc_eng_data.aiding_data_for_deletion = 0;
+ }
+
+ // Inject XTRA data when GPS engine is off
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON &&
+ loc_eng_data.xtra_module_data.xtra_data_for_injection != NULL)
+ {
+ loc_eng_inject_xtra_data_in_buffer();
+ }
+
+ //Process connectivity manager events at this point
+ if(flags & DEFERRED_ACTION_AGPS_DATA_SUCCESS)
+ {
+ loc_eng_ioctl_data_open_status(SUCCESS);
+ if(flags & DEFERRED_ACTION_AGPS_DATA_CLOSED)
+ {
+ LOC_LOGE("Error condition in the ATL events posted by GpsLocationProvider\n");
+ }
+ }else if(flags & DEFERRED_ACTION_AGPS_DATA_CLOSED)
+ {
+ loc_eng_ioctl_data_close_status(SUCCESS);
+ }else if(flags & DEFERRED_ACTION_AGPS_DATA_FAILED)
+ {
+ if(loc_eng_data.data_connection_is_on == TRUE)
+ {
+ loc_eng_ioctl_data_open_status(FAILURE);
+ }else
+ {
+ loc_eng_ioctl_data_close_status(FAILURE);
+ }
+ loc_eng_data.data_connection_is_on = FALSE;
+ }
+ if (flags & (DEFERRED_ACTION_AGPS_DATA_SUCCESS |
+ DEFERRED_ACTION_AGPS_DATA_CLOSED |
+ DEFERRED_ACTION_AGPS_DATA_FAILED))
+ {
+ pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
+ // work around problem with loc_eng_stop when AGPS requests are pending
+ // we defer stopping the engine until the AGPS request is done
+ loc_eng_data.agps_request_pending = false;
+ if (loc_eng_data.stop_request_pending)
+ {
+ LOC_LOGD ("handling deferred stop\n");
+ if (loc_stop_fix(loc_eng_data.client_handle) != RPC_LOC_API_SUCCESS)
+ {
+ LOC_LOGD ("loc_stop_fix failed!\n");
+ }
+ }
+ pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
+ }
+
+ // ATL open/close actions
+ if (status != 0 )
+ {
+ loc_eng_process_atl_action(status);
+ status = 0;
+ }
+ }
+
+#ifdef LIBLOC_USE_GPS_PRIVACY_LOCK
+ loc_eng_set_gps_lock(RPC_LOC_LOCK_ALL);
+#endif
+ LOC_LOGD("loc_eng_deferred_action_thread exiting\n");
+ loc_eng_data.release_wakelock_cb();
+ loc_eng_data.deferred_action_thread = 0;
}
// for gps.c
@@ -1535,3 +2259,4 @@ extern "C" const GpsInterface* get_gps_interface()
{
return &sLocEngInterface;
}
+
diff --git a/loc_api/libloc_api/loc_eng.h b/loc_api/libloc_api/loc_eng.h
index 39f3d91..b3c714b 100755
--- a/loc_api/libloc_api/loc_eng.h
+++ b/loc_api/libloc_api/loc_eng.h
@@ -1,39 +1,38 @@
-/******************************************************************************
- @file: loc_eng.h
- @brief:
-
- DESCRIPTION
- This file defines the global data structure used by this module.
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
-Copyright (c) 2009, QUALCOMM USA, INC.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -----------------------------------------------------------------------------
-
-******************************************************************************/
-
-/*=====================================================================
-$Header: $
-$DateTime: $
-$Author: $
-======================================================================*/
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
#ifndef LOC_ENG_H
#define LOC_ENG_H
+// Uncomment to keep all LOG messages (LOGD, LOGI, LOGV, etc.)
+// #define LOG_NDEBUG 0
+
// Define boolean type to be used by libgps on loc api module
typedef unsigned char boolean;
@@ -47,10 +46,27 @@ typedef unsigned char boolean;
#include <loc_eng_ioctl.h>
#include <loc_eng_xtra.h>
-#include <hardware/gps.h>
+#include <loc_eng_ni.h>
+#include <loc_eng_log.h>
+#include <loc_eng_cfg.h>
#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+// The data connection minimal open time
+#define DATA_OPEN_MIN_TIME 1 /* sec */
+
+// The system sees GPS engine turns off after inactive for this period of time
+#define GPS_AUTO_OFF_TIME 2 /* secs */
+//To signify that when requesting a data connection HAL need not specify whether CDMA or UMTS
+#define DONT_CARE 0
+
+#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */
+enum loc_mute_session_e_type {
+ LOC_MUTE_SESS_NONE,
+ LOC_MUTE_SESS_WAIT,
+ LOC_MUTE_SESS_IN_SESSION
+};
+
enum {
DEFERRED_ACTION_EVENT = 0x01,
DEFERRED_ACTION_DELETE_AIDING = 0x02,
@@ -64,56 +80,81 @@ enum {
// Module data
typedef struct
{
- rpc_loc_client_handle_type client_handle;
-
- gps_location_callback location_cb;
- gps_status_callback status_cb;
- gps_sv_status_callback sv_status_cb;
- agps_status_callback agps_status_cb;
- gps_nmea_callback nmea_cb;
- gps_ni_notify_callback ni_notify_cb;
- gps_acquire_wakelock acquire_wakelock_cb;
- gps_release_wakelock release_wakelock_cb;
- int agps_status;
-
- // used to defer stopping the GPS engine until AGPS data calls are done
- boolean agps_request_pending;
- boolean stop_request_pending;
- pthread_mutex_t deferred_stop_mutex;
-
- loc_eng_xtra_data_s_type xtra_module_data;
-
- loc_eng_ioctl_data_s_type ioctl_data;
-
- // data from loc_event_cb
- rpc_loc_event_mask_type loc_event;
- rpc_loc_event_payload_u_type loc_event_payload;
-
- // TBD:
- char agps_server_host[256];
- int agps_server_port;
- uint32 agps_server_address;
- char apn_name[100];
- int position_mode;
- rpc_loc_server_connection_handle conn_handle;
-
- // GPS engine status
- GpsStatusValue engine_status;
-
- // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
- GpsAidingData aiding_data_for_deletion;
-
- // Data variables used by deferred action thread
- pthread_t deferred_action_thread;
- // Mutex used by deferred action thread
- pthread_mutex_t deferred_action_mutex;
- // Condition variable used by deferred action thread
- pthread_cond_t deferred_action_cond;
-
- // flags for pending events for deferred action thread
- int deferred_action_flags;
+ rpc_loc_client_handle_type client_handle;
+
+ gps_location_callback location_cb;
+ gps_status_callback status_cb;
+ gps_sv_status_callback sv_status_cb;
+ agps_status_callback agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ AGpsStatusValue agps_status;
+ // used to defer stopping the GPS engine until AGPS data calls are done
+ boolean agps_request_pending;
+ boolean stop_request_pending;
+ pthread_mutex_t deferred_stop_mutex;
+ loc_eng_xtra_data_s_type xtra_module_data;
+ // data from loc_event_cb
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type loc_event_payload;
+
+ boolean client_opened;
+ boolean navigating;
+ boolean data_connection_is_on;
+
+ // ATL variables
+ char apn_name[100];
+ rpc_loc_server_connection_handle conn_handle;
+ time_t data_conn_open_time;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+ GpsStatusValue fix_session_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // IOCTL CB lock
+ pthread_mutex_t ioctl_cb_lock;
+
+ // Data variables used by deferred action thread
+ pthread_t deferred_action_thread;
+
+ // Timer thread (wakes up every second)
+ pthread_t timer_thread;
+
+ // Mutex used by deferred action thread
+ pthread_mutex_t deferred_action_mutex;
+ // Condition variable used by deferred action thread
+ pthread_cond_t deferred_action_cond;
+ // flags for pending events for deferred action thread
+ int deferred_action_flags;
+ // For muting session broadcast
+ pthread_mutex_t mute_session_lock;
+ loc_mute_session_e_type mute_session_state;
+
} loc_eng_data_s_type;
-
+
extern loc_eng_data_s_type loc_eng_data;
+extern void loc_eng_mute_one_session();
+
+/* LOGGING MACROS */
+#define LOC_LOGE(...) \
+if (gps_conf.DEBUG_LEVEL >= 1) { LOGE(__VA_ARGS__); }
+
+#define LOC_LOGW(...) \
+if (gps_conf.DEBUG_LEVEL >= 2) { LOGW(__VA_ARGS__); }
+
+#define LOC_LOGI(...) \
+if (gps_conf.DEBUG_LEVEL >= 3) { LOGI(__VA_ARGS__); }
+
+#define LOC_LOGD(...) \
+if (gps_conf.DEBUG_LEVEL >= 4) { LOGD(__VA_ARGS__); }
+
+#define LOC_LOGV(...) \
+if (gps_conf.DEBUG_LEVEL >= 5) { LOGV(__VA_ARGS__); }
+
#endif // LOC_ENG_H
diff --git a/loc_api/libloc_api/loc_eng_cfg.cpp b/loc_api/libloc_api/loc_eng_cfg.cpp
new file mode 100644
index 0000000..c554aaf
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_cfg.cpp
@@ -0,0 +1,235 @@
+/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <hardware/gps.h>
+
+#include <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <loc_eng.h>
+
+#define LOG_TAG "libloc"
+#include <utils/Log.h>
+
+/*=============================================================================
+ *
+ * GLOBAL DATA DECLARATION
+ *
+ *============================================================================*/
+
+/* Parameter data */
+loc_gps_cfg_s_type gps_conf;
+
+/* Parameter spec table */
+
+loc_param_s_type loc_parameter_table[] =
+{
+ {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, 'n'},
+ {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, 'n'},
+ {"ENABLE_WIPER", &gps_conf.ENABLE_WIPER, 'n'},
+ /* DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
+ 4 - Debug, 5 - Verbose */
+ {"DEBUG_LEVEL", &gps_conf.DEBUG_LEVEL, 'n'},
+};
+
+int loc_param_num = sizeof(loc_parameter_table) / sizeof(loc_param_s_type);
+
+/*===========================================================================
+FUNCTION loc_default_parameters
+
+DESCRIPTION
+ Resets the parameters to default
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+
+static void loc_default_parameters()
+{
+ /* defaults */
+ gps_conf.INTERMEDIATE_POS = 0;
+ gps_conf.ACCURACY_THRES = 0;
+ gps_conf.ENABLE_WIPER = 0;
+ gps_conf.DEBUG_LEVEL = 4; /* debug level */
+}
+
+/*===========================================================================
+FUNCTION trim_space
+
+DESCRIPTION
+ Removes leading and trailing spaces of the string
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void trim_space(char *org_string)
+{
+ char *scan_ptr, *write_ptr;
+ char *first_nonspace = NULL, *last_nonspace = NULL;
+
+ scan_ptr = write_ptr = org_string;
+
+ while (*scan_ptr)
+ {
+ if ( !isspace(*scan_ptr) && first_nonspace == NULL)
+ {
+ first_nonspace = scan_ptr;
+ }
+
+ if (first_nonspace != NULL)
+ {
+ *(write_ptr++) = *scan_ptr;
+ if ( !isspace(*scan_ptr))
+ {
+ last_nonspace = write_ptr;
+ }
+ }
+
+ scan_ptr++;
+ }
+
+ if (last_nonspace) { *last_nonspace = '\0'; }
+}
+
+/*===========================================================================
+FUNCTION loc_read_gps_conf
+
+DESCRIPTION
+ Reads the gps.conf file and sets global parameter data
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+===========================================================================*/
+void loc_read_gps_conf(void)
+{
+ FILE *gps_conf_fp = NULL;
+ char input_buf[LOC_MAX_PARAM_LINE]; /* declare a char array */
+ char *lasts;
+ char *param_name, *param_str_value;
+ int param_value;
+ int i;
+
+ loc_default_parameters();
+
+ if((gps_conf_fp = fopen(GPS_CONF_FILE, "r")) != NULL)
+ {
+ LOC_LOGD("loc_read_gps_conf: using %s", GPS_CONF_FILE);
+ }
+ else
+ {
+ LOC_LOGW("loc_read_gps_conf: no %s file, using defaults", GPS_CONF_FILE);
+ return; /* no parameter file */
+ }
+
+ while(fgets(input_buf, LOC_MAX_PARAM_LINE, gps_conf_fp) != NULL)
+ {
+ /* Separate variable and value */
+ param_name = strtok_r(input_buf, "=", &lasts);
+ if (param_name == NULL) continue; /* skip lines that do not contain "=" */
+ param_str_value = strtok_r(NULL, "=", &lasts);
+ if (param_str_value == NULL) continue; /* skip lines that do not contain two operands */
+
+ /* Trim leading and trailing spaces */
+ trim_space(param_name);
+ trim_space(param_str_value);
+
+ // printf("*(%s) = (%s)\n", param_name, param_str_value);
+
+ /* Parse numerical value */
+ if (param_str_value[0] == '0' && tolower(param_str_value[1]) == 'x')
+ {
+ /* hex */
+ param_value = (int) strtol(&param_str_value[2], (char**) NULL, 16);
+ }
+ else {
+ /* dec */
+ param_value = atoi(param_str_value); /* dec */
+ }
+
+ for(i = 0; i < loc_param_num; i++)
+ {
+ if (strcmp(loc_parameter_table[i].param_name, param_name) == 0 &&
+ loc_parameter_table[i].param_ptr)
+ {
+ switch (loc_parameter_table[i].param_type)
+ {
+ case 's':
+ if (strcmp(param_str_value, "NULL") == 0)
+ {
+ *((char*)loc_parameter_table[i].param_ptr) = '\0';
+ }
+ else {
+ strlcpy((char*) loc_parameter_table[i].param_ptr,
+ param_str_value,
+ LOC_MAX_PARAM_STRING + 1);
+ }
+ /* Log INI values */
+ LOC_LOGD("loc_read_gps_conf: PARAM %s = %s\n", param_name, (char*)loc_parameter_table[i].param_ptr);
+ break;
+ case 'n':
+ *((int *)loc_parameter_table[i].param_ptr) = param_value;
+ /* Log INI values */
+ LOC_LOGD("loc_read_gps_conf: PARAM %s = %d\n", param_name, param_value);
+ break;
+ default:
+ LOC_LOGE("loc_read_gps_conf: PARAM %s parameter type must be n or n", param_name);
+ }
+ }
+ }
+ }
+
+ fclose(gps_conf_fp);
+}
diff --git a/loc_api/libloc_api/loc_eng_cfg.h b/loc_api/libloc_api/loc_eng_cfg.h
new file mode 100644
index 0000000..22c1966
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_cfg.h
@@ -0,0 +1,76 @@
+/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_CFG_H
+#define LOC_ENG_CFG_H
+
+#define LOC_MAX_PARAM_NAME 36
+#define LOC_MAX_PARAM_STRING 80
+#define LOC_MAX_PARAM_LINE 80
+
+#define GPS_CONF_FILE "/etc/gps.conf" /* primary */
+
+/*=============================================================================
+ *
+ * MODULE TYPE DECLARATION
+ *
+ *============================================================================*/
+typedef struct
+{
+ char param_name[LOC_MAX_PARAM_NAME];
+ void *param_ptr;
+ char param_type; /* 's' for number; 's' for string */
+} loc_param_s_type;
+
+/* GPS.conf support */
+typedef struct loc_gps_cfg_s
+{
+ unsigned long INTERMEDIATE_POS;
+ unsigned long ACCURACY_THRES;
+ unsigned long ENABLE_WIPER;
+ unsigned long DEBUG_LEVEL;
+ // char string_val[LOC_MAX_PARAM_STRING + 1]; /* An example string value */
+} loc_gps_cfg_s_type;
+
+/*=============================================================================
+ *
+ * MODULE EXTERNAL DATA
+ *
+ *============================================================================*/
+
+extern loc_gps_cfg_s_type gps_conf;
+
+/*=============================================================================
+ *
+ * MODULE EXPORTED FUNCTIONS
+ *
+ *============================================================================*/
+extern void loc_read_gps_conf(void);
+
+#endif /* LOC_ENG_CFG_H */
diff --git a/loc_api/libloc_api/loc_eng_ioctl.cpp b/loc_api/libloc_api/loc_eng_ioctl.cpp
index 87ca5b0..d3ae822 100755
--- a/loc_api/libloc_api/loc_eng_ioctl.cpp
+++ b/loc_api/libloc_api/loc_eng_ioctl.cpp
@@ -1,36 +1,32 @@
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
-/******************************************************************************
- @file: loc_eng.cpp
- @brief:
-
- DESCRIPTION
- This file defines the implemenation for GPS hardware abstraction layer.
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
-Copyright (c) 2009, QUALCOMM USA, INC.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -----------------------------------------------------------------------------
-
-******************************************************************************/
-
-/*=====================================================================
-$Header: $
-$DateTime: $
-$Author: $
-======================================================================*/
#define LOG_NDDEBUG 0
#include <stdio.h>
@@ -48,24 +44,15 @@ $Author: $
#include <loc_eng.h>
-#define LOG_TAG "lib_locapi"
+#define LOG_TAG "libloc"
#include <utils/Log.h>
+#include <loc_api_sync_call.h>
+
// comment this out to enable logging
// #undef LOGD
// #define LOGD(...) {}
-// Function declarations
-static boolean loc_eng_ioctl_setup_cb(
- rpc_loc_client_handle_type handle,
- rpc_loc_ioctl_e_type ioctl_type
-);
-
-static boolean loc_eng_ioctl_wait_cb(
- int timeout_msec, // Timeout in this number of msec
- rpc_loc_ioctl_callback_s_type *cb_data_ptr // Output parameter for IOCTL calls
-);
-
/*===========================================================================
FUNCTION loc_eng_ioctl
@@ -85,274 +72,26 @@ SIDE EFFECTS
N/A
===========================================================================*/
-boolean 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
- )
-{
- boolean ret_val;
- int rpc_ret_val;
- loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
-
- LOGV ("loc_eng_ioctl: client = %d, ioctl_type = %d, cb_data =0x%x\n", (int32) handle, ioctl_type, (uint32) cb_data_ptr);
-
- ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
- // Select the callback we are waiting for
- ret_val = loc_eng_ioctl_setup_cb (handle, ioctl_type);
-
- if (ret_val == TRUE)
- {
- rpc_ret_val = loc_ioctl (handle,
- ioctl_type,
- ioctl_data_ptr);
-
- LOGV ("loc_eng_ioctl: loc_ioctl returned %d \n", rpc_ret_val);
-
- if (rpc_ret_val == RPC_LOC_API_SUCCESS)
- {
- // Wait for the callback of loc_ioctl
- ret_val = loc_eng_ioctl_wait_cb (timeout_msec, cb_data_ptr);
- }
- else
- {
- ret_val = FALSE;
- }
- }
-
- // Reset the state when we are done
- pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
- ioctl_cb_data_ptr->cb_is_selected = FALSE;
- ioctl_cb_data_ptr->cb_is_waiting = FALSE;
- ioctl_cb_data_ptr->cb_has_arrived = FALSE;
- pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
-
- return ret_val;
-}
-
-
-/*===========================================================================
-
-FUNCTION loc_eng_ioctl_setup_cb
-
-DESCRIPTION
- Selects which callback is going to be waited for
-
-DEPENDENCIES
- N/A
-
-RETURN VALUE
- TRUE if successful
- FALSE if failed
-
-SIDE EFFECTS
- N/A
-
-===========================================================================*/
-static boolean loc_eng_ioctl_setup_cb(
- rpc_loc_client_handle_type handle,
- rpc_loc_ioctl_e_type ioctl_type
- )
-{
- boolean ret_val;
- loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
-
- ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
-
- pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
- if (ioctl_cb_data_ptr->cb_is_selected == TRUE)
- {
- LOGD ("loc_eng_ioctl_setup_cb: ERROR, another ioctl in progress \n");
- ret_val = FALSE;
- }
- else
- {
- ioctl_cb_data_ptr->cb_is_selected = TRUE;
- ioctl_cb_data_ptr->cb_is_waiting = FALSE;
- ioctl_cb_data_ptr->cb_has_arrived = FALSE;
- ioctl_cb_data_ptr->client_handle = handle;
- ioctl_cb_data_ptr->ioctl_type = ioctl_type;
- memset (&(ioctl_cb_data_ptr->cb_payload), 0, sizeof (rpc_loc_ioctl_callback_s_type));
- ret_val = TRUE;
- }
- pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
-
- return ret_val;
-}
-
-/*===========================================================================
-
-FUNCTION loc_eng_ioctl_wait_cb
-
-DESCRIPTION
- Waits for a selected callback. The wait expires in timeout_msec.
-
- If the function is called before an existing wait has finished, it will
- immediately return EBUSY.
-
-DEPENDENCIES
- N/A
-
-RETURN VALUE
- TRUE if successful
- FALSE if failed
-
-SIDE EFFECTS
- N/A
-
-===========================================================================*/
-boolean loc_eng_ioctl_wait_cb(
- int timeout_msec, // Timeout in this number of msec
- rpc_loc_ioctl_callback_s_type *cb_data_ptr
- )
+boolean 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
+)
{
- boolean ret_val = FALSE; // the return value of this function
- int rc; // return code from pthread calls
-
- struct timeval present_time;
- struct timespec expire_time;
- loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
-
- ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
-
- pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
-
- do {
- if (ioctl_cb_data_ptr->cb_is_selected == FALSE)
- {
- LOGD ("loc_eng_ioctl_wait_cb: ERROR called when cb_is_waiting is set to FALSE \n");
- ret_val = FALSE;
- break;
- }
-
- // Calculate absolute expire time
- gettimeofday(&present_time, NULL);
- expire_time.tv_sec = present_time.tv_sec;
- expire_time.tv_sec += timeout_msec / 1000;
- if ((present_time.tv_usec + timeout_msec) >= 1000)
- {
- expire_time.tv_sec += 1;
- }
- expire_time.tv_nsec = (present_time.tv_usec + timeout_msec) % 1000 * 1000;
-
- // Special case where callback is issued before loc_ioctl ever returns
- if (ioctl_cb_data_ptr->cb_has_arrived == TRUE)
- {
- LOGD ("loc_eng_ioctl_wait_cb: cb has arrived without waiting \n");
- ret_val = TRUE;
- break;
- }
-
- ioctl_cb_data_ptr->cb_is_waiting = TRUE;
- // Wait for the callback until timeout expires
- rc = pthread_cond_timedwait(&ioctl_cb_data_ptr->cb_arrived_cond,
- &ioctl_cb_data_ptr->cb_data_mutex,
- &expire_time);
-
- if (rc == 0)
- {
- ret_val = TRUE;
- }
- else
- {
- ret_val = FALSE;
- }
-
- LOGV ("loc_eng_ioctl_wait_cb: pthread_cond_timedwait returned %d\n", rc);
-
- } while (0);
-
- // Process the ioctl callback data when IOCTL is successful
- if (ret_val == TRUE)
- {
- ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
- if (ioctl_cb_data_ptr->cb_payload.status == RPC_LOC_API_SUCCESS)
- {
- ret_val = TRUE;
- if (cb_data_ptr != NULL)
- {
- memcpy (cb_data_ptr,
- &(ioctl_cb_data_ptr->cb_payload),
- sizeof (rpc_loc_ioctl_callback_s_type));
- }
- }
- else
- {
- ret_val = FALSE;
- }
- }
-
- pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
-
- LOGV ("loc_eng_ioctl_wait_cb: returned %d\n", ret_val);
- return ret_val;
-}
-
-/*===========================================================================
-
-FUNCTION loc_eng_ioctl_process_cb
-
-DESCRIPTION
- This function process the IOCTL callback, parameter specifies the client
- that receives the IOCTL callback.
-
-DEPENDENCIES
- N/A
-
-RETURN VALUE
- TRUE if successful
- FALSE if failed
-
-SIDE EFFECTS
- N/A
-
-===========================================================================*/
-boolean loc_eng_ioctl_process_cb (
- rpc_loc_client_handle_type client_handle,
- const rpc_loc_ioctl_callback_s_type *cb_data_ptr
- )
-{
- boolean ret_val = FALSE; // the return value of this function
- loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
- ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
-
- pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
- if (client_handle != ioctl_cb_data_ptr->client_handle)
- {
- LOGD ("loc_eng_ioctl_process_cb: client handle mismatch, received = %d, expected = %d \n",
- (int32) client_handle, (int32) ioctl_cb_data_ptr->client_handle);
- ret_val = FALSE;
- }
- else if (cb_data_ptr->type != ioctl_cb_data_ptr->ioctl_type)
- {
- LOGD ("loc_eng_ioctl_process_cb: ioctl type mismatch, received = %d, expected = %d \n",
- cb_data_ptr->type, ioctl_cb_data_ptr->ioctl_type);
- ret_val = FALSE;
- }
- else // both matches
- {
- memcpy (&(ioctl_cb_data_ptr->cb_payload),
- cb_data_ptr,
- sizeof (rpc_loc_ioctl_callback_s_type));
-
- ioctl_cb_data_ptr->cb_has_arrived = TRUE;
-
- LOGV ("loc_eng_ioctl_process_cb: callback arrived for client = %d, ioctl = %d, status = %d\n",
- (int32) ioctl_cb_data_ptr->client_handle, ioctl_cb_data_ptr->ioctl_type,
- (int32) ioctl_cb_data_ptr->cb_payload.status);
+ int ret_val = RPC_LOC_API_SUCCESS;
- ret_val = TRUE;
- }
+ LOC_LOGD("loc_eng_ioctl called: client = %d, ioctl_type = %s\n", (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type));
- pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
+ ret_val = loc_api_sync_ioctl(handle, ioctl_type, ioctl_data_ptr, timeout_msec, cb_data_ptr);
- // Signal the waiting thread that callback has arrived
- if (ret_val == TRUE)
- {
- pthread_cond_signal (&ioctl_cb_data_ptr->cb_arrived_cond);
- }
+ LOC_LOGD("loc_eng_ioctl result: client = %d, ioctl_type = %s, %s\n",
+ (int32) handle,
+ loc_get_ioctl_type_name(ioctl_type),
+ loc_get_ioctl_status_name(ret_val) );
- return ret_val;
+ return ret_val == RPC_LOC_API_SUCCESS;
}
diff --git a/loc_api/libloc_api/loc_eng_ioctl.h b/loc_api/libloc_api/loc_eng_ioctl.h
index 4090a4d..9e16630 100755
--- a/loc_api/libloc_api/loc_eng_ioctl.h
+++ b/loc_api/libloc_api/loc_eng_ioctl.h
@@ -1,75 +1,42 @@
-/******************************************************************************
- @file: loc_eng_ioctl.h
- @brief:
-
- DESCRIPTION
- This file defines the data structure used by any location client that
- waits for the ioctl particular event to occur. Any one IOCTL can be pending
- at any time.
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
-Copyright (c) 2009, QUALCOMM USA, INC.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -----------------------------------------------------------------------------
-
-******************************************************************************/
-
-/*=====================================================================
-$Header: $
-$DateTime: $
-$Author: $
-======================================================================*/
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
#ifndef LOC_ENG_IOCTL_H
#define LOC_ENG_IOCTL_H
-// Module data
-typedef struct loc_eng_ioctl_data_s_type
-{
- // We are waiting for an ioctl callback
- boolean cb_is_selected;
- // The thread has been put in a wait state for an ioctl callback
- boolean cb_is_waiting;
- // Loc client handle that is waiting for the callback
- rpc_loc_client_handle_type client_handle;
- // IOCTL type that the loc client is waiting for
- rpc_loc_ioctl_e_type ioctl_type;
- // The IOCLT report has arrived for the waiting client
- boolean cb_has_arrived;
- // The payload for the RPC_LOC_EVENT_IOCTL_REPORT
- rpc_loc_ioctl_callback_s_type cb_payload;
- // Mutex to access this data structure
- pthread_mutex_t cb_data_mutex;
- // LOC ioctl callback arrived mutex
- pthread_cond_t cb_arrived_cond;
-} loc_eng_ioctl_data_s_type;
-
-
extern boolean 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
+ 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
);
-extern boolean loc_eng_ioctl_process_cb
-(
- rpc_loc_client_handle_type client_handle,
- const rpc_loc_ioctl_callback_s_type *cb_data_ptr
-);
#endif // LOC_ENG_IOCTL_H
diff --git a/loc_api/libloc_api/loc_eng_log.cpp b/loc_api/libloc_api/loc_eng_log.cpp
new file mode 100644
index 0000000..f61fb4e
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_log.cpp
@@ -0,0 +1,435 @@
+/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <hardware/gps.h>
+
+#include <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <loc_eng.h>
+
+#define LOG_TAG "libloc"
+#include <utils/Log.h>
+
+// comment this out to enable logging
+// #undef LOGD
+// #define LOGD(...) {}
+
+typedef struct
+{
+ char name[128];
+ long val;
+} loc_name_val_s_type;
+
+#define NAME_VAL(x) {"" #x "", x }
+
+#define UNKNOWN_STR "UNKNOWN"
+
+/* Event names */
+loc_name_val_s_type loc_eng_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 ),
+#if (AMSS_VERSION != 3200&&AMSS_VERSION != 20000)
+ NAME_VAL( RPC_LOC_EVENT_WPS_NEEDED_REQUEST ),
+#endif
+ };
+int loc_event_num = sizeof loc_eng_event_name / sizeof(loc_name_val_s_type);
+
+/* 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_INFORM_SERVER_OPEN_STATUS ),
+ NAME_VAL( RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS ),
+#if (AMSS_VERSION != 3200&&AMSS_VERSION != 20000)
+ NAME_VAL( RPC_LOC_IOCTL_SEND_WIPER_POSITION_REPORT ),
+ NAME_VAL( RPC_LOC_IOCTL_NOTIFY_WIPER_STATUS ),
+#endif
+ 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_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 )
+ };
+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);
+
+/* GPS status names */
+loc_name_val_s_type gps_status_name[] =
+ {
+ NAME_VAL( GPS_STATUS_NONE ),
+ NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
+ NAME_VAL( GPS_STATUS_SESSION_END ),
+ NAME_VAL( GPS_STATUS_ENGINE_ON ),
+ NAME_VAL( GPS_STATUS_ENGINE_OFF ),
+ };
+int gps_status_num = sizeof gps_status_name / sizeof(loc_name_val_s_type);
+
+/* Get names from value */
+static const char* loc_eng_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val & (long) mask)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Get names from value */
+static const char* loc_eng_get_name_from_val(loc_name_val_s_type table[], int table_size, long value)
+{
+ int i;
+ for (i = 0; i < table_size; i++)
+ {
+ if (table[i].val == (long) value)
+ {
+ return table[i].name;
+ }
+ }
+ return UNKNOWN_STR;
+}
+
+/* Finds the first event found in the mask */
+const char* loc_get_event_name(rpc_loc_event_mask_type loc_event_mask)
+{
+ return loc_eng_get_name_from_mask(loc_eng_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_eng_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_eng_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_eng_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_eng_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_eng_get_name_from_val(loc_fix_session_state_name, loc_fix_session_state_num,
+ (long) state);
+}
+
+/* Find Android GPS status name */
+const char* loc_get_gps_status_name(GpsStatusValue gps_status)
+{
+ return loc_eng_get_name_from_val(gps_status_name, gps_status_num,
+ (long) gps_status);
+}
+
+const char* log_succ_fail_string(int is_succ)
+{
+ return is_succ? "successful" : "failed";
+}
+
+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;
+ }
+}
+
+#define CHECK_MASK(type, value, mask_var, mask) \
+ ((mask_var & mask) ? (type) value : (type) (-1))
+
+/* 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)
+ );
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_get_time
+
+DESCRIPTION
+ Logs a callback event header.
+ The pointer time_string should point to a buffer of at least 13 bytes:
+
+ XX:XX:XX.000\0
+
+RETURN VALUE
+ The time string
+
+===========================================================================*/
+char *loc_eng_get_time(char *time_string)
+{
+ struct timeval now; /* sec and usec */
+ struct tm now_tm; /* broken-down time */
+ char hms_string[80]; /* HH:MM:SS */
+
+ gettimeofday(&now, NULL);
+ localtime_r(&now.tv_sec, &now_tm);
+
+ strftime(hms_string, sizeof hms_string, "%H:%M:%S", &now_tm);
+ sprintf(time_string, "%s.%03d", hms_string, (int) (now.tv_usec / 1000));
+
+ return time_string;
+}
+
+/* Logs a callback event header */
+int loc_eng_callback_log_header(
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ char time_string[64]; /* full time string */
+ const char *event_name = loc_get_event_name(loc_event);
+ if (event_name == NULL)
+ {
+ event_name = UNKNOWN_STR;
+ }
+
+ /* Event header */
+ LOC_LOGD("\nEvent %s (client %d)\n",
+ /* loc_eng_get_time(time_string), */
+ event_name,
+ (int) client_handle);
+
+ return 0;
+}
+
+/* Logs a callback event */
+int loc_eng_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;
+}
diff --git a/loc_api/libloc_api/loc_eng_log.h b/loc_api/libloc_api/loc_eng_log.h
new file mode 100644
index 0000000..41d5f8b
--- /dev/null
+++ b/loc_api/libloc_api/loc_eng_log.h
@@ -0,0 +1,55 @@
+/* Copyright (c) 2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef LOC_ENG_LOG_H
+#define LOC_ENG_LOG_H
+
+extern int loc_eng_callback_log_header(
+ rpc_loc_client_handle_type client_handle, /* client handle */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+extern int loc_eng_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_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* log_succ_fail_string(int is_succ);
+extern const char* loc_get_gps_status_name(GpsStatusValue gps_status);
+
+extern char *loc_eng_get_time(char *time_string);
+
+#endif /* LOC_ENG_LOG_H */
diff --git a/loc_api/libloc_api/loc_eng_ni.cpp b/loc_api/libloc_api/loc_eng_ni.cpp
index 958103a..531a718 100755
--- a/loc_api/libloc_api/loc_eng_ni.cpp
+++ b/loc_api/libloc_api/loc_eng_ni.cpp
@@ -1,30 +1,31 @@
-/******************************************************************************
- @file: loc_eng_ni.cpp
- @brief: module for network initiated interactions
-
- DESCRIPTION
- LOC_API network initiated operation support
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
- Copyright (c) 2009 QUALCOMM Incorporated.
- All Rights Reserved. QUALCOMM Proprietary and Confidential.
- -----------------------------------------------------------------------------
-******************************************************************************/
-
-/*=====================================================================
- EDIT HISTORY FOR MODULE
-
- This section contains comments describing changes made to the module.
- Notice that changes are listed in reverse chronological order.
-
-when who what, where, why
--------- --- -------------------------------------------------------
-07/30/09 dx Initial version
-
-$Id:
-======================================================================*/
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (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_NIDEBUG 0
@@ -32,6 +33,7 @@ $Id:
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
+#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
@@ -39,10 +41,10 @@ $Id:
#include <rpc/rpc.h>
#include <loc_api_rpc_glue.h>
+
#include <loc_eng.h>
-#include <loc_eng_ni.h>
-#define LOG_TAG "lib_locapi"
+#define LOG_TAG "libloc"
#include <utils/Log.h>
// comment this out to enable logging
@@ -57,22 +59,27 @@ $Id:
const GpsNiInterface sLocEngNiInterface =
{
- sizeof(GpsNiInterface),
- loc_eng_ni_init,
- loc_eng_ni_respond,
+ sizeof(GpsNiInterface),
+ loc_eng_ni_init,
+ loc_eng_ni_respond,
};
boolean loc_eng_ni_data_init = FALSE;
loc_eng_ni_data_s_type loc_eng_ni_data;
extern loc_eng_data_s_type loc_eng_data;
+/* User response callback waiting conditional variable */
+pthread_cond_t user_cb_arrived_cond = PTHREAD_COND_INITIALIZER;
+
+/* User callback waiting data block, protected by user_cb_data_mutex */
+pthread_mutex_t user_cb_data_mutex = PTHREAD_MUTEX_INITIALIZER;
/*=============================================================================
*
* FUNCTION DECLARATIONS
*
*============================================================================*/
-
+static void* loc_ni_thread_proc(void *threadid);
/*===========================================================================
FUNCTION respond_from_enum
@@ -86,17 +93,17 @@ RETURN VALUE
===========================================================================*/
static const char* respond_from_enum(rpc_loc_ni_user_resp_e_type resp)
{
- switch (resp)
- {
- case RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT:
- return "accept";
- case RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY:
- return "deny";
- case RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP:
- return "no response";
- default:
- return NULL;
- }
+ switch (resp)
+ {
+ case RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT:
+ return "accept";
+ case RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY:
+ return "deny";
+ case RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP:
+ return "no response";
+ default:
+ return NULL;
+ }
}
/*===========================================================================
@@ -115,26 +122,28 @@ RETURN VALUE
none
===========================================================================*/
-static void loc_ni_respond(rpc_loc_ni_user_resp_e_type resp,
- const rpc_loc_ni_event_s_type *request_pass_back
+static void loc_ni_respond
+(
+ rpc_loc_ni_user_resp_e_type resp,
+ const rpc_loc_ni_event_s_type *request_pass_back
)
{
- LOGD("Sending NI response: %s\n", respond_from_enum(resp));
-
- 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,
- request_pass_back, sizeof (rpc_loc_ni_event_s_type));
- data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp = resp;
-
- loc_eng_ioctl(
- loc_eng_data.client_handle,
- RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
- &data,
- LOC_IOCTL_DEFAULT_TIMEOUT,
- &callback_payload
- );
+ LOC_LOGD("Sending NI response: %s\n", respond_from_enum(resp));
+
+ 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,
+ request_pass_back, sizeof (rpc_loc_ni_event_s_type));
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp = resp;
+
+ loc_eng_ioctl(
+ loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload
+ );
}
/*===========================================================================
@@ -151,38 +160,38 @@ RETURN VALUE
static boolean loc_ni_fill_notif_verify_type(GpsNiNotification *notif,
rpc_loc_ni_notify_verify_e_type notif_priv)
{
- notif->notify_flags = 0;
- notif->default_response = GPS_NI_RESPONSE_NORESP;
-
- switch (notif_priv)
- {
- case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
- notif->notify_flags = 0;
- break;
-
- case RPC_LOC_NI_USER_NOTIFY_ONLY:
- notif->notify_flags = GPS_NI_NEED_NOTIFY;
- break;
-
- 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;
- break;
-
- 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;
- break;
-
- case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
- notif->notify_flags = GPS_NI_PRIVACY_OVERRIDE;
- break;
-
- default:
- return FALSE;
- }
-
- return TRUE;
+ notif->notify_flags = 0;
+ notif->default_response = GPS_NI_RESPONSE_NORESP;
+
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif->notify_flags = 0;
+ break;
+
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif->notify_flags = GPS_NI_NEED_NOTIFY;
+ break;
+
+ 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;
+ break;
+
+ 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;
+ break;
+
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif->notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
}
/*===========================================================================
@@ -198,41 +207,83 @@ RETURN VALUE
===========================================================================*/
static int hexcode(char *hexstring, int string_size, const char *data, int data_size)
{
- int i;
- for (i = 0; i < data_size; i++)
- {
- char ch = data[i];
- if (i*2 + 3 <= string_size)
- {
- snprintf(&hexstring[i*2], 3, "%02X", ch);
- }
- else {
- break;
- }
- }
- return i;
+ int i;
+ for (i = 0; i < data_size; i++)
+ {
+ char ch = data[i];
+ if (i*2 + 3 <= string_size)
+ {
+ snprintf(&hexstring[i*2], 3, "%02X", ch);
+ }
+ else {
+ break;
+ }
+ }
+ return i;
+}
+
+/*===========================================================================
+
+FUNCTION decode_address
+
+DESCRIPTION
+ Converts a binary encoding into an address string. E.g., 91 21 F3 --> "123".
+The 91 is a prefix, hex digits are reversed in order. 0xF means the absence of
+a digit.
+
+RETURN VALUE
+ number of bytes encoded
+
+===========================================================================*/
+static int decode_address(char *addr_string, int string_size, const char *data, int data_size)
+{
+ const char addr_prefix = 0x91;
+ int i, idxOutput = 0;
+
+ if (!data || !addr_string) { return 0; }
+
+ if (data[0] != addr_prefix)
+ {
+ LOC_LOGW("decode_address: address prefix is not 0x%x but 0x%x", addr_prefix, data[0]);
+ addr_string[0] = '\0';
+ return 0; // prefix not correct
+ }
+
+ for (i = 1; i < data_size; i++)
+ {
+ unsigned char ch = data[i], low = ch & 0x0F, hi = ch >> 4;
+ if (low <= 9 && idxOutput < string_size - 1) { addr_string[idxOutput++] = low + '0'; }
+ if (hi <= 9 && idxOutput < string_size - 1) { addr_string[idxOutput++] = hi + '0'; }
+ }
+
+ addr_string[idxOutput] = '\0'; // Terminates the string
+
+ return idxOutput;
}
static GpsNiEncodingType convert_encoding_type(int loc_encoding)
{
- GpsNiEncodingType enc = GPS_ENC_UNKNOWN;
-
- switch (loc_encoding)
- {
- case RPC_LOC_NI_SUPL_UTF8:
- enc = GPS_ENC_SUPL_UTF8;
- break;
- case RPC_LOC_NI_SUPL_UCS2:
- enc = GPS_ENC_SUPL_UCS2;
- break;
- case RPC_LOC_NI_SUPL_GSM_DEFAULT:
- enc = GPS_ENC_SUPL_GSM_DEFAULT;
- break;
- default:
- break;
- }
-
- return enc;
+ GpsNiEncodingType enc = GPS_ENC_UNKNOWN;
+
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ enc = GPS_ENC_SUPL_UTF8;
+ break;
+ case RPC_LOC_NI_SUPL_UCS2:
+ enc = GPS_ENC_SUPL_UCS2;
+ break;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ enc = GPS_ENC_SUPL_GSM_DEFAULT;
+ break;
+ case RPC_LOC_NI_SS_LANGUAGE_UNSPEC:
+ enc = GPS_ENC_SUPL_GSM_DEFAULT; // SS_LANGUAGE_UNSPEC = GSM
+ break;
+ default:
+ break;
+ }
+
+ return enc;
}
/*===========================================================================
@@ -249,182 +300,253 @@ RETURN VALUE
===========================================================================*/
static void loc_ni_request_handler(const char *msg, const rpc_loc_ni_event_s_type *ni_req)
{
- GpsNiNotification notif;
- notif.size = sizeof(notif);
- strlcpy(notif.text, "[text]", sizeof notif.text); // defaults
- strlcpy(notif.requestor_id, "[requestor id]", sizeof notif.requestor_id);
-
- /* If busy, use default or deny */
- if (loc_eng_ni_data.notif_in_progress)
- {
-#if 0
- /* Cannot be here because the current thread is in RPC client */
- /* XXX Consider adding an event queue to process overlapped NI requests */
- loc_ni_user_resp_e_type response =
- sys.ni_default_resp == 1 /* accept */ ?
- LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT :
- LOC_NI_LCS_NOTIFY_VERIFY_DENY;
-
- loc_ni_respond(response, ni_req); */
-#endif
- LOGW("loc_ni_request_handler, notification in progress, new NI request ignored, type: %d",
- ni_req->event);
- }
- else {
- /* Print notification */
- LOGD("NI Notification: %s, event: %d", msg, ni_req->event);
-
- pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
-
- /* Save request */
- memcpy(&loc_eng_ni_data.loc_ni_request, ni_req, sizeof loc_eng_ni_data.loc_ni_request);
-
- /* Set up NI response waiting */
- loc_eng_ni_data.notif_in_progress = TRUE;
- loc_eng_ni_data.current_notif_id = abs(rand());
-
- /* Fill in notification */
- notif.notification_id = loc_eng_ni_data.current_notif_id;
-
- const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req;
- const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req;
- const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req;
-
- switch (ni_req->event)
- {
- case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
- vx_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
- notif.ni_type = GPS_NI_TYPE_VOICE;
- notif.timeout = LOC_NI_NO_RESPONSE_TIME; // vx_req->user_resp_timer_val;
- memset(notif.extras, 0, sizeof notif.extras);
- memset(notif.text, 0, sizeof notif.text);
- memset(notif.requestor_id, 0, sizeof notif.requestor_id);
-
- // 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 = convert_encoding_type(vx_req->encoding_scheme);
-
- // Set default_response & notify_flags
- loc_ni_fill_notif_verify_type(&notif, vx_req->notification_priv_type);
-
- break;
-
- case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
- umts_cp_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
- notif.ni_type = GPS_NI_TYPE_UMTS_CTRL_PLANE;
- notif.timeout = LOC_NI_NO_RESPONSE_TIME; // umts_cp_req->user_response_timer;
- memset(notif.extras, 0, sizeof notif.extras);
- memset(notif.text, 0, sizeof notif.text);
- memset(notif.requestor_id, 0, sizeof notif.requestor_id);
-
- // Stores notification text
- hexcode(notif.text, sizeof notif.text,
-#if (AMSS_VERSION==3200)
- umts_cp_req->notification_text.notification_text_val,
+ GpsNiNotification notif;
+ char lcs_addr[32]; // Decoded LCS address for UMTS CP NI
+
+ notif.size = sizeof(notif);
+ strlcpy(notif.text, "[text]", sizeof notif.text); // defaults
+ strlcpy(notif.requestor_id, "[requestor id]", sizeof notif.requestor_id);
+
+ /* If busy, use default or deny */
+ if (loc_eng_ni_data.notif_in_progress)
+ {
+ /* XXX Consider sending a NO RESPONSE reply or queue the request */
+ LOC_LOGW("loc_ni_request_handler, notification in progress, new NI request ignored, type: %d",
+ ni_req->event);
+ }
+ else {
+ /* Print notification */
+ LOC_LOGD("NI Notification: %s, event: %d", msg, ni_req->event);
+
+ pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
+
+ /* Save request */
+ memcpy(&loc_eng_ni_data.loc_ni_request, ni_req, sizeof loc_eng_ni_data.loc_ni_request);
+
+ /* Set up NI response waiting */
+ loc_eng_ni_data.notif_in_progress = TRUE;
+ loc_eng_ni_data.current_notif_id = abs(rand());
+
+ /* Fill in notification */
+ notif.notification_id = loc_eng_ni_data.current_notif_id;
+
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req;
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req;
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req;
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ vx_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME; // vx_req->user_resp_timer_val;
+ memset(notif.extras, 0, sizeof notif.extras);
+ memset(notif.text, 0, sizeof notif.text);
+ memset(notif.requestor_id, 0, sizeof notif.requestor_id);
+
+ // 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 = convert_encoding_type(vx_req->encoding_scheme);
+
+ // Set default_response & notify_flags
+ loc_ni_fill_notif_verify_type(&notif, vx_req->notification_priv_type);
+
+ // Privacy override handling
+ if (vx_req->notification_priv_type == RPC_LOC_NI_USER_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session();
+ }
+
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ umts_cp_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ notif.ni_type = GPS_NI_TYPE_UMTS_CTRL_PLANE;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME; // umts_cp_req->user_response_timer;
+ memset(notif.extras, 0, sizeof notif.extras);
+ memset(notif.text, 0, sizeof notif.text);
+ memset(notif.requestor_id, 0, sizeof notif.requestor_id);
+
+ // Stores notification text
+#if (AMSS_VERSION==3200||AMSS_VERSION==20000)
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text.notification_text_val,
+ umts_cp_req->notification_length);
+#else
+ hexcode(notif.text, sizeof notif.text,
+ umts_cp_req->notification_text,
+ umts_cp_req->notification_length);
+#endif /* #if (AMSS_VERSION==3200||AMSS_VERSION==20000) */
+
+ // Stores requestor ID
+#if (AMSS_VERSION==3200||AMSS_VERSION==20000)
+ 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
- umts_cp_req->notification_text,
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+ umts_cp_req->requestor_id.requestor_id_string,
+ umts_cp_req->requestor_id.string_len);
#endif
- umts_cp_req->notification_length);
- // Stores requestor ID
- hexcode(notif.requestor_id, sizeof notif.requestor_id,
-#if (AMSS_VERSION==3200)
- umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+ // Encodings
+ notif.text_encoding = convert_encoding_type(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = convert_encoding_type(umts_cp_req->datacoding_scheme);
+
+ // 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||AMSS_VERSION==20000)
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address.ext_client_address_val;
#else
- umts_cp_req->requestor_id.requestor_id_string,
-#endif
- umts_cp_req->requestor_id.string_len);
-
- notif.text_encoding = convert_encoding_type(umts_cp_req->datacoding_scheme);
- notif.requestor_id_encoding = convert_encoding_type(umts_cp_req->datacoding_scheme);
-
- // Set default_response & notify_flags
- loc_ni_fill_notif_verify_type(&notif, umts_cp_req->notification_priv_type);
-
- break;
-
- case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
- supl_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
- notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
- notif.timeout = LOC_NI_NO_RESPONSE_TIME; // supl_req->user_response_timer;
- memset(notif.extras, 0, sizeof notif.extras);
- memset(notif.text, 0, sizeof notif.text);
- memset(notif.requestor_id, 0, sizeof notif.requestor_id);
-
- // Client name
- if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
- {
- hexcode(notif.text, sizeof notif.text,
-#if (AMSS_VERSION==3200)
- supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+ address_source = umts_cp_req->ext_client_address_data.ext_client_address;
+#endif /* #if (AMSS_VERSION==3200||AMSS_VERSION==20000) */
+
+ addr_len = decode_address(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);
+ }
+ }
+
+ // Set default_response & notify_flags
+ loc_ni_fill_notif_verify_type(&notif, umts_cp_req->notification_priv_type);
+
+ // Privacy override handling
+ if (umts_cp_req->notification_priv_type == RPC_LOC_NI_USER_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session();
+ }
+
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ supl_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME; // supl_req->user_response_timer;
+ memset(notif.extras, 0, sizeof notif.extras);
+ memset(notif.text, 0, sizeof notif.text);
+ memset(notif.requestor_id, 0, sizeof notif.requestor_id);
+
+ // Client name
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+
+#if (AMSS_VERSION==3200||AMSS_VERSION==20000)
+ 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
- supl_req->client_name.client_name_string, /* buffer */
-#endif
- supl_req->client_name.string_len /* length */
- );
- LOGD("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
- } else {
- LOGD("SUPL NI: client_name not present.");
- }
-
- // Requestor ID
- if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
- {
- hexcode(notif.requestor_id, sizeof notif.requestor_id,
-#if (AMSS_VERSION==3200)
- supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+ 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||AMSS_VERSION==20000) */
+
+ 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||AMSS_VERSION==20000)
+ 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
- supl_req->requestor_id.requestor_id_string, /* buffer */
-#endif
- supl_req->requestor_id.string_len /* length */
- );
- LOGD("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
- } else {
- LOGD("SUPL NI: requestor_id not present.");
- }
-
- // Encoding type
- if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
- {
- notif.text_encoding = convert_encoding_type(supl_req->datacoding_scheme);
- notif.requestor_id_encoding = convert_encoding_type(supl_req->datacoding_scheme);
- } else {
- notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
- }
-
- // Set default_response & notify_flags
- loc_ni_fill_notif_verify_type(&notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
-
- break;
-
- default:
- LOGE("loc_ni_request_handler, unknown request event: %d", ni_req->event);
- return;
- }
-
- /* Log requestor ID and text for debugging */
- LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif.ni_type, notif.timeout, notif.default_response);
- LOGI(" requestor_id: %s (encoding: %d)", notif.requestor_id, notif.requestor_id_encoding);
- LOGI(" text: %s text (encoding: %d)", notif.text, notif.text_encoding);
-
- /* For robustness, always sets a timeout to clear up the notification status, even though
- * the OEM layer in java does not do so.
- **/
- loc_eng_ni_data.response_time_left = 5 + (notif.timeout != 0 ? notif.timeout : LOC_NI_NO_RESPONSE_TIME);
- LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data.response_time_left);
-
- pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
-
- /* Notify callback */
- if (loc_eng_data.ni_notify_cb != NULL)
- {
- loc_eng_data.ni_notify_cb(&notif);
- }
- }
+ 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||AMSS_VERSION==20000) */
+ 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 = convert_encoding_type(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = convert_encoding_type(supl_req->datacoding_scheme);
+ }
+ else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ // Set default_response & notify_flags
+ loc_ni_fill_notif_verify_type(&notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+
+ // Privacy override handling
+ if (ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type == RPC_LOC_NI_USER_PRIVACY_OVERRIDE)
+ {
+ loc_eng_mute_one_session();
+ }
+
+ break;
+
+ default:
+ LOC_LOGE("loc_ni_request_handler, unknown request event: %d", ni_req->event);
+ return;
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOC_LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif.ni_type, notif.timeout, notif.default_response);
+ LOC_LOGI(" requestor_id: %s (encoding: %d)", notif.requestor_id, notif.requestor_id_encoding);
+ LOC_LOGI(" text: %s text (encoding: %d)", notif.text, notif.text_encoding);
+ if (notif.extras[0])
+ {
+ LOC_LOGI(" extras: %s", notif.extras);
+ }
+
+ /* For robustness, spawn a thread at this point to timeout to clear up the notification status, even though
+ * the OEM layer in java does not do so.
+ **/
+ loc_eng_ni_data.response_time_left = 5 + (notif.timeout != 0 ? notif.timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOC_LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data.response_time_left);
+
+ /* @todo may required when android framework issue is fixed
+ * loc_eng_ni_data.callbacks_ref->create_thread_cb("loc_api_ni", loc_ni_thread_proc, NULL);
+ */
+
+ int rc = 0;
+ rc = pthread_create(&loc_eng_ni_data.loc_ni_thread, NULL, loc_ni_thread_proc, NULL);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not created.\n");
+ }
+ rc = pthread_detach(loc_eng_ni_data.loc_ni_thread);
+ if (rc)
+ {
+ LOC_LOGE("Loc NI thread is not detached.\n");
+ }
+ pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
+
+ /* Notify callback */
+ if (loc_eng_data.ni_notify_cb != NULL)
+ {
+ loc_eng_data.ni_notify_cb(&notif);
+ }
+ }
}
/*===========================================================================
@@ -440,34 +562,31 @@ RETURN VALUE
===========================================================================*/
int loc_ni_process_user_response(GpsUserResponseType userResponse)
{
- LOGD("NI response from UI: %d", userResponse);
-
- rpc_loc_ni_user_resp_e_type resp;
- switch (userResponse)
- {
- case GPS_NI_RESPONSE_ACCEPT:
- resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
- break;
- case GPS_NI_RESPONSE_DENY:
- resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
- break;
- case GPS_NI_RESPONSE_NORESP:
- resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
- break;
- default:
- return -1;
- }
-
- loc_ni_respond(resp, &loc_eng_ni_data.loc_ni_request);
-
- /* Make the NI respond */
- pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
- loc_eng_ni_data.notif_in_progress = FALSE;
- loc_eng_ni_data.response_time_left = 0;
- loc_eng_ni_data.current_notif_id = -1;
- pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
-
- return 0;
+ int rc=0;
+ LOC_LOGD("NI response from UI: %d", userResponse);
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ default:
+ return -1;
+ }
+ /* Turn of the timeout*/
+ pthread_mutex_lock(&user_cb_data_mutex);
+ loc_eng_ni_data.resp = resp;
+ loc_eng_ni_data.user_response_received = TRUE;
+ rc = pthread_cond_signal(&user_cb_arrived_cond);
+ pthread_mutex_unlock(&user_cb_data_mutex);
+ return 0;
}
/*===========================================================================
@@ -486,33 +605,33 @@ int loc_eng_ni_callback (
const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
)
{
- int rc = 0;
- const rpc_loc_ni_event_s_type *ni_req = &loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request;
- if (loc_event == RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
- {
- switch (ni_req->event)
- {
- case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
- LOGI("VX Notification");
- loc_ni_request_handler("VX Notify", ni_req);
- break;
-
- case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
- LOGI("UMTS CP Notification\n");
- loc_ni_request_handler("UMTS CP Notify", ni_req);
- break;
-
- case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
- LOGI("SUPL Notification\n");
- loc_ni_request_handler("SUPL Notify", ni_req);
- break;
-
- default:
- LOGE("Unknown NI event: %x\n", (int) ni_req->event);
- break;
- }
- }
- return rc;
+ int rc = 0;
+ const rpc_loc_ni_event_s_type *ni_req = &loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request;
+ if (loc_event == RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ LOC_LOGI("VX Notification");
+ loc_ni_request_handler("VX Notify", ni_req);
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ LOC_LOGI("UMTS CP Notification\n");
+ loc_ni_request_handler("UMTS CP Notify", ni_req);
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ LOC_LOGI("SUPL Notification\n");
+ loc_ni_request_handler("SUPL Notify", ni_req);
+ break;
+
+ default:
+ LOC_LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ break;
+ }
+ }
+ return rc;
}
/*===========================================================================
@@ -520,29 +639,46 @@ int loc_eng_ni_callback (
FUNCTION loc_ni_thread_proc
===========================================================================*/
-static void loc_ni_thread_proc(void *unused)
+static void* loc_ni_thread_proc(void *threadid)
{
- LOGI("Starting Loc NI thread...\n");
-
- while (1)
- {
- /* wakes up every second to check timed out requests */
- sleep(1);
-
- pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
-
- if (loc_eng_ni_data.notif_in_progress && loc_eng_ni_data.response_time_left > 0)
- {
- loc_eng_ni_data.response_time_left--;
- if (loc_eng_ni_data.response_time_left <= 0)
- {
- loc_ni_respond(RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP, &loc_eng_ni_data.loc_ni_request);
- loc_eng_ni_data.notif_in_progress = FALSE;
- }
- }
-
- pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
- } /* while (1) */
+ int rc = 0; /* return code from pthread calls */
+
+ struct timeval present_time;
+ struct timespec expire_time;
+
+ LOC_LOGD("Starting Loc NI thread...\n");
+ pthread_mutex_lock(&user_cb_data_mutex);
+ /* Calculate absolute expire time */
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec;
+ expire_time.tv_nsec = present_time.tv_usec * 1000;
+ expire_time.tv_sec += loc_eng_ni_data.response_time_left;
+ LOC_LOGD("loc_ni_thread_proc-Time out set for abs time %ld\n", (long) expire_time.tv_sec );
+
+ while (!loc_eng_ni_data.user_response_received)
+ {
+ rc = pthread_cond_timedwait(&user_cb_arrived_cond, &user_cb_data_mutex, &expire_time);
+ if (rc == ETIMEDOUT)
+ {
+ loc_eng_ni_data.resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ LOC_LOGD("loc_ni_thread_proc-Thread time out after valting for specified time. Ret Val %d\n",rc );
+ break;
+ }
+ }
+ if (loc_eng_ni_data.user_response_received == TRUE)
+ {
+ LOC_LOGD("loc_ni_thread_proc-Java layer has sent us a user response and return value from "
+ "pthread_cond_timedwait = %d\n",rc );
+ loc_eng_ni_data.user_response_received = FALSE; /* Reset the user response flag for the next session*/
+ }
+ loc_ni_respond(loc_eng_ni_data.resp, &loc_eng_ni_data.loc_ni_request);
+ pthread_mutex_unlock(&user_cb_data_mutex);
+ pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
+ loc_eng_ni_data.notif_in_progress = FALSE;
+ loc_eng_ni_data.response_time_left = 0;
+ loc_eng_ni_data.current_notif_id = -1;
+ pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
+ return NULL;
}
/*===========================================================================
@@ -563,21 +699,21 @@ SIDE EFFECTS
===========================================================================*/
void loc_eng_ni_init(GpsNiCallbacks *callbacks)
{
- LOGD("loc_eng_ni_init: entered.");
+ LOC_LOGD("loc_eng_ni_init: entered.");
- if (!loc_eng_ni_data_init)
- {
- pthread_mutex_init(&loc_eng_ni_data.loc_ni_lock, NULL);
- callbacks->create_thread_cb("loc_api_ni", loc_ni_thread_proc, NULL);
- loc_eng_ni_data_init = TRUE;
- }
+ if (!loc_eng_ni_data_init)
+ {
+ pthread_mutex_init(&loc_eng_ni_data.loc_ni_lock, NULL);
+ loc_eng_ni_data_init = TRUE;
+ }
- loc_eng_ni_data.notif_in_progress = FALSE;
- loc_eng_ni_data.current_notif_id = -1;
- loc_eng_ni_data.response_time_left = 0;
+ loc_eng_ni_data.notif_in_progress = FALSE;
+ loc_eng_ni_data.current_notif_id = -1;
+ loc_eng_ni_data.response_time_left = 0;
+ loc_eng_ni_data.user_response_received = FALSE;
- srand(time(NULL));
- loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+ srand(time(NULL));
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
}
/*===========================================================================
@@ -598,12 +734,14 @@ SIDE EFFECTS
===========================================================================*/
void loc_eng_ni_respond(int notif_id, GpsUserResponseType user_response)
{
- if (notif_id == loc_eng_ni_data.current_notif_id && loc_eng_ni_data.notif_in_progress)
- {
- LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
- loc_ni_process_user_response(user_response);
- } else {
- LOGE("loc_eng_ni_respond: notif_id %d mismatch or notification not in progress, response: %d",
+ if (notif_id == loc_eng_ni_data.current_notif_id &&
+ loc_eng_ni_data.notif_in_progress)
+ {
+ LOC_LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ loc_ni_process_user_response(user_response);
+ }
+ else {
+ LOC_LOGE("loc_eng_ni_respond: notif_id %d mismatch or notification not in progress, response: %d",
notif_id, user_response);
- }
+ }
}
diff --git a/loc_api/libloc_api/loc_eng_ni.h b/loc_api/libloc_api/loc_eng_ni.h
index 88d285a..bd9fe40 100755
--- a/loc_api/libloc_api/loc_eng_ni.h
+++ b/loc_api/libloc_api/loc_eng_ni.h
@@ -1,46 +1,50 @@
-/******************************************************************************
- @file: loc_eng_ni.cpp
- @brief: module for network initiated interactions
-
- DESCRIPTION
- LOC_API network initiated operation support
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
- Copyright (c) 2009 QUALCOMM Incorporated.
- All Rights Reserved. QUALCOMM Proprietary and Confidential.
- -----------------------------------------------------------------------------
-******************************************************************************/
-
-/*=====================================================================
- EDIT HISTORY FOR MODULE
-
- This section contains comments describing changes made to the module.
- Notice that changes are listed in reverse chronological order.
-
-when who what, where, why
--------- --- -------------------------------------------------------
-07/30/09 dx Initial version
-
-$Id:
-======================================================================*/
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
#ifndef LOC_ENG_NI_H
#define LOC_ENG_NI_H
-#include <hardware/gps.h>
-
#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+#define LOC_NI_NOTIF_KEY_ADDRESS "Address"
+
extern const GpsNiInterface sLocEngNiInterface;
typedef struct {
- pthread_mutex_t loc_ni_lock;
- int response_time_left; /* examine time for NI response */
- boolean notif_in_progress; /* NI notification/verification in progress */
- rpc_loc_ni_event_s_type loc_ni_request;
- int current_notif_id; /* ID to check against response */
+ pthread_t loc_ni_thread; /* NI thread */
+ pthread_mutex_t loc_ni_lock;
+ int response_time_left; /* examine time for NI response */
+ boolean user_response_received; /* NI User reponse received or not from Java layer*/
+ boolean notif_in_progress; /* NI notification/verification in progress */
+ rpc_loc_ni_event_s_type loc_ni_request;
+ int current_notif_id; /* ID to check against response */
+ rpc_loc_ni_user_resp_e_type resp;
} loc_eng_ni_data_s_type;
// Functions for sLocEngNiInterface
@@ -48,8 +52,8 @@ extern void loc_eng_ni_init(GpsNiCallbacks *callbacks);
extern void loc_eng_ni_respond(int notif_id, GpsUserResponseType user_response);
extern int loc_eng_ni_callback (
- rpc_loc_event_mask_type loc_event, /* event mask */
- const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
);
#endif /* LOC_ENG_NI_H */
diff --git a/loc_api/libloc_api/loc_eng_xtra.cpp b/loc_api/libloc_api/loc_eng_xtra.cpp
index 9dda092..67d18d0 100755
--- a/loc_api/libloc_api/loc_eng_xtra.cpp
+++ b/loc_api/libloc_api/loc_eng_xtra.cpp
@@ -1,35 +1,32 @@
-/******************************************************************************
- @file: loc_eng.cpp
- @brief:
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
- DESCRIPTION
- This file defines the implemenation for GPS hardware abstraction layer.
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
-Copyright (c) 2009, QUALCOMM USA, INC.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -----------------------------------------------------------------------------
-
-******************************************************************************/
-
-/*=====================================================================
-$Header: $
-$DateTime: $
-$Author: $
-======================================================================*/
#define LOG_NDDEBUG 0
#include <stdio.h>
@@ -45,7 +42,7 @@ $Author: $
#include <loc_eng.h>
-#define LOG_TAG "lib_locapi"
+#define LOG_TAG "libloc"
#include <utils/Log.h>
// comment this out to enable logging
@@ -53,16 +50,18 @@ $Author: $
// #define LOGD(...) {}
#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
-#define XTRA_BLOCK_SIZE (400)
+#define XTRA_BLOCK_SIZE (1024)
static int qct_loc_eng_xtra_init (GpsXtraCallbacks* callbacks);
static int qct_loc_eng_inject_xtra_data(char* data, int length);
+static int qct_loc_eng_inject_xtra_data_proxy(char* data, int length);
const GpsXtraInterface sLocEngXTRAInterface =
{
sizeof(GpsXtraInterface),
qct_loc_eng_xtra_init,
- qct_loc_eng_inject_xtra_data,
+ /* qct_loc_eng_inject_xtra_data, */
+ qct_loc_eng_inject_xtra_data_proxy, // This func buffers xtra data if GPS is in-session
};
/*===========================================================================
@@ -83,101 +82,204 @@ SIDE EFFECTS
===========================================================================*/
static int qct_loc_eng_xtra_init (GpsXtraCallbacks* callbacks)
{
- rpc_loc_event_mask_type event;
- loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+ rpc_loc_event_mask_type event;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
- xtra_module_data_ptr = &(loc_eng_data.xtra_module_data);
- xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+ xtra_module_data_ptr = &loc_eng_data.xtra_module_data;
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
- return 0;
+ return 0;
}
/*===========================================================================
FUNCTION qct_loc_eng_inject_xtra_data
DESCRIPTION
- Injects XTRA file into the engine.
+ Injects XTRA file into the engine.
DEPENDENCIES
N/A
RETURN VALUE
0: success
- >0: failure
+ error code > 0
SIDE EFFECTS
N/A
===========================================================================*/
-static int qct_loc_eng_inject_xtra_data(char* data, int length)
+static int qct_loc_eng_inject_xtra_data_one(char* data, int length)
{
- int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
- boolean ret_val = 0;
- int total_parts;
- uint8 part;
- uint16 part_len;
- uint16 len_injected;
- rpc_loc_ioctl_data_u_type ioctl_data;
- rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
-
- LOGV ("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%x\n", length, (int) data);
-
- ioctl_data.disc = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_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 / XTRA_BLOCK_SIZE);
- if ((total_parts % XTRA_BLOCK_SIZE) != 0)
- {
- total_parts += 1;
- }
- predicted_orbits_data_ptr->total_parts = total_parts;
-
- len_injected = 0; // O bytes injected
- // 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;
-
- LOGV ("qct_loc_eng_inject_xtra_data, inject part = %d, len = %d, len = %d\n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len, predicted_orbits_data_ptr->data_ptr.data_ptr_len);
- LOGV ("qct_loc_eng_inject_xtra_data, total part = %d, len = %d \n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len);
-
- if (part < total_parts)
- {
- // No callback in this case
- rpc_ret_val = loc_ioctl (loc_eng_data.client_handle,
- RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA,
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ boolean ret_val = 0;
+ 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%x\n", length, (int) 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 (loc_eng_data.client_handle,
+ ioctl_type,
&ioctl_data);
- if (rpc_ret_val != RPC_LOC_API_SUCCESS)
- {
- LOGE ("loc_ioctl for xtra returned %d \n", rpc_ret_val);
- ret_val = EINVAL; // return error
- break;
- }
- }
- else // part == total_parts
- {
- // Last part injection, will need to wait for callback
- ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
- RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA,
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ ret_val = EIO; // return error
+ LOC_LOGE("loc_ioctl for xtra error: %s\n", loc_get_ioctl_status_name(rpc_ret_val));
+ break;
+ }
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ if (!loc_eng_ioctl(loc_eng_data.client_handle,
+ ioctl_type,
&ioctl_data,
LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
- NULL /* No output information is expected*/);
- break; // done with injection
- }
+ NULL))
+ {
+ ret_val = EIO;
+ LOC_LOGE("loc_eng_ioctl for xtra error\n");
+ }
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOC_LOGD("loc_ioctl XTRA injected length: %d\n", len_injected);
+ }
+
+ return ret_val;
+}
+static int qct_loc_eng_inject_xtra_data(char* data, int length)
+{
+ int rc = EIO;
+ int tries = 0;
+ while (tries++ < 3) {
+ rc = qct_loc_eng_inject_xtra_data_one(data, length);
+ if (!rc) break;
+ }
+ return rc;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_xtra_data_in_buffer
+
+DESCRIPTION
+ Injects buffered XTRA file into the engine and clears the buffer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+ >0: failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+int loc_eng_inject_xtra_data_in_buffer()
+{
+ int rc = 0;
+ char *data;
+ int length;
+
+ pthread_mutex_lock(&loc_eng_data.xtra_module_data.lock);
+
+ data = loc_eng_data.xtra_module_data.xtra_data_for_injection;
+ length = loc_eng_data.xtra_module_data.xtra_data_len;
+
+ loc_eng_data.xtra_module_data.xtra_data_for_injection = NULL;
+ loc_eng_data.xtra_module_data.xtra_data_len = 0;
+
+ pthread_mutex_unlock(&loc_eng_data.xtra_module_data.lock);
+
+ if (data)
+ {
+ if (qct_loc_eng_inject_xtra_data(data, length))
+ {
+ // FIXME gracefully handle injection error
+ LOC_LOGE("XTRA injection failed.");
+ rc = -1;
+ }
+
+ free(data);
+ }
+
+ return rc;
+}
+
+/*===========================================================================
+FUNCTION qct_loc_eng_inject_xtra_data_proxy
+
+DESCRIPTION
+ Injects XTRA file into the engine but buffers the data if engine is busy.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+ >0: failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int qct_loc_eng_inject_xtra_data_proxy(char* data, int length)
+{
+ if (!data || !length) return -1;
+
+ pthread_mutex_lock(&loc_eng_data.xtra_module_data.lock);
+
+ char *buf = (char*) malloc(length);
+ if (buf)
+ {
+ memcpy(buf, data, length);
+ loc_eng_data.xtra_module_data.xtra_data_for_injection = buf;
+ loc_eng_data.xtra_module_data.xtra_data_len = length;
+ }
+
+ pthread_mutex_unlock(&loc_eng_data.xtra_module_data.lock);
- len_injected += predicted_orbits_data_ptr->part_len;
- LOGV ("loc_ioctl for xtra len injected %d \n", len_injected);
- }
+ if (loc_eng_data.engine_status != GPS_STATUS_ENGINE_ON)
+ {
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
+ }
- return ret_val;
+ return 0;
}
diff --git a/loc_api/libloc_api/loc_eng_xtra.h b/loc_api/libloc_api/loc_eng_xtra.h
index b5c7945..30d0f47 100755
--- a/loc_api/libloc_api/loc_eng_xtra.h
+++ b/loc_api/libloc_api/loc_eng_xtra.h
@@ -1,35 +1,31 @@
-/******************************************************************************
- @file: loc_eng.h
- @brief:
-
- DESCRIPTION
- This file defines the data structure used by this XTRA module.
-
- INITIALIZATION AND SEQUENCING REQUIREMENTS
-
- -----------------------------------------------------------------------------
-Copyright (c) 2009, QUALCOMM USA, INC.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
-· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
-· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- -----------------------------------------------------------------------------
-
-******************************************************************************/
-
-/*=====================================================================
-$Header: $
-$DateTime: $
-$Author: $
-======================================================================*/
+/* Copyright (c) 2009,2011 Code Aurora Forum. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Code Aurora Forum, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
#ifndef LOC_ENG_XTRA_H
#define LOC_ENG_XTRA_H
@@ -37,13 +33,20 @@ $Author: $
#include <hardware/gps.h>
extern const GpsXtraInterface sLocEngXTRAInterface;
+extern int loc_eng_inject_xtra_data_in_buffer();
// Module data
typedef struct
{
- // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
- gps_xtra_download_request download_request_cb;
+ pthread_mutex_t lock;
+
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+ int request_pending;
+ // XTRA data buffer
+ char *xtra_data_for_injection; // NULL if no pending data
+ int xtra_data_len;
} loc_eng_xtra_data_s_type;
#endif // LOC_ENG_XTRA_H
diff --git a/loc_api/libloc_api_goog/Android.mk b/loc_api/libloc_api_goog/Android.mk
new file mode 100755
index 0000000..e41c0ea
--- /dev/null
+++ b/loc_api/libloc_api_goog/Android.mk
@@ -0,0 +1,48 @@
+#Copyright (c) 2009, QUALCOMM USA, INC.
+#All rights reserved.
+#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+#· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+#· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+#· Neither the name of the QUALCOMM USA, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ifneq ($(BOARD_USES_QCOM_GPS),true)
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := gps.$(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE)
+
+LOCAL_STATIC_LIBRARIES:= \
+ libloc_api-rpc
+
+LOCAL_SHARED_LIBRARIES := \
+ librpc \
+ libutils \
+ libcutils
+
+LOCAL_SRC_FILES += \
+ loc_eng.cpp \
+ loc_eng_ioctl.cpp \
+ loc_eng_xtra.cpp \
+ loc_eng_ni.cpp \
+ gps.c
+
+LOCAL_CFLAGS += \
+ -fno-short-enums \
+ -DAMSS_VERSION=$(BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION)
+
+LOCAL_C_INCLUDES:= \
+ $(TARGET_OUT_HEADERS)/libloc_api-rpc \
+ $(TARGET_OUT_HEADERS)/libloc_api-rpc/inc \
+ $(TARGET_OUT_HEADERS)/libcommondefs-rpc/inc \
+ $(TARGET_OUT_HEADERS)/librpc
+
+LOCAL_PRELINK_MODULE := false
+LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
+
+endif
diff --git a/loc_api/libloc_api_goog/gps.c b/loc_api/libloc_api_goog/gps.c
new file mode 100644
index 0000000..ec6fbd0
--- /dev/null
+++ b/loc_api/libloc_api_goog/gps.c
@@ -0,0 +1,66 @@
+/******************************************************************************
+ @file: gps.c
+ @brief:
+
+ DESCRIPTION
+ This file defines the implemenation for GPS hardware abstraction layer.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+#include <hardware/gps.h>
+
+#include <stdlib.h>
+
+extern const GpsInterface* get_gps_interface();
+
+const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
+{
+ return get_gps_interface();
+}
+
+static int open_gps(const struct hw_module_t* module, char const* name,
+ struct hw_device_t** device)
+{
+ struct gps_device_t *dev = malloc(sizeof(struct gps_device_t));
+ memset(dev, 0, sizeof(*dev));
+
+ dev->common.tag = HARDWARE_DEVICE_TAG;
+ dev->common.version = 0;
+ dev->common.module = (struct hw_module_t*)module;
+ dev->get_gps_interface = gps__get_gps_interface;
+
+ *device = (struct hw_device_t*)dev;
+ return 0;
+}
+
+static struct hw_module_methods_t gps_module_methods = {
+ .open = open_gps
+};
+
+const struct hw_module_t HAL_MODULE_INFO_SYM = {
+ .tag = HARDWARE_MODULE_TAG,
+ .version_major = 1,
+ .version_minor = 0,
+ .id = GPS_HARDWARE_MODULE_ID,
+ .name = "loc_api GPS Module",
+ .author = "Qualcomm USA, Inc.",
+ .methods = &gps_module_methods,
+};
diff --git a/loc_api/libloc_api_goog/loc_eng.cpp b/loc_api/libloc_api_goog/loc_eng.cpp
new file mode 100755
index 0000000..8a3d412
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng.cpp
@@ -0,0 +1,1537 @@
+/******************************************************************************
+ @file: loc_eng.cpp
+ @brief:
+
+ DESCRIPTION
+ This file defines the implemenation for GPS hardware abstraction layer.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+/*=====================================================================
+$Header: $
+$DateTime: $
+$Author: $
+======================================================================*/
+
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include <rpc/rpc.h>
+#include "loc_api_rpc_glue.h"
+#include "loc_apicb_appinit.h"
+
+#include <cutils/properties.h>
+#include <cutils/sched_policy.h>
+#include <utils/SystemClock.h>
+
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+
+#define LOG_TAG "lib_locapi"
+#include <utils/Log.h>
+
+// comment this out to enable logging
+// #undef LOGD
+// #define LOGD(...) {}
+
+#define DEBUG_MOCK_NI 0
+
+// Function declarations for sLocEngInterface
+static int loc_eng_init(GpsCallbacks* callbacks);
+static int loc_eng_start();
+static int loc_eng_stop();
+static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
+static void loc_eng_cleanup();
+static int loc_eng_inject_time(GpsUtcTime time, int64_t timeReference, int uncertainty);
+static int loc_eng_inject_location(double latitude, double longitude, float accuracy);
+static void loc_eng_delete_aiding_data (GpsAidingData f);
+static const void* loc_eng_get_extension(const char* name);
+
+// Function declarations for sLocEngAGpsInterface
+static void loc_eng_agps_init(AGpsCallbacks* callbacks);
+static int loc_eng_agps_data_conn_open(const char* apn);
+static int loc_eng_agps_data_conn_closed();
+static int loc_eng_agps_data_conn_failed();
+static int loc_eng_agps_set_server(AGpsType type, const char* hostname, int port);
+
+
+static int32 loc_event_cb (rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload);
+static void loc_eng_report_position (const rpc_loc_parsed_position_s_type *location_report_ptr);
+static void loc_eng_report_sv (const rpc_loc_gnss_info_s_type *gnss_report_ptr);
+static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_report_ptr);
+static void loc_eng_report_nmea (const rpc_loc_nmea_report_s_type *nmea_report_ptr);
+static void loc_eng_process_conn_request (const rpc_loc_server_request_s_type *server_request_ptr);
+
+static void loc_eng_process_deferred_action (void* arg);
+static void loc_eng_process_atl_deferred_action (int flags);
+static void loc_eng_delete_aiding_data_deferred_action (void);
+
+static int set_agps_server();
+
+// Defines the GpsInterface in gps.h
+static const GpsInterface sLocEngInterface =
+{
+ sizeof(GpsInterface),
+ loc_eng_init,
+ loc_eng_start,
+ loc_eng_stop,
+ loc_eng_cleanup,
+ loc_eng_inject_time,
+ loc_eng_inject_location,
+ loc_eng_delete_aiding_data,
+ loc_eng_set_position_mode,
+ loc_eng_get_extension,
+};
+
+static const AGpsInterface sLocEngAGpsInterface =
+{
+ sizeof(AGpsInterface),
+ loc_eng_agps_init,
+ loc_eng_agps_data_conn_open,
+ loc_eng_agps_data_conn_closed,
+ loc_eng_agps_data_conn_failed,
+ loc_eng_agps_set_server,
+};
+
+// Global data structure for location engine
+loc_eng_data_s_type loc_eng_data;
+
+/*===========================================================================
+FUNCTION gps_get_hardware_interface
+
+DESCRIPTION
+ Returns the GPS hardware interaface based on LOC API
+ if GPS is enabled.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+const GpsInterface* gps_get_hardware_interface ()
+{
+ char propBuf[PROPERTY_VALUE_MAX];
+
+ // check to see if GPS should be disabled
+ property_get("gps.disable", propBuf, "");
+ if (propBuf[0] == '1')
+ {
+ LOGD("gps_get_interface returning NULL because gps.disable=1\n");
+ return NULL;
+ }
+
+ return &sLocEngInterface;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_init
+
+DESCRIPTION
+ Initialize the location engine, this include setting up global datas
+ and registers location engien with loc api service.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+
+// fully shutting down the GPS is temporarily disabled to avoid intermittent BP crash
+#define DISABLE_CLEANUP 1
+
+static int loc_eng_init(GpsCallbacks* callbacks)
+{
+#if DISABLE_CLEANUP
+ if (loc_eng_data.deferred_action_thread) {
+ // already initialized
+ return 0;
+ }
+#endif
+ // Start the LOC api RPC service
+ loc_api_glue_init ();
+
+ callbacks->set_capabilities_cb(GPS_CAPABILITY_SCHEDULING | GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
+
+ memset (&loc_eng_data, 0, sizeof (loc_eng_data_s_type));
+
+ // LOC ENG module data initialization
+ loc_eng_data.location_cb = callbacks->location_cb;
+ loc_eng_data.sv_status_cb = callbacks->sv_status_cb;
+ loc_eng_data.status_cb = callbacks->status_cb;
+ loc_eng_data.nmea_cb = callbacks->nmea_cb;
+ loc_eng_data.acquire_wakelock_cb = callbacks->acquire_wakelock_cb;
+ loc_eng_data.release_wakelock_cb = callbacks->release_wakelock_cb;
+
+ rpc_loc_event_mask_type event = RPC_LOC_EVENT_PARSED_POSITION_REPORT |
+ RPC_LOC_EVENT_SATELLITE_REPORT |
+ RPC_LOC_EVENT_LOCATION_SERVER_REQUEST |
+ RPC_LOC_EVENT_ASSISTANCE_DATA_REQUEST |
+ RPC_LOC_EVENT_IOCTL_REPORT |
+ RPC_LOC_EVENT_STATUS_REPORT |
+ RPC_LOC_EVENT_NMEA_POSITION_REPORT |
+ RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST;
+
+ loc_eng_data.client_handle = loc_open (event, loc_event_cb);
+
+ pthread_mutex_init (&(loc_eng_data.deferred_action_mutex), NULL);
+ pthread_cond_init (&(loc_eng_data.deferred_action_cond) , NULL);
+ pthread_mutex_init (&(loc_eng_data.deferred_stop_mutex), NULL);
+
+ loc_eng_data.loc_event = 0;
+ loc_eng_data.deferred_action_flags = 0;
+ memset (loc_eng_data.apn_name, 0, sizeof (loc_eng_data.apn_name));
+
+ loc_eng_data.aiding_data_for_deletion = 0;
+ loc_eng_data.engine_status = GPS_STATUS_NONE;
+
+ // XTRA module data initialization
+ loc_eng_data.xtra_module_data.download_request_cb = NULL;
+
+ // IOCTL module data initialization
+ loc_eng_data.ioctl_data.cb_is_selected = FALSE;
+ loc_eng_data.ioctl_data.cb_is_waiting = FALSE;
+ loc_eng_data.ioctl_data.client_handle = RPC_LOC_CLIENT_HANDLE_INVALID;
+ memset (&(loc_eng_data.ioctl_data.cb_payload),
+ 0,
+ sizeof (rpc_loc_ioctl_callback_s_type));
+
+ pthread_mutex_init (&(loc_eng_data.ioctl_data.cb_data_mutex), NULL);
+ pthread_cond_init(&loc_eng_data.ioctl_data.cb_arrived_cond, NULL);
+
+ loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",
+ loc_eng_process_deferred_action, NULL);
+
+ LOGD ("loc_eng_init called, client id = %d\n", (int32) loc_eng_data.client_handle);
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_cleanup
+
+DESCRIPTION
+ Cleans location engine. The location client handle will be released.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_cleanup()
+{
+#if DISABLE_CLEANUP
+ return;
+#else
+ if (loc_eng_data.deferred_action_thread)
+ {
+ /* Terminate deferred action working thread */
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_QUIT;
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+
+ void* ignoredValue;
+ pthread_join(loc_eng_data.deferred_action_thread, &ignoredValue);
+ loc_eng_data.deferred_action_thread = NULL;
+ }
+
+ // clean up
+ (void) loc_close (loc_eng_data.client_handle);
+
+ pthread_mutex_destroy (&loc_eng_data.deferred_action_mutex);
+ pthread_cond_destroy (&loc_eng_data.deferred_action_cond);
+
+ pthread_mutex_destroy (&loc_eng_data.ioctl_data.cb_data_mutex);
+ pthread_cond_destroy (&loc_eng_data.ioctl_data.cb_arrived_cond);
+
+// Do not call this as it can result in the ARM9 crashing if it sends events while we are disabled
+// loc_apicb_app_deinit();
+#endif
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_start
+
+DESCRIPTION
+ Starts the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_start()
+{
+ int ret_val;
+ LOGD ("loc_eng_start\n");
+
+ if (loc_eng_data.position_mode != GPS_POSITION_MODE_STANDALONE &&
+ loc_eng_data.agps_server_host[0] != 0 &&
+ loc_eng_data.agps_server_port != 0) {
+ int result = set_agps_server();
+ LOGD ("set_agps_server returned = %d\n", result);
+ }
+
+ ret_val = loc_start_fix (loc_eng_data.client_handle);
+
+ if (ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOGD ("loc_eng_start returned error = %d\n", ret_val);
+ }
+
+ return 0;
+}
+
+
+/*===========================================================================
+FUNCTION loc_eng_stop
+
+DESCRIPTION
+ Stops the tracking session
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_stop()
+{
+ int ret_val;
+
+ LOGD ("loc_eng_stop\n");
+
+ pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
+ // work around problem with loc_eng_stop when AGPS requests are pending
+ // we defer stopping the engine until the AGPS request is done
+ if (loc_eng_data.agps_request_pending)
+ {
+ loc_eng_data.stop_request_pending = true;
+ LOGD ("deferring stop until AGPS data call is finished\n");
+ pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
+ return 0;
+ }
+ pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
+
+ ret_val = loc_stop_fix (loc_eng_data.client_handle);
+ if (ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOGD ("loc_eng_stop returned error = %d\n", ret_val);
+ }
+
+ return 0;
+}
+
+static int loc_eng_set_gps_lock(rpc_loc_lock_e_type lock_type)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+
+ LOGD ("loc_eng_set_gps_lock mode, client = %d, lock_type = %d\n",
+ (int32) loc_eng_data.client_handle, lock_type);
+
+ ioctl_data.rpc_loc_ioctl_data_u_type_u.engine_lock = lock_type;
+ 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*/);
+
+ if (ret_val != TRUE)
+ {
+ LOGD ("loc_eng_set_gps_lock mode failed\n");
+ }
+
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_set_position_mode
+
+DESCRIPTION
+ Sets the mode and fix frequency for the tracking session.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence recurrence,
+ uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time)
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_fix_criteria_s_type *fix_criteria_ptr;
+ boolean ret_val;
+
+ LOGD ("loc_eng_set_position mode, client = %d, interval = %d, mode = %d\n",
+ (int32) loc_eng_data.client_handle, min_interval, mode);
+
+ loc_eng_data.position_mode = mode;
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_FIX_CRITERIA;
+
+ fix_criteria_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.fix_criteria);
+ fix_criteria_ptr->valid_mask = RPC_LOC_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE |
+ RPC_LOC_FIX_CRIT_VALID_RECURRENCE_TYPE;
+
+ switch (mode) {
+ case GPS_POSITION_MODE_MS_BASED:
+ fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSB;
+ break;
+ case GPS_POSITION_MODE_MS_ASSISTED:
+ fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_MSA;
+ break;
+ case GPS_POSITION_MODE_STANDALONE:
+ default:
+ fix_criteria_ptr->preferred_operation_mode = RPC_LOC_OPER_MODE_STANDALONE;
+ break;
+ }
+ if (min_interval > 0) {
+ fix_criteria_ptr->min_interval = min_interval;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_MIN_INTERVAL;
+ }
+ if (preferred_accuracy > 0) {
+ fix_criteria_ptr->preferred_accuracy = preferred_accuracy;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_ACCURACY;
+ }
+ if (preferred_time > 0) {
+ fix_criteria_ptr->preferred_response_time = preferred_time;
+ fix_criteria_ptr->valid_mask |= RPC_LOC_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME;
+ }
+
+ switch (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;
+ }
+
+ ret_val = loc_eng_ioctl(loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_FIX_CRITERIA,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ if (ret_val != TRUE)
+ {
+ LOGD ("loc_eng_set_position mode failed\n");
+ }
+
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_inject_time
+
+DESCRIPTION
+ This is used by Java native function to do time injection.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_eng_inject_time (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;
+ boolean ret_val;
+
+ LOGD ("loc_eng_inject_time, uncertainty = %d\n", uncertainty);
+
+ ioctl_data.disc = RPC_LOC_IOCTL_INJECT_UTC_TIME;
+
+ 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)(android::elapsedRealtime() - timeReference);
+ time_info_ptr->uncertainty = uncertainty; // Uncertainty in ms
+
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_INJECT_UTC_TIME,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ if (ret_val != TRUE)
+ {
+ LOGD ("loc_eng_inject_time failed\n");
+ }
+
+ return 0;
+}
+
+static int loc_eng_inject_location (double latitude, double longitude, float accuracy)
+{
+ /* not yet implemented */
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data
+
+DESCRIPTION
+ This is used by Java native function to delete the aiding data. The function
+ updates the global variable for the aiding data to be deleted. If the GPS
+ engine is off, the aiding data will be deleted. Otherwise, the actual action
+ will happen when gps engine is turned off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_delete_aiding_data (GpsAidingData f)
+{
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+
+ // Currently, LOC API only support deletion of all aiding data,
+ if (f)
+ loc_eng_data.aiding_data_for_deletion = GPS_DELETE_ALL;
+
+ if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) &&
+ (loc_eng_data.aiding_data_for_deletion != 0))
+ {
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+
+ // In case gps engine is ON, the assistance data will be deleted when the engine is OFF
+ }
+
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+}
+
+/*===========================================================================
+FUNCTION loc_eng_get_extension
+
+DESCRIPTION
+ Get the gps extension to support XTRA.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ The GPS extension interface.
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static const void* loc_eng_get_extension(const char* name)
+{
+ if (strcmp(name, GPS_XTRA_INTERFACE) == 0)
+ {
+ return &sLocEngXTRAInterface;
+ }
+ else if (strcmp(name, AGPS_INTERFACE) == 0)
+ {
+ return &sLocEngAGpsInterface;
+ }
+ else if (strcmp(name, GPS_NI_INTERFACE) == 0)
+ {
+ return &sLocEngNiInterface;
+ }
+
+ return NULL;
+}
+
+#if DEBUG_MOCK_NI == 1
+/*===========================================================================
+FUNCTION mock_ni
+
+DESCRIPTION
+ DEBUG tool: simulate an NI request
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void* mock_ni(void* arg)
+{
+ static int busy = 0;
+
+ if (busy) return NULL;
+
+ busy = 1;
+
+ sleep(5);
+
+ rpc_loc_client_handle_type client_handle;
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type payload;
+ rpc_loc_ni_event_s_type *ni_req;
+ rpc_loc_ni_supl_notify_verify_req_s_type *supl_req;
+
+ client_handle = (rpc_loc_client_handle_type) arg;
+
+ loc_event = RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST;
+ payload.disc = loc_event;
+
+ ni_req = &payload.rpc_loc_event_payload_u_type_u.ni_request;
+ ni_req->event = RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ;
+ supl_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+
+ // Encodings for Spirent Communications
+ char client_name[80] = {0x53,0x78,0x5A,0x5E,0x76,0xD3,0x41,0xC3,0x77,
+ 0xBB,0x5D,0x77,0xA7,0xC7,0x61,0x7A,0xFA,0xED,0x9E,0x03};
+ char requestor_id[80] = {0x53,0x78,0x5A,0x5E,0x76,0xD3,0x41,0xC3,0x77,
+ 0xBB,0x5D,0x77,0xA7,0xC7,0x61,0x7A,0xFA,0xED,0x9E,0x03};
+
+ supl_req->flags = RPC_LOC_NI_CLIENT_NAME_PRESENT |
+ RPC_LOC_NI_REQUESTOR_ID_PRESENT |
+ RPC_LOC_NI_ENCODING_TYPE_PRESENT;
+
+ supl_req->datacoding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT;
+
+ supl_req->client_name.data_coding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT; // no coding
+ supl_req->client_name.client_name_string.client_name_string_len = strlen(client_name);
+ supl_req->client_name.client_name_string.client_name_string_val = client_name;
+ supl_req->client_name.string_len = strlen(client_name);
+
+ supl_req->requestor_id.data_coding_scheme = RPC_LOC_NI_SUPL_GSM_DEFAULT;
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_len = strlen(requestor_id);
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val = requestor_id;
+ supl_req->requestor_id.string_len = strlen(requestor_id);
+
+ supl_req->notification_priv_type = RPC_LOC_NI_USER_NOTIFY_VERIFY_ALLOW_NO_RESP;
+ supl_req->user_response_timer = 10;
+
+ loc_event_cb(client_handle, loc_event, &payload);
+
+ busy = 0;
+
+ return NULL;
+}
+#endif // DEBUG_MOCK_NI
+
+/*===========================================================================
+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(
+ rpc_loc_client_handle_type client_handle,
+ rpc_loc_event_mask_type loc_event,
+ const rpc_loc_event_payload_u_type* loc_event_payload
+ )
+{
+ LOGV ("loc_event_cb, client = %d, loc_event = 0x%x", (int32) client_handle, (uint32) loc_event);
+ if (client_handle == loc_eng_data.client_handle)
+ {
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+ loc_eng_data.loc_event = loc_event;
+ memcpy(&loc_eng_data.loc_event_payload, loc_event_payload, sizeof(*loc_event_payload));
+
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_EVENT;
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+ }
+ else
+ {
+ LOGD ("loc client mismatch: received = %d, expected = %d \n", (int32) client_handle, (int32) loc_eng_data.client_handle);
+ }
+
+ return RPC_LOC_API_SUCCESS;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_position
+
+DESCRIPTION
+ Reports position information to the Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_position (const rpc_loc_parsed_position_s_type *location_report_ptr)
+{
+ GpsLocation location;
+
+ LOGV ("loc_eng_report_position: location report, valid mask = 0x%x, sess status = %d\n",
+ (uint32) location_report_ptr->valid_mask, location_report_ptr->session_status);
+
+ memset (&location, 0, sizeof(location));
+ location.size = sizeof(location);
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SESSION_STATUS)
+ {
+ // Not a position report, return
+ if (location_report_ptr->session_status == RPC_LOC_SESS_STATUS_SUCCESS)
+ {
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_TIMESTAMP_UTC)
+ {
+ location.timestamp = location_report_ptr->timestamp_utc;
+ }
+
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LATITUDE) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_LONGITUDE))
+ {
+ location.flags |= GPS_LOCATION_HAS_LAT_LONG;
+ location.latitude = location_report_ptr->latitude;
+ location.longitude = location_report_ptr->longitude;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_ALTITUDE_WRT_ELLIPSOID )
+ {
+ location.flags |= GPS_LOCATION_HAS_ALTITUDE;
+ location.altitude = location_report_ptr->altitude_wrt_ellipsoid;
+ }
+
+ if ((location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_HORIZONTAL) &&
+ (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_SPEED_VERTICAL))
+ {
+ location.flags |= GPS_LOCATION_HAS_SPEED;
+ location.speed = sqrt(location_report_ptr->speed_horizontal * location_report_ptr->speed_horizontal +
+ location_report_ptr->speed_vertical * location_report_ptr->speed_vertical);
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HEADING)
+ {
+ location.flags |= GPS_LOCATION_HAS_BEARING;
+ location.bearing = location_report_ptr->heading;
+ }
+
+ if (location_report_ptr->valid_mask & RPC_LOC_POS_VALID_HOR_UNC_CIRCULAR)
+ {
+ location.flags |= GPS_LOCATION_HAS_ACCURACY;
+ location.accuracy = location_report_ptr->hor_unc_circular;
+ }
+
+ if (loc_eng_data.location_cb != NULL)
+ {
+ LOGV ("loc_eng_report_position: fire callback\n");
+ loc_eng_data.location_cb (&location);
+ }
+ }
+ else
+ {
+ LOGV ("loc_eng_report_position: ignore position report when session status = %d\n", location_report_ptr->session_status);
+ }
+ }
+ else
+ {
+ LOGV ("loc_eng_report_position: ignore position report when session status is not set\n");
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_sv
+
+DESCRIPTION
+ Reports GPS satellite information to the Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_sv (const rpc_loc_gnss_info_s_type *gnss_report_ptr)
+{
+ GpsSvStatus SvStatus;
+ int num_svs_max, i;
+ const rpc_loc_sv_info_s_type *sv_info_ptr;
+
+ LOGV ("loc_eng_report_sv: valid_mask = 0x%x, num of sv = %d\n",
+ (uint32) gnss_report_ptr->valid_mask,
+ gnss_report_ptr->sv_count);
+
+ num_svs_max = 0;
+ memset (&SvStatus, 0, sizeof (GpsSvStatus));
+ 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 (i = 0; i < num_svs_max; i++)
+ {
+ sv_info_ptr = &(gnss_report_ptr->sv_list.sv_list_val[i]);
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SYSTEM)
+ {
+ if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GPS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].size = sizeof(GpsSvStatus);
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn;
+
+ // We only have the data field to report gps eph and alm mask
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_EPH) &&
+ (sv_info_ptr->has_eph == 1))
+ {
+ SvStatus.ephemeris_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_HAS_ALM) &&
+ (sv_info_ptr->has_alm == 1))
+ {
+ SvStatus.almanac_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+
+ if ((sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_PROCESS_STATUS) &&
+ (sv_info_ptr->process_status == RPC_LOC_SV_STATUS_TRACK))
+ {
+ SvStatus.used_in_fix_mask |= (1 << (sv_info_ptr->prn-1));
+ }
+ }
+ // SBAS: GPS RPN: 120-151,
+ // In exteneded measurement report, we follow nmea standard, which is from 33-64.
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_SBAS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + 33 - 120;
+ }
+ // Gloness: Slot id: 1-32
+ // In extended measurement report, we follow nmea standard, which is 65-96
+ else if (sv_info_ptr->system == RPC_LOC_SV_SYSTEM_GLONASS)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].prn = sv_info_ptr->prn + (65-1);
+ }
+ // Unsupported SV system
+ else
+ {
+ continue;
+ }
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_SNR)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].snr = sv_info_ptr->snr;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_ELEVATION)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].elevation = sv_info_ptr->elevation;
+ }
+
+ if (sv_info_ptr->valid_mask & RPC_LOC_SV_INFO_VALID_AZIMUTH)
+ {
+ SvStatus.sv_list[SvStatus.num_svs].azimuth = sv_info_ptr->azimuth;
+ }
+
+ SvStatus.num_svs++;
+ }
+ }
+
+ LOGV ("num_svs = %d, eph mask = %d, alm mask = %d\n", SvStatus.num_svs, SvStatus.ephemeris_mask, SvStatus.almanac_mask );
+ if ((SvStatus.num_svs != 0) && (loc_eng_data.sv_status_cb != NULL))
+ {
+ loc_eng_data.sv_status_cb(&SvStatus);
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_report_status
+
+DESCRIPTION
+ Reports GPS engine state to Java layer.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_report_ptr)
+{
+ GpsStatus status;
+
+ LOGV ("loc_eng_report_status: event = %d\n", status_report_ptr->event);
+
+ memset (&status, 0, sizeof(status));
+ status.size = sizeof(status);
+ status.status = GPS_STATUS_NONE;
+ 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)
+ {
+ // GPS_STATUS_SESSION_BEGIN implies GPS_STATUS_ENGINE_ON
+ status.status = GPS_STATUS_SESSION_BEGIN;
+ loc_eng_data.status_cb(&status);
+ }
+ else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ // GPS_STATUS_SESSION_END implies GPS_STATUS_ENGINE_OFF
+ status.status = GPS_STATUS_ENGINE_OFF;
+ loc_eng_data.status_cb(&status);
+ }
+ }
+
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+ loc_eng_data.engine_status = status.status;
+
+ // Wake up the thread for aiding data deletion.
+ if ((loc_eng_data.engine_status != GPS_STATUS_SESSION_BEGIN) &&
+ (loc_eng_data.aiding_data_for_deletion != 0))
+ {
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_DELETE_AIDING;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ // In case gps engine is ON, the assistance data will be deleted when the engine is OFF
+ }
+
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+}
+
+static void loc_eng_report_nmea (const rpc_loc_nmea_report_s_type *nmea_report_ptr)
+{
+ if (loc_eng_data.nmea_cb != NULL)
+ {
+ struct timeval tv;
+
+ gettimeofday(&tv, (struct timezone *) NULL);
+ long long now = tv.tv_sec * 1000LL + tv.tv_usec / 1000;
+
+#if (AMSS_VERSION==3200)
+ loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences.nmea_sentences_val,
+ nmea_report_ptr->nmea_sentences.nmea_sentences_len);
+#else
+ loc_eng_data.nmea_cb(now, nmea_report_ptr->nmea_sentences, nmea_report_ptr->length);
+#endif
+ }
+}
+
+/*===========================================================================
+FUNCTION loc_eng_process_conn_request
+
+DESCRIPTION
+ Requests data connection to be brought up/tore down with the location server.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_process_conn_request (const rpc_loc_server_request_s_type *server_request_ptr)
+{
+ LOGD ("loc_event_cb: get loc event location server request, event = %d\n", server_request_ptr->event);
+
+ // Signal DeferredActionThread to send the APN name
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+
+ // This implemenation is based on the fact that modem now at any time has only one data connection for AGPS at any given time
+ if (server_request_ptr->event == RPC_LOC_SERVER_REQUEST_OPEN)
+ {
+ loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.open_req.conn_handle;
+ loc_eng_data.agps_status = GPS_REQUEST_AGPS_DATA_CONN;
+ loc_eng_data.agps_request_pending = true;
+ }
+ else
+ {
+ loc_eng_data.conn_handle = server_request_ptr->payload.rpc_loc_server_request_u_type_u.close_req.conn_handle;
+ loc_eng_data.agps_status = GPS_RELEASE_AGPS_DATA_CONN;
+ loc_eng_data.agps_request_pending = false;
+ }
+
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_STATUS;
+ pthread_cond_signal(&loc_eng_data.deferred_action_cond);
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_agps_init
+
+DESCRIPTION
+
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_agps_init(AGpsCallbacks* callbacks)
+{
+ LOGV("loc_eng_agps_init\n");
+ loc_eng_data.agps_status_cb = callbacks->status_cb;
+}
+
+static int loc_eng_agps_data_conn_open(const char* apn)
+{
+ int apn_len;
+ LOGD("loc_eng_agps_data_conn_open: %s\n", apn);
+
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+
+ if (apn != NULL)
+ {
+ apn_len = strlen (apn);
+
+ if (apn_len >= sizeof(loc_eng_data.apn_name))
+ {
+ LOGD ("loc_eng_set_apn: error, apn name exceeds maximum lenght of 100 chars\n");
+ apn_len = sizeof(loc_eng_data.apn_name) - 1;
+ }
+
+ memcpy (loc_eng_data.apn_name, apn, apn_len);
+ loc_eng_data.apn_name[apn_len] = '\0';
+ }
+
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_SUCCESS;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ return 0;
+}
+
+static int loc_eng_agps_data_conn_closed()
+{
+ LOGD("loc_eng_agps_data_conn_closed\n");
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_CLOSED;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ return 0;
+}
+
+static int loc_eng_agps_data_conn_failed()
+{
+ LOGD("loc_eng_agps_data_conn_failed\n");
+
+ pthread_mutex_lock(&(loc_eng_data.deferred_action_mutex));
+ /* hold a wake lock while events are pending for deferred_action_thread */
+ loc_eng_data.acquire_wakelock_cb();
+ loc_eng_data.deferred_action_flags |= DEFERRED_ACTION_AGPS_DATA_FAILED;
+ pthread_cond_signal(&(loc_eng_data.deferred_action_cond));
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+ return 0;
+}
+
+static int set_agps_server()
+{
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_server_info_s_type *server_info_ptr;
+ boolean ret_val;
+ uint16 port_temp;
+ unsigned char *b_ptr;
+
+ if (loc_eng_data.agps_server_host[0] == 0 || loc_eng_data.agps_server_port == 0)
+ return -1;
+
+ if (loc_eng_data.agps_server_address == 0) {
+ struct hostent* he = gethostbyname(loc_eng_data.agps_server_host);
+ if (he)
+ loc_eng_data.agps_server_address = *(uint32_t *)he->h_addr_list[0];
+ }
+ if (loc_eng_data.agps_server_address == 0)
+ return -1;
+
+ b_ptr = (unsigned char*) (&loc_eng_data.agps_server_address);
+
+
+ server_info_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.server_addr);
+ ioctl_data.disc = RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR;
+ server_info_ptr->addr_type = RPC_LOC_SERVER_ADDR_URL;
+ server_info_ptr->addr_info.disc = RPC_LOC_SERVER_ADDR_URL;
+
+#if (AMSS_VERSION==3200)
+ char url[24];
+ memset(url, 0, sizeof(url));
+ snprintf(url, sizeof(url) - 1, "%d.%d.%d.%d:%d",
+ (*(b_ptr + 0) & 0x000000ff), (*(b_ptr+1) & 0x000000ff),
+ (*(b_ptr + 2) & 0x000000ff), (*(b_ptr+3) & 0x000000ff),
+ (loc_eng_data.agps_server_port & (0x0000ffff)));
+
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val = url;
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_len = strlen(url);
+ LOGD ("set_agps_server, addr = %s\n", server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr.addr_val);
+#else
+ char* buf = server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr;
+ int buf_len = sizeof(server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.addr);
+ memset(buf, 0, buf_len);
+ snprintf(buf, buf_len - 1, "%d.%d.%d.%d:%d",
+ (*(b_ptr + 0) & 0x000000ff), (*(b_ptr+1) & 0x000000ff),
+ (*(b_ptr + 2) & 0x000000ff), (*(b_ptr+3) & 0x000000ff),
+ (loc_eng_data.agps_server_port & (0x0000ffff)));
+
+ server_info_ptr->addr_info.rpc_loc_server_addr_u_type_u.url.length = buf_len;
+ LOGD ("set_agps_server, addr = %s\n", buf);
+#endif
+
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_SET_UMTS_SLP_SERVER_ADDR,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+
+ if (ret_val != TRUE)
+ {
+ LOGD ("set_agps_server failed\n");
+ return -1;
+ }
+ else
+ {
+ LOGV ("set_agps_server successful\n");
+ return 0;
+ }
+}
+
+static int loc_eng_agps_set_server(AGpsType type, const char* hostname, int port)
+{
+ LOGD ("loc_eng_set_default_agps_server, type = %d, hostname = %s, port = %d\n", type, hostname, port);
+
+ if (type != AGPS_TYPE_SUPL)
+ return -1;
+
+ strncpy(loc_eng_data.agps_server_host, hostname, sizeof(loc_eng_data.agps_server_host) - 1);
+ loc_eng_data.agps_server_port = port;
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_delete_aiding_data_deferred_action
+
+DESCRIPTION
+ This is used to remove the aiding data when GPS engine is off.
+
+DEPENDENCIES
+ Assumes the aiding data type specified in GpsAidingData matches with
+ LOC API specification.
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_delete_aiding_data_deferred_action (void)
+{
+ // Currently, we only support deletion of all aiding data,
+ // since the Android defined aiding data mask matches with modem,
+ // so just pass them down without any translation
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_assist_data_delete_s_type *assist_data_ptr;
+ boolean ret_val;
+
+ ioctl_data.disc = RPC_LOC_IOCTL_DELETE_ASSIST_DATA;
+ assist_data_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.assist_data_delete);
+ assist_data_ptr->type = loc_eng_data.aiding_data_for_deletion;
+ loc_eng_data.aiding_data_for_deletion = 0;
+
+ memset (&(assist_data_ptr->reserved), 0, sizeof (assist_data_ptr->reserved));
+
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_DELETE_ASSIST_DATA ,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL);
+
+ LOGD("loc_eng_ioctl for aiding data deletion returned %d, 1 for success\n", ret_val);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_process_atl_deferred_action
+
+DESCRIPTION
+ This is used to inform the location engine of the processing status for
+ data connection open/close request.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ RPC_LOC_API_SUCCESS
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_process_atl_deferred_action (int flags)
+{
+ rpc_loc_server_open_status_s_type *conn_open_status_ptr;
+ rpc_loc_server_close_status_s_type *conn_close_status_ptr;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ boolean ret_val;
+ int agps_status = -1;
+
+ LOGV("loc_eng_process_atl_deferred_action, agps_status = %d\n", loc_eng_data.agps_status);
+
+ memset (&ioctl_data, 0, sizeof (rpc_loc_ioctl_data_u_type));
+
+ if (flags & DEFERRED_ACTION_AGPS_DATA_CLOSED)
+ {
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_CLOSE_STATUS;
+ conn_close_status_ptr = &(ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_close_status);
+ conn_close_status_ptr->conn_handle = loc_eng_data.conn_handle;
+ conn_close_status_ptr->close_status = RPC_LOC_SERVER_CLOSE_SUCCESS;
+ }
+ else
+ {
+ ioctl_data.disc = RPC_LOC_IOCTL_INFORM_SERVER_OPEN_STATUS;
+ conn_open_status_ptr = &ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status;
+ conn_open_status_ptr->conn_handle = loc_eng_data.conn_handle;
+ if (flags & DEFERRED_ACTION_AGPS_DATA_SUCCESS)
+ {
+ conn_open_status_ptr->open_status = RPC_LOC_SERVER_OPEN_SUCCESS;
+ // Both buffer are of the same maximum size, and the source is null terminated
+ // strcpy (&(ioctl_data.rpc_loc_ioctl_data_u_type_u.conn_open_status.apn_name), &(loc_eng_data.apn_name));
+#if (AMSS_VERSION==3200)
+ conn_open_status_ptr->apn_name = loc_eng_data.apn_name;
+#else
+ memset(conn_open_status_ptr->apn_name, 0, sizeof(conn_open_status_ptr->apn_name));
+ strncpy(conn_open_status_ptr->apn_name, loc_eng_data.apn_name,
+ sizeof(conn_open_status_ptr->apn_name) - 1);
+#endif
+ // Delay this so that PDSM ATL module will behave properly
+ sleep (1);
+ LOGD("loc_eng_ioctl for ATL with apn_name = %s\n", conn_open_status_ptr->apn_name);
+ }
+ else // data_connection_failed
+ {
+ conn_open_status_ptr->open_status = RPC_LOC_SERVER_OPEN_FAIL;
+ }
+ // Delay this so that PDSM ATL module will behave properly
+ sleep (1);
+ }
+
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ ioctl_data.disc,
+ &ioctl_data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ NULL);
+
+ LOGD("loc_eng_ioctl for ATL returned %d (1 for success)\n", ret_val);
+}
+
+/*===========================================================================
+FUNCTION loc_eng_process_loc_event
+
+DESCRIPTION
+ This is used to process events received from the location engine.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ N/A
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_process_loc_event (rpc_loc_event_mask_type loc_event,
+ rpc_loc_event_payload_u_type* loc_event_payload)
+{
+ if (loc_event & RPC_LOC_EVENT_PARSED_POSITION_REPORT)
+ {
+ loc_eng_report_position (&(loc_event_payload->rpc_loc_event_payload_u_type_u.parsed_location_report));
+ }
+
+ if (loc_event & RPC_LOC_EVENT_SATELLITE_REPORT)
+ {
+ loc_eng_report_sv (&(loc_event_payload->rpc_loc_event_payload_u_type_u.gnss_report));
+ }
+
+ if (loc_event & RPC_LOC_EVENT_STATUS_REPORT)
+ {
+ loc_eng_report_status (&(loc_event_payload->rpc_loc_event_payload_u_type_u.status_report));
+ }
+
+ if (loc_event & RPC_LOC_EVENT_NMEA_POSITION_REPORT)
+ {
+ loc_eng_report_nmea (&(loc_event_payload->rpc_loc_event_payload_u_type_u.nmea_report));
+ }
+
+ // Android XTRA interface 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)
+ {
+ LOGD ("loc_event_cb: xtra download requst");
+
+ // Call Registered callback
+ if (loc_eng_data.xtra_module_data.download_request_cb != NULL)
+ {
+ loc_eng_data.xtra_module_data.download_request_cb ();
+ }
+ }
+ }
+
+ if (loc_event & RPC_LOC_EVENT_IOCTL_REPORT)
+ {
+ // Process the received RPC_LOC_EVENT_IOCTL_REPORT
+ (void) loc_eng_ioctl_process_cb (loc_eng_data.client_handle,
+ &(loc_event_payload->rpc_loc_event_payload_u_type_u.ioctl_report));
+ }
+
+ if (loc_event & RPC_LOC_EVENT_LOCATION_SERVER_REQUEST)
+ {
+ loc_eng_process_conn_request (&(loc_event_payload->rpc_loc_event_payload_u_type_u.loc_server_request));
+ }
+
+ loc_eng_ni_callback(loc_event, loc_event_payload);
+
+#if DEBUG_MOCK_NI == 1
+ // DEBUG only
+ if ((loc_event & RPC_LOC_EVENT_STATUS_REPORT) &&
+ loc_event_payload->rpc_loc_event_payload_u_type_u.status_report.
+ payload.rpc_loc_status_event_payload_u_type_u.engine_state
+ == RPC_LOC_ENGINE_STATE_OFF)
+ {
+ // Mock an NI request
+ pthread_t th;
+ pthread_create (&th, NULL, mock_ni, (void*) client_handle);
+ }
+#endif /* DEBUG_MOCK_NI == 1 */
+}
+
+/*===========================================================================
+FUNCTION loc_eng_process_deferred_action
+
+DESCRIPTION
+ Main routine for the thread to execute certain commands
+ that are not safe to be done from within an RPC callback.
+
+DEPENDENCIES
+ None
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static void loc_eng_process_deferred_action (void* arg)
+{
+ AGpsStatus status;
+ status.size = sizeof(status);
+ status.type = AGPS_TYPE_SUPL;
+
+ LOGD("loc_eng_process_deferred_action started\n");
+
+ // make sure we do not run in background scheduling group
+ set_sched_policy(gettid(), SP_FOREGROUND);
+
+ // disable the GPS lock
+ LOGD("Setting GPS privacy lock to RPC_LOC_LOCK_NONE\n");
+ loc_eng_set_gps_lock(RPC_LOC_LOCK_NONE);
+
+ while (1)
+ {
+ GpsAidingData aiding_data_for_deletion;
+ GpsStatusValue engine_status;
+
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type loc_event_payload;
+
+ // Wait until we are signalled to do a deferred action, or exit
+ pthread_mutex_lock(&loc_eng_data.deferred_action_mutex);
+
+ // If we have an event we should process it immediately,
+ // otherwise wait until we are signalled
+ if (loc_eng_data.deferred_action_flags == 0) {
+ // do not hold a wake lock while waiting for an event...
+ loc_eng_data.release_wakelock_cb();
+ pthread_cond_wait(&loc_eng_data.deferred_action_cond,
+ &loc_eng_data.deferred_action_mutex);
+ // but after we are signalled reacquire the wake lock
+ // until we are done processing the event.
+ loc_eng_data.acquire_wakelock_cb();
+ }
+
+ if (loc_eng_data.deferred_action_flags & DEFERRED_ACTION_QUIT)
+ {
+ pthread_mutex_unlock(&loc_eng_data.deferred_action_mutex);
+ break;
+ }
+
+ // copy anything we need before releasing the mutex
+ loc_event = loc_eng_data.loc_event;
+ if (loc_event != 0) {
+ memcpy(&loc_event_payload, &loc_eng_data.loc_event_payload, sizeof(loc_event_payload));
+ loc_eng_data.loc_event = 0;
+ }
+
+ int flags = loc_eng_data.deferred_action_flags;
+ loc_eng_data.deferred_action_flags = 0;
+ engine_status = loc_eng_data.agps_status;
+ aiding_data_for_deletion = loc_eng_data.aiding_data_for_deletion;
+ status.status = loc_eng_data.agps_status;
+ loc_eng_data.agps_status = 0;
+
+ // perform all actions after releasing the mutex to avoid blocking RPCs from the ARM9
+ pthread_mutex_unlock(&(loc_eng_data.deferred_action_mutex));
+
+ if (loc_event != 0) {
+ loc_eng_process_loc_event(loc_event, &loc_event_payload);
+ }
+
+ // send_delete_aiding_data must be done when GPS engine is off
+ if ((engine_status != GPS_STATUS_SESSION_BEGIN) && (aiding_data_for_deletion != 0))
+ {
+ loc_eng_delete_aiding_data_deferred_action ();
+ }
+
+ if (flags & (DEFERRED_ACTION_AGPS_DATA_SUCCESS |
+ DEFERRED_ACTION_AGPS_DATA_CLOSED |
+ DEFERRED_ACTION_AGPS_DATA_FAILED))
+ {
+ loc_eng_process_atl_deferred_action(flags);
+
+ pthread_mutex_lock(&(loc_eng_data.deferred_stop_mutex));
+ // work around problem with loc_eng_stop when AGPS requests are pending
+ // we defer stopping the engine until the AGPS request is done
+ loc_eng_data.agps_request_pending = false;
+ if (loc_eng_data.stop_request_pending)
+ {
+ LOGD ("handling deferred stop\n");
+ if (loc_stop_fix(loc_eng_data.client_handle) != RPC_LOC_API_SUCCESS)
+ {
+ LOGD ("loc_stop_fix failed!\n");
+ }
+ }
+ pthread_mutex_unlock(&(loc_eng_data.deferred_stop_mutex));
+ }
+
+ if (status.status != 0 && loc_eng_data.agps_status_cb) {
+ loc_eng_data.agps_status_cb(&status);
+ }
+ }
+
+ // reenable the GPS lock
+ LOGD("Setting GPS privacy lock to RPC_LOC_LOCK_ALL\n");
+ loc_eng_set_gps_lock(RPC_LOC_LOCK_ALL);
+
+ LOGD("loc_eng_process_deferred_action thread exiting\n");
+ loc_eng_data.release_wakelock_cb();
+
+ loc_eng_data.deferred_action_thread = 0;
+}
+
+// for gps.c
+extern "C" const GpsInterface* get_gps_interface()
+{
+ return &sLocEngInterface;
+}
diff --git a/loc_api/libloc_api_goog/loc_eng.h b/loc_api/libloc_api_goog/loc_eng.h
new file mode 100755
index 0000000..39f3d91
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng.h
@@ -0,0 +1,119 @@
+/******************************************************************************
+ @file: loc_eng.h
+ @brief:
+
+ DESCRIPTION
+ This file defines the global data structure used by this module.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+/*=====================================================================
+$Header: $
+$DateTime: $
+$Author: $
+======================================================================*/
+
+#ifndef LOC_ENG_H
+#define LOC_ENG_H
+
+// Define boolean type to be used by libgps on loc api module
+typedef unsigned char boolean;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include <loc_eng_ioctl.h>
+#include <loc_eng_xtra.h>
+#include <hardware/gps.h>
+
+#define LOC_IOCTL_DEFAULT_TIMEOUT 1000 // 1000 milli-seconds
+
+enum {
+ DEFERRED_ACTION_EVENT = 0x01,
+ DEFERRED_ACTION_DELETE_AIDING = 0x02,
+ DEFERRED_ACTION_AGPS_STATUS = 0x04,
+ DEFERRED_ACTION_AGPS_DATA_SUCCESS = 0x08,
+ DEFERRED_ACTION_AGPS_DATA_CLOSED = 0x10,
+ DEFERRED_ACTION_AGPS_DATA_FAILED = 0x20,
+ DEFERRED_ACTION_QUIT = 0x40,
+};
+
+// Module data
+typedef struct
+{
+ rpc_loc_client_handle_type client_handle;
+
+ gps_location_callback location_cb;
+ gps_status_callback status_cb;
+ gps_sv_status_callback sv_status_cb;
+ agps_status_callback agps_status_cb;
+ gps_nmea_callback nmea_cb;
+ gps_ni_notify_callback ni_notify_cb;
+ gps_acquire_wakelock acquire_wakelock_cb;
+ gps_release_wakelock release_wakelock_cb;
+ int agps_status;
+
+ // used to defer stopping the GPS engine until AGPS data calls are done
+ boolean agps_request_pending;
+ boolean stop_request_pending;
+ pthread_mutex_t deferred_stop_mutex;
+
+ loc_eng_xtra_data_s_type xtra_module_data;
+
+ loc_eng_ioctl_data_s_type ioctl_data;
+
+ // data from loc_event_cb
+ rpc_loc_event_mask_type loc_event;
+ rpc_loc_event_payload_u_type loc_event_payload;
+
+ // TBD:
+ char agps_server_host[256];
+ int agps_server_port;
+ uint32 agps_server_address;
+ char apn_name[100];
+ int position_mode;
+ rpc_loc_server_connection_handle conn_handle;
+
+ // GPS engine status
+ GpsStatusValue engine_status;
+
+ // Aiding data information to be deleted, aiding data can only be deleted when GPS engine is off
+ GpsAidingData aiding_data_for_deletion;
+
+ // Data variables used by deferred action thread
+ pthread_t deferred_action_thread;
+ // Mutex used by deferred action thread
+ pthread_mutex_t deferred_action_mutex;
+ // Condition variable used by deferred action thread
+ pthread_cond_t deferred_action_cond;
+
+ // flags for pending events for deferred action thread
+ int deferred_action_flags;
+} loc_eng_data_s_type;
+
+extern loc_eng_data_s_type loc_eng_data;
+
+#endif // LOC_ENG_H
diff --git a/loc_api/libloc_api_goog/loc_eng_ioctl.cpp b/loc_api/libloc_api_goog/loc_eng_ioctl.cpp
new file mode 100755
index 0000000..87ca5b0
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng_ioctl.cpp
@@ -0,0 +1,358 @@
+
+/******************************************************************************
+ @file: loc_eng.cpp
+ @brief:
+
+ DESCRIPTION
+ This file defines the implemenation for GPS hardware abstraction layer.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+/*=====================================================================
+$Header: $
+$DateTime: $
+$Author: $
+======================================================================*/
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <math.h>
+#include <pthread.h>
+
+#include <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+
+#include <hardware/gps.h>
+
+#include <loc_eng.h>
+
+#define LOG_TAG "lib_locapi"
+#include <utils/Log.h>
+
+// comment this out to enable logging
+// #undef LOGD
+// #define LOGD(...) {}
+
+// Function declarations
+static boolean loc_eng_ioctl_setup_cb(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type
+);
+
+static boolean loc_eng_ioctl_wait_cb(
+ int timeout_msec, // Timeout in this number of msec
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr // Output parameter for IOCTL calls
+);
+
+/*===========================================================================
+
+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
+
+===========================================================================*/
+boolean 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
+ )
+{
+ boolean ret_val;
+ int rpc_ret_val;
+ loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
+
+ LOGV ("loc_eng_ioctl: client = %d, ioctl_type = %d, cb_data =0x%x\n", (int32) handle, ioctl_type, (uint32) cb_data_ptr);
+
+ ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
+ // Select the callback we are waiting for
+ ret_val = loc_eng_ioctl_setup_cb (handle, ioctl_type);
+
+ if (ret_val == TRUE)
+ {
+ rpc_ret_val = loc_ioctl (handle,
+ ioctl_type,
+ ioctl_data_ptr);
+
+ LOGV ("loc_eng_ioctl: loc_ioctl returned %d \n", rpc_ret_val);
+
+ if (rpc_ret_val == RPC_LOC_API_SUCCESS)
+ {
+ // Wait for the callback of loc_ioctl
+ ret_val = loc_eng_ioctl_wait_cb (timeout_msec, cb_data_ptr);
+ }
+ else
+ {
+ ret_val = FALSE;
+ }
+ }
+
+ // Reset the state when we are done
+ pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
+ ioctl_cb_data_ptr->cb_is_selected = FALSE;
+ ioctl_cb_data_ptr->cb_is_waiting = FALSE;
+ ioctl_cb_data_ptr->cb_has_arrived = FALSE;
+ pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
+
+ return ret_val;
+}
+
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl_setup_cb
+
+DESCRIPTION
+ Selects which callback is going to be waited for
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static boolean loc_eng_ioctl_setup_cb(
+ rpc_loc_client_handle_type handle,
+ rpc_loc_ioctl_e_type ioctl_type
+ )
+{
+ boolean ret_val;
+ loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
+
+ ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
+
+ pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
+ if (ioctl_cb_data_ptr->cb_is_selected == TRUE)
+ {
+ LOGD ("loc_eng_ioctl_setup_cb: ERROR, another ioctl in progress \n");
+ ret_val = FALSE;
+ }
+ else
+ {
+ ioctl_cb_data_ptr->cb_is_selected = TRUE;
+ ioctl_cb_data_ptr->cb_is_waiting = FALSE;
+ ioctl_cb_data_ptr->cb_has_arrived = FALSE;
+ ioctl_cb_data_ptr->client_handle = handle;
+ ioctl_cb_data_ptr->ioctl_type = ioctl_type;
+ memset (&(ioctl_cb_data_ptr->cb_payload), 0, sizeof (rpc_loc_ioctl_callback_s_type));
+ ret_val = TRUE;
+ }
+ pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
+
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl_wait_cb
+
+DESCRIPTION
+ Waits for a selected callback. The wait expires in timeout_msec.
+
+ If the function is called before an existing wait has finished, it will
+ immediately return EBUSY.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+boolean loc_eng_ioctl_wait_cb(
+ int timeout_msec, // Timeout in this number of msec
+ rpc_loc_ioctl_callback_s_type *cb_data_ptr
+ )
+{
+ boolean ret_val = FALSE; // the return value of this function
+ int rc; // return code from pthread calls
+
+ struct timeval present_time;
+ struct timespec expire_time;
+ loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
+
+ ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
+
+ pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
+
+ do {
+ if (ioctl_cb_data_ptr->cb_is_selected == FALSE)
+ {
+ LOGD ("loc_eng_ioctl_wait_cb: ERROR called when cb_is_waiting is set to FALSE \n");
+ ret_val = FALSE;
+ break;
+ }
+
+ // Calculate absolute expire time
+ gettimeofday(&present_time, NULL);
+ expire_time.tv_sec = present_time.tv_sec;
+ expire_time.tv_sec += timeout_msec / 1000;
+ if ((present_time.tv_usec + timeout_msec) >= 1000)
+ {
+ expire_time.tv_sec += 1;
+ }
+ expire_time.tv_nsec = (present_time.tv_usec + timeout_msec) % 1000 * 1000;
+
+ // Special case where callback is issued before loc_ioctl ever returns
+ if (ioctl_cb_data_ptr->cb_has_arrived == TRUE)
+ {
+ LOGD ("loc_eng_ioctl_wait_cb: cb has arrived without waiting \n");
+ ret_val = TRUE;
+ break;
+ }
+
+ ioctl_cb_data_ptr->cb_is_waiting = TRUE;
+ // Wait for the callback until timeout expires
+ rc = pthread_cond_timedwait(&ioctl_cb_data_ptr->cb_arrived_cond,
+ &ioctl_cb_data_ptr->cb_data_mutex,
+ &expire_time);
+
+ if (rc == 0)
+ {
+ ret_val = TRUE;
+ }
+ else
+ {
+ ret_val = FALSE;
+ }
+
+ LOGV ("loc_eng_ioctl_wait_cb: pthread_cond_timedwait returned %d\n", rc);
+
+ } while (0);
+
+ // Process the ioctl callback data when IOCTL is successful
+ if (ret_val == TRUE)
+ {
+ ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
+ if (ioctl_cb_data_ptr->cb_payload.status == RPC_LOC_API_SUCCESS)
+ {
+ ret_val = TRUE;
+ if (cb_data_ptr != NULL)
+ {
+ memcpy (cb_data_ptr,
+ &(ioctl_cb_data_ptr->cb_payload),
+ sizeof (rpc_loc_ioctl_callback_s_type));
+ }
+ }
+ else
+ {
+ ret_val = FALSE;
+ }
+ }
+
+ pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
+
+ LOGV ("loc_eng_ioctl_wait_cb: returned %d\n", ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ioctl_process_cb
+
+DESCRIPTION
+ This function process the IOCTL callback, parameter specifies the client
+ that receives the IOCTL callback.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ TRUE if successful
+ FALSE if failed
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+boolean loc_eng_ioctl_process_cb (
+ rpc_loc_client_handle_type client_handle,
+ const rpc_loc_ioctl_callback_s_type *cb_data_ptr
+ )
+{
+ boolean ret_val = FALSE; // the return value of this function
+ loc_eng_ioctl_data_s_type *ioctl_cb_data_ptr;
+ ioctl_cb_data_ptr = &(loc_eng_data.ioctl_data);
+
+ pthread_mutex_lock(&ioctl_cb_data_ptr->cb_data_mutex);
+ if (client_handle != ioctl_cb_data_ptr->client_handle)
+ {
+ LOGD ("loc_eng_ioctl_process_cb: client handle mismatch, received = %d, expected = %d \n",
+ (int32) client_handle, (int32) ioctl_cb_data_ptr->client_handle);
+ ret_val = FALSE;
+ }
+ else if (cb_data_ptr->type != ioctl_cb_data_ptr->ioctl_type)
+ {
+ LOGD ("loc_eng_ioctl_process_cb: ioctl type mismatch, received = %d, expected = %d \n",
+ cb_data_ptr->type, ioctl_cb_data_ptr->ioctl_type);
+ ret_val = FALSE;
+ }
+ else // both matches
+ {
+ memcpy (&(ioctl_cb_data_ptr->cb_payload),
+ cb_data_ptr,
+ sizeof (rpc_loc_ioctl_callback_s_type));
+
+ ioctl_cb_data_ptr->cb_has_arrived = TRUE;
+
+ LOGV ("loc_eng_ioctl_process_cb: callback arrived for client = %d, ioctl = %d, status = %d\n",
+ (int32) ioctl_cb_data_ptr->client_handle, ioctl_cb_data_ptr->ioctl_type,
+ (int32) ioctl_cb_data_ptr->cb_payload.status);
+
+ ret_val = TRUE;
+ }
+
+ pthread_mutex_unlock(&ioctl_cb_data_ptr->cb_data_mutex);
+
+ // Signal the waiting thread that callback has arrived
+ if (ret_val == TRUE)
+ {
+ pthread_cond_signal (&ioctl_cb_data_ptr->cb_arrived_cond);
+ }
+
+ return ret_val;
+}
diff --git a/loc_api/libloc_api_goog/loc_eng_ioctl.h b/loc_api/libloc_api_goog/loc_eng_ioctl.h
new file mode 100755
index 0000000..4090a4d
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng_ioctl.h
@@ -0,0 +1,75 @@
+/******************************************************************************
+ @file: loc_eng_ioctl.h
+ @brief:
+
+ DESCRIPTION
+ This file defines the data structure used by any location client that
+ waits for the ioctl particular event to occur. Any one IOCTL can be pending
+ at any time.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+/*=====================================================================
+$Header: $
+$DateTime: $
+$Author: $
+======================================================================*/
+
+#ifndef LOC_ENG_IOCTL_H
+#define LOC_ENG_IOCTL_H
+
+// Module data
+typedef struct loc_eng_ioctl_data_s_type
+{
+ // We are waiting for an ioctl callback
+ boolean cb_is_selected;
+ // The thread has been put in a wait state for an ioctl callback
+ boolean cb_is_waiting;
+ // Loc client handle that is waiting for the callback
+ rpc_loc_client_handle_type client_handle;
+ // IOCTL type that the loc client is waiting for
+ rpc_loc_ioctl_e_type ioctl_type;
+ // The IOCLT report has arrived for the waiting client
+ boolean cb_has_arrived;
+ // The payload for the RPC_LOC_EVENT_IOCTL_REPORT
+ rpc_loc_ioctl_callback_s_type cb_payload;
+ // Mutex to access this data structure
+ pthread_mutex_t cb_data_mutex;
+ // LOC ioctl callback arrived mutex
+ pthread_cond_t cb_arrived_cond;
+} loc_eng_ioctl_data_s_type;
+
+
+extern boolean 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
+);
+
+extern boolean loc_eng_ioctl_process_cb
+(
+ rpc_loc_client_handle_type client_handle,
+ const rpc_loc_ioctl_callback_s_type *cb_data_ptr
+);
+#endif // LOC_ENG_IOCTL_H
diff --git a/loc_api/libloc_api_goog/loc_eng_ni.cpp b/loc_api/libloc_api_goog/loc_eng_ni.cpp
new file mode 100755
index 0000000..958103a
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng_ni.cpp
@@ -0,0 +1,609 @@
+/******************************************************************************
+ @file: loc_eng_ni.cpp
+ @brief: module for network initiated interactions
+
+ DESCRIPTION
+ LOC_API network initiated operation support
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+ Copyright (c) 2009 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ -----------------------------------------------------------------------------
+******************************************************************************/
+
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+07/30/09 dx Initial version
+
+$Id:
+======================================================================*/
+
+#define LOG_NDDEBUG 0
+#define LOG_NIDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+#include <loc_eng.h>
+#include <loc_eng_ni.h>
+
+#define LOG_TAG "lib_locapi"
+#include <utils/Log.h>
+
+// comment this out to enable logging
+// #undef LOGD
+// #define LOGD(...) {}
+
+/*=============================================================================
+ *
+ * DATA DECLARATION
+ *
+ *============================================================================*/
+
+const GpsNiInterface sLocEngNiInterface =
+{
+ sizeof(GpsNiInterface),
+ loc_eng_ni_init,
+ loc_eng_ni_respond,
+};
+
+boolean loc_eng_ni_data_init = FALSE;
+loc_eng_ni_data_s_type loc_eng_ni_data;
+
+extern loc_eng_data_s_type loc_eng_data;
+
+/*=============================================================================
+ *
+ * FUNCTION DECLARATIONS
+ *
+ *============================================================================*/
+
+/*===========================================================================
+
+FUNCTION respond_from_enum
+
+DESCRIPTION
+ Returns the name of the response
+
+RETURN VALUE
+ response name string
+
+===========================================================================*/
+static const char* respond_from_enum(rpc_loc_ni_user_resp_e_type resp)
+{
+ switch (resp)
+ {
+ case RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT:
+ return "accept";
+ case RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY:
+ return "deny";
+ case RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP:
+ return "no response";
+ default:
+ return NULL;
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_ni_respond
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, the new one is handled using sys.ni_default_response (if exists);
+ otherwise, it is denied.
+
+DEPENDENCY
+ Do not lock the data by mutex loc_ni_lock
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+static void loc_ni_respond(rpc_loc_ni_user_resp_e_type resp,
+ const rpc_loc_ni_event_s_type *request_pass_back
+)
+{
+ LOGD("Sending NI response: %s\n", respond_from_enum(resp));
+
+ 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,
+ request_pass_back, sizeof (rpc_loc_ni_event_s_type));
+ data.rpc_loc_ioctl_data_u_type_u.user_verify_resp.user_resp = resp;
+
+ loc_eng_ioctl(
+ loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_INFORM_NI_USER_RESPONSE,
+ &data,
+ LOC_IOCTL_DEFAULT_TIMEOUT,
+ &callback_payload
+ );
+}
+
+/*===========================================================================
+
+FUNCTION loc_ni_fill_notif_verify_type
+
+DESCRIPTION
+ Fills need_notify, need_verify, etc.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+static boolean loc_ni_fill_notif_verify_type(GpsNiNotification *notif,
+ rpc_loc_ni_notify_verify_e_type notif_priv)
+{
+ notif->notify_flags = 0;
+ notif->default_response = GPS_NI_RESPONSE_NORESP;
+
+ switch (notif_priv)
+ {
+ case RPC_LOC_NI_USER_NO_NOTIFY_NO_VERIFY:
+ notif->notify_flags = 0;
+ break;
+
+ case RPC_LOC_NI_USER_NOTIFY_ONLY:
+ notif->notify_flags = GPS_NI_NEED_NOTIFY;
+ break;
+
+ 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;
+ break;
+
+ 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;
+ break;
+
+ case RPC_LOC_NI_USER_PRIVACY_OVERRIDE:
+ notif->notify_flags = GPS_NI_PRIVACY_OVERRIDE;
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/*===========================================================================
+
+FUNCTION hexcode
+
+DESCRIPTION
+ Converts a binary array into a Hex string. E.g., 1F 00 3F --> "1F003F"
+
+RETURN VALUE
+ bytes encoded
+
+===========================================================================*/
+static int hexcode(char *hexstring, int string_size, const char *data, int data_size)
+{
+ int i;
+ for (i = 0; i < data_size; i++)
+ {
+ char ch = data[i];
+ if (i*2 + 3 <= string_size)
+ {
+ snprintf(&hexstring[i*2], 3, "%02X", ch);
+ }
+ else {
+ break;
+ }
+ }
+ return i;
+}
+
+static GpsNiEncodingType convert_encoding_type(int loc_encoding)
+{
+ GpsNiEncodingType enc = GPS_ENC_UNKNOWN;
+
+ switch (loc_encoding)
+ {
+ case RPC_LOC_NI_SUPL_UTF8:
+ enc = GPS_ENC_SUPL_UTF8;
+ break;
+ case RPC_LOC_NI_SUPL_UCS2:
+ enc = GPS_ENC_SUPL_UCS2;
+ break;
+ case RPC_LOC_NI_SUPL_GSM_DEFAULT:
+ enc = GPS_ENC_SUPL_GSM_DEFAULT;
+ break;
+ default:
+ break;
+ }
+
+ return enc;
+}
+
+/*===========================================================================
+
+FUNCTION loc_ni_request_handler
+
+DESCRIPTION
+ Displays the NI request and awaits user input. If a previous request is
+ in session, it is ignored.
+
+RETURN VALUE
+ none
+
+===========================================================================*/
+static void loc_ni_request_handler(const char *msg, const rpc_loc_ni_event_s_type *ni_req)
+{
+ GpsNiNotification notif;
+ notif.size = sizeof(notif);
+ strlcpy(notif.text, "[text]", sizeof notif.text); // defaults
+ strlcpy(notif.requestor_id, "[requestor id]", sizeof notif.requestor_id);
+
+ /* If busy, use default or deny */
+ if (loc_eng_ni_data.notif_in_progress)
+ {
+#if 0
+ /* Cannot be here because the current thread is in RPC client */
+ /* XXX Consider adding an event queue to process overlapped NI requests */
+ loc_ni_user_resp_e_type response =
+ sys.ni_default_resp == 1 /* accept */ ?
+ LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT :
+ LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+
+ loc_ni_respond(response, ni_req); */
+#endif
+ LOGW("loc_ni_request_handler, notification in progress, new NI request ignored, type: %d",
+ ni_req->event);
+ }
+ else {
+ /* Print notification */
+ LOGD("NI Notification: %s, event: %d", msg, ni_req->event);
+
+ pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
+
+ /* Save request */
+ memcpy(&loc_eng_ni_data.loc_ni_request, ni_req, sizeof loc_eng_ni_data.loc_ni_request);
+
+ /* Set up NI response waiting */
+ loc_eng_ni_data.notif_in_progress = TRUE;
+ loc_eng_ni_data.current_notif_id = abs(rand());
+
+ /* Fill in notification */
+ notif.notification_id = loc_eng_ni_data.current_notif_id;
+
+ const rpc_loc_ni_vx_notify_verify_req_s_type *vx_req;
+ const rpc_loc_ni_supl_notify_verify_req_s_type *supl_req;
+ const rpc_loc_ni_umts_cp_notify_verify_req_s_type *umts_cp_req;
+
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ vx_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.vx_req;
+ notif.ni_type = GPS_NI_TYPE_VOICE;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME; // vx_req->user_resp_timer_val;
+ memset(notif.extras, 0, sizeof notif.extras);
+ memset(notif.text, 0, sizeof notif.text);
+ memset(notif.requestor_id, 0, sizeof notif.requestor_id);
+
+ // 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 = convert_encoding_type(vx_req->encoding_scheme);
+
+ // Set default_response & notify_flags
+ loc_ni_fill_notif_verify_type(&notif, vx_req->notification_priv_type);
+
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ umts_cp_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.umts_cp_req;
+ notif.ni_type = GPS_NI_TYPE_UMTS_CTRL_PLANE;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME; // umts_cp_req->user_response_timer;
+ memset(notif.extras, 0, sizeof notif.extras);
+ memset(notif.text, 0, sizeof notif.text);
+ memset(notif.requestor_id, 0, sizeof notif.requestor_id);
+
+ // Stores notification text
+ hexcode(notif.text, sizeof notif.text,
+#if (AMSS_VERSION==3200)
+ umts_cp_req->notification_text.notification_text_val,
+#else
+ umts_cp_req->notification_text,
+#endif
+ umts_cp_req->notification_length);
+
+ // Stores requestor ID
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+#if (AMSS_VERSION==3200)
+ umts_cp_req->requestor_id.requestor_id_string.requestor_id_string_val,
+#else
+ umts_cp_req->requestor_id.requestor_id_string,
+#endif
+ umts_cp_req->requestor_id.string_len);
+
+ notif.text_encoding = convert_encoding_type(umts_cp_req->datacoding_scheme);
+ notif.requestor_id_encoding = convert_encoding_type(umts_cp_req->datacoding_scheme);
+
+ // Set default_response & notify_flags
+ loc_ni_fill_notif_verify_type(&notif, umts_cp_req->notification_priv_type);
+
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ supl_req = &ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req;
+ notif.ni_type = GPS_NI_TYPE_UMTS_SUPL;
+ notif.timeout = LOC_NI_NO_RESPONSE_TIME; // supl_req->user_response_timer;
+ memset(notif.extras, 0, sizeof notif.extras);
+ memset(notif.text, 0, sizeof notif.text);
+ memset(notif.requestor_id, 0, sizeof notif.requestor_id);
+
+ // Client name
+ if (supl_req->flags & RPC_LOC_NI_CLIENT_NAME_PRESENT)
+ {
+ hexcode(notif.text, sizeof notif.text,
+#if (AMSS_VERSION==3200)
+ supl_req->client_name.client_name_string.client_name_string_val, /* buffer */
+#else
+ supl_req->client_name.client_name_string, /* buffer */
+#endif
+ supl_req->client_name.string_len /* length */
+ );
+ LOGD("SUPL NI: client_name: %s len=%d", notif.text, supl_req->client_name.string_len);
+ } else {
+ LOGD("SUPL NI: client_name not present.");
+ }
+
+ // Requestor ID
+ if (supl_req->flags & RPC_LOC_NI_REQUESTOR_ID_PRESENT)
+ {
+ hexcode(notif.requestor_id, sizeof notif.requestor_id,
+#if (AMSS_VERSION==3200)
+ supl_req->requestor_id.requestor_id_string.requestor_id_string_val, /* buffer */
+#else
+ supl_req->requestor_id.requestor_id_string, /* buffer */
+#endif
+ supl_req->requestor_id.string_len /* length */
+ );
+ LOGD("SUPL NI: requestor_id: %s len=%d", notif.requestor_id, supl_req->requestor_id.string_len);
+ } else {
+ LOGD("SUPL NI: requestor_id not present.");
+ }
+
+ // Encoding type
+ if (supl_req->flags & RPC_LOC_NI_ENCODING_TYPE_PRESENT)
+ {
+ notif.text_encoding = convert_encoding_type(supl_req->datacoding_scheme);
+ notif.requestor_id_encoding = convert_encoding_type(supl_req->datacoding_scheme);
+ } else {
+ notif.text_encoding = notif.requestor_id_encoding = GPS_ENC_UNKNOWN;
+ }
+
+ // Set default_response & notify_flags
+ loc_ni_fill_notif_verify_type(&notif, ni_req->payload.rpc_loc_ni_event_payload_u_type_u.supl_req.notification_priv_type);
+
+ break;
+
+ default:
+ LOGE("loc_ni_request_handler, unknown request event: %d", ni_req->event);
+ return;
+ }
+
+ /* Log requestor ID and text for debugging */
+ LOGI("Notification: notif_type: %d, timeout: %d, default_resp: %d", notif.ni_type, notif.timeout, notif.default_response);
+ LOGI(" requestor_id: %s (encoding: %d)", notif.requestor_id, notif.requestor_id_encoding);
+ LOGI(" text: %s text (encoding: %d)", notif.text, notif.text_encoding);
+
+ /* For robustness, always sets a timeout to clear up the notification status, even though
+ * the OEM layer in java does not do so.
+ **/
+ loc_eng_ni_data.response_time_left = 5 + (notif.timeout != 0 ? notif.timeout : LOC_NI_NO_RESPONSE_TIME);
+ LOGI("Automatically sends 'no response' in %d seconds (to clear status)\n", loc_eng_ni_data.response_time_left);
+
+ pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
+
+ /* Notify callback */
+ if (loc_eng_data.ni_notify_cb != NULL)
+ {
+ loc_eng_data.ni_notify_cb(&notif);
+ }
+ }
+}
+
+/*===========================================================================
+
+FUNCTION loc_ni_process_user_response
+
+DESCRIPTION
+ Handles user input from the UI
+
+RETURN VALUE
+ error code (0 for successful, -1 for error)
+
+===========================================================================*/
+int loc_ni_process_user_response(GpsUserResponseType userResponse)
+{
+ LOGD("NI response from UI: %d", userResponse);
+
+ rpc_loc_ni_user_resp_e_type resp;
+ switch (userResponse)
+ {
+ case GPS_NI_RESPONSE_ACCEPT:
+ resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_ACCEPT;
+ break;
+ case GPS_NI_RESPONSE_DENY:
+ resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_DENY;
+ break;
+ case GPS_NI_RESPONSE_NORESP:
+ resp = RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP;
+ break;
+ default:
+ return -1;
+ }
+
+ loc_ni_respond(resp, &loc_eng_ni_data.loc_ni_request);
+
+ /* Make the NI respond */
+ pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
+ loc_eng_ni_data.notif_in_progress = FALSE;
+ loc_eng_ni_data.response_time_left = 0;
+ loc_eng_ni_data.current_notif_id = -1;
+ pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
+
+ return 0;
+}
+
+/*===========================================================================
+
+FUNCTION loc_eng_ni_callback
+
+DESCRIPTION
+ Loc API callback handler
+
+RETURN VALUE
+ error code (0 for success)
+
+===========================================================================*/
+int loc_eng_ni_callback (
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+)
+{
+ int rc = 0;
+ const rpc_loc_ni_event_s_type *ni_req = &loc_event_payload->rpc_loc_event_payload_u_type_u.ni_request;
+ if (loc_event == RPC_LOC_EVENT_NI_NOTIFY_VERIFY_REQUEST)
+ {
+ switch (ni_req->event)
+ {
+ case RPC_LOC_NI_EVENT_VX_NOTIFY_VERIFY_REQ:
+ LOGI("VX Notification");
+ loc_ni_request_handler("VX Notify", ni_req);
+ break;
+
+ case RPC_LOC_NI_EVENT_UMTS_CP_NOTIFY_VERIFY_REQ:
+ LOGI("UMTS CP Notification\n");
+ loc_ni_request_handler("UMTS CP Notify", ni_req);
+ break;
+
+ case RPC_LOC_NI_EVENT_SUPL_NOTIFY_VERIFY_REQ:
+ LOGI("SUPL Notification\n");
+ loc_ni_request_handler("SUPL Notify", ni_req);
+ break;
+
+ default:
+ LOGE("Unknown NI event: %x\n", (int) ni_req->event);
+ break;
+ }
+ }
+ return rc;
+}
+
+/*===========================================================================
+
+FUNCTION loc_ni_thread_proc
+
+===========================================================================*/
+static void loc_ni_thread_proc(void *unused)
+{
+ LOGI("Starting Loc NI thread...\n");
+
+ while (1)
+ {
+ /* wakes up every second to check timed out requests */
+ sleep(1);
+
+ pthread_mutex_lock(&loc_eng_ni_data.loc_ni_lock);
+
+ if (loc_eng_ni_data.notif_in_progress && loc_eng_ni_data.response_time_left > 0)
+ {
+ loc_eng_ni_data.response_time_left--;
+ if (loc_eng_ni_data.response_time_left <= 0)
+ {
+ loc_ni_respond(RPC_LOC_NI_LCS_NOTIFY_VERIFY_NORESP, &loc_eng_ni_data.loc_ni_request);
+ loc_eng_ni_data.notif_in_progress = FALSE;
+ }
+ }
+
+ pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
+ } /* while (1) */
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_init
+
+DESCRIPTION
+ This function initializes the NI interface
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_init(GpsNiCallbacks *callbacks)
+{
+ LOGD("loc_eng_ni_init: entered.");
+
+ if (!loc_eng_ni_data_init)
+ {
+ pthread_mutex_init(&loc_eng_ni_data.loc_ni_lock, NULL);
+ callbacks->create_thread_cb("loc_api_ni", loc_ni_thread_proc, NULL);
+ loc_eng_ni_data_init = TRUE;
+ }
+
+ loc_eng_ni_data.notif_in_progress = FALSE;
+ loc_eng_ni_data.current_notif_id = -1;
+ loc_eng_ni_data.response_time_left = 0;
+
+ srand(time(NULL));
+ loc_eng_data.ni_notify_cb = callbacks->notify_cb;
+}
+
+/*===========================================================================
+FUNCTION loc_eng_ni_respond
+
+DESCRIPTION
+ This function sends an NI respond to the modem processor
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ None
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+void loc_eng_ni_respond(int notif_id, GpsUserResponseType user_response)
+{
+ if (notif_id == loc_eng_ni_data.current_notif_id && loc_eng_ni_data.notif_in_progress)
+ {
+ LOGI("loc_eng_ni_respond: send user response %d for notif %d", user_response, notif_id);
+ loc_ni_process_user_response(user_response);
+ } else {
+ LOGE("loc_eng_ni_respond: notif_id %d mismatch or notification not in progress, response: %d",
+ notif_id, user_response);
+ }
+}
diff --git a/loc_api/libloc_api_goog/loc_eng_ni.h b/loc_api/libloc_api_goog/loc_eng_ni.h
new file mode 100755
index 0000000..88d285a
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng_ni.h
@@ -0,0 +1,55 @@
+/******************************************************************************
+ @file: loc_eng_ni.cpp
+ @brief: module for network initiated interactions
+
+ DESCRIPTION
+ LOC_API network initiated operation support
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+ Copyright (c) 2009 QUALCOMM Incorporated.
+ All Rights Reserved. QUALCOMM Proprietary and Confidential.
+ -----------------------------------------------------------------------------
+******************************************************************************/
+
+/*=====================================================================
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+when who what, where, why
+-------- --- -------------------------------------------------------
+07/30/09 dx Initial version
+
+$Id:
+======================================================================*/
+
+#ifndef LOC_ENG_NI_H
+#define LOC_ENG_NI_H
+
+#include <hardware/gps.h>
+
+#define LOC_NI_NO_RESPONSE_TIME 20 /* secs */
+
+extern const GpsNiInterface sLocEngNiInterface;
+
+typedef struct {
+ pthread_mutex_t loc_ni_lock;
+ int response_time_left; /* examine time for NI response */
+ boolean notif_in_progress; /* NI notification/verification in progress */
+ rpc_loc_ni_event_s_type loc_ni_request;
+ int current_notif_id; /* ID to check against response */
+} loc_eng_ni_data_s_type;
+
+// Functions for sLocEngNiInterface
+extern void loc_eng_ni_init(GpsNiCallbacks *callbacks);
+extern void loc_eng_ni_respond(int notif_id, GpsUserResponseType user_response);
+
+extern int loc_eng_ni_callback (
+ rpc_loc_event_mask_type loc_event, /* event mask */
+ const rpc_loc_event_payload_u_type* loc_event_payload /* payload */
+);
+
+#endif /* LOC_ENG_NI_H */
diff --git a/loc_api/libloc_api_goog/loc_eng_xtra.cpp b/loc_api/libloc_api_goog/loc_eng_xtra.cpp
new file mode 100755
index 0000000..9dda092
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng_xtra.cpp
@@ -0,0 +1,183 @@
+/******************************************************************************
+ @file: loc_eng.cpp
+ @brief:
+
+ DESCRIPTION
+ This file defines the implemenation for GPS hardware abstraction layer.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+/*=====================================================================
+$Header: $
+$DateTime: $
+$Author: $
+======================================================================*/
+#define LOG_NDDEBUG 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <errno.h>
+#include <math.h>
+#include <pthread.h>
+
+#include <rpc/rpc.h>
+#include <loc_api_rpc_glue.h>
+
+#include <loc_eng.h>
+
+#define LOG_TAG "lib_locapi"
+#include <utils/Log.h>
+
+// comment this out to enable logging
+// #undef LOGD
+// #define LOGD(...) {}
+
+#define LOC_XTRA_INJECT_DEFAULT_TIMEOUT (3100)
+#define XTRA_BLOCK_SIZE (400)
+
+static int qct_loc_eng_xtra_init (GpsXtraCallbacks* callbacks);
+static int qct_loc_eng_inject_xtra_data(char* data, int length);
+
+const GpsXtraInterface sLocEngXTRAInterface =
+{
+ sizeof(GpsXtraInterface),
+ qct_loc_eng_xtra_init,
+ qct_loc_eng_inject_xtra_data,
+};
+
+/*===========================================================================
+FUNCTION qct_loc_eng_xtra_init
+
+DESCRIPTION
+ Initialize XTRA module.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int qct_loc_eng_xtra_init (GpsXtraCallbacks* callbacks)
+{
+ rpc_loc_event_mask_type event;
+ loc_eng_xtra_data_s_type *xtra_module_data_ptr;
+
+ xtra_module_data_ptr = &(loc_eng_data.xtra_module_data);
+ xtra_module_data_ptr->download_request_cb = callbacks->download_request_cb;
+
+ return 0;
+}
+
+/*===========================================================================
+FUNCTION qct_loc_eng_inject_xtra_data
+
+DESCRIPTION
+ Injects XTRA file into the engine.
+
+DEPENDENCIES
+ N/A
+
+RETURN VALUE
+ 0: success
+ >0: failure
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int qct_loc_eng_inject_xtra_data(char* data, int length)
+{
+ int rpc_ret_val = RPC_LOC_API_GENERAL_FAILURE;
+ boolean ret_val = 0;
+ int total_parts;
+ uint8 part;
+ uint16 part_len;
+ uint16 len_injected;
+ rpc_loc_ioctl_data_u_type ioctl_data;
+ rpc_loc_predicted_orbits_data_s_type *predicted_orbits_data_ptr;
+
+ LOGV ("qct_loc_eng_inject_xtra_data, xtra size = %d, data ptr = 0x%x\n", length, (int) data);
+
+ ioctl_data.disc = RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_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 / XTRA_BLOCK_SIZE);
+ if ((total_parts % XTRA_BLOCK_SIZE) != 0)
+ {
+ total_parts += 1;
+ }
+ predicted_orbits_data_ptr->total_parts = total_parts;
+
+ len_injected = 0; // O bytes injected
+ // 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;
+
+ LOGV ("qct_loc_eng_inject_xtra_data, inject part = %d, len = %d, len = %d\n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len, predicted_orbits_data_ptr->data_ptr.data_ptr_len);
+ LOGV ("qct_loc_eng_inject_xtra_data, total part = %d, len = %d \n", predicted_orbits_data_ptr->part, predicted_orbits_data_ptr->part_len);
+
+ if (part < total_parts)
+ {
+ // No callback in this case
+ rpc_ret_val = loc_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA,
+ &ioctl_data);
+
+ if (rpc_ret_val != RPC_LOC_API_SUCCESS)
+ {
+ LOGE ("loc_ioctl for xtra returned %d \n", rpc_ret_val);
+ ret_val = EINVAL; // return error
+ break;
+ }
+ }
+ else // part == total_parts
+ {
+ // Last part injection, will need to wait for callback
+ ret_val = loc_eng_ioctl (loc_eng_data.client_handle,
+ RPC_LOC_IOCTL_INJECT_PREDICTED_ORBITS_DATA,
+ &ioctl_data,
+ LOC_XTRA_INJECT_DEFAULT_TIMEOUT,
+ NULL /* No output information is expected*/);
+ break; // done with injection
+ }
+
+ len_injected += predicted_orbits_data_ptr->part_len;
+ LOGV ("loc_ioctl for xtra len injected %d \n", len_injected);
+ }
+
+ return ret_val;
+}
diff --git a/loc_api/libloc_api_goog/loc_eng_xtra.h b/loc_api/libloc_api_goog/loc_eng_xtra.h
new file mode 100755
index 0000000..b5c7945
--- /dev/null
+++ b/loc_api/libloc_api_goog/loc_eng_xtra.h
@@ -0,0 +1,49 @@
+/******************************************************************************
+ @file: loc_eng.h
+ @brief:
+
+ DESCRIPTION
+ This file defines the data structure used by this XTRA module.
+
+ INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ -----------------------------------------------------------------------------
+Copyright (c) 2009, QUALCOMM USA, INC.
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+· Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+· Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+· Neither the name of the QUALCOMM USA, INC. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -----------------------------------------------------------------------------
+
+******************************************************************************/
+
+/*=====================================================================
+$Header: $
+$DateTime: $
+$Author: $
+======================================================================*/
+
+#ifndef LOC_ENG_XTRA_H
+#define LOC_ENG_XTRA_H
+
+#include <hardware/gps.h>
+
+extern const GpsXtraInterface sLocEngXTRAInterface;
+
+// Module data
+typedef struct
+{
+ // loc_eng_ioctl_cb_data_s_type ioctl_cb_data;
+ gps_xtra_download_request download_request_cb;
+
+} loc_eng_xtra_data_s_type;
+
+#endif // LOC_ENG_XTRA_H